:root {
    --blue-900: #0b1f4d;
    --blue-800: #12306f;
    --yellow-500: #f2b705;
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #d9e2ef;
    --text: #14213d;
    --muted: #6b7280;
    --danger: #b42318;
    --success: #027a48;
    --warning: #b54708;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--blue-900);
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--yellow-500);
    color: var(--blue-900);
    font-weight: 800;
    font-size: 24px;
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand span {
    color: var(--yellow-500);
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a,
.nav span {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.nav a.active {
    background: var(--yellow-500);
    color: var(--blue-900);
    font-weight: 800;
}

.nav span {
    opacity: 0.45;
}

.logout {
    margin-top: auto;
}

.logout button {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: #fee4e2;
    color: var(--danger);
    padding: 12px;
    font-weight: 800;
    cursor: pointer;
}

.content {
    flex: 1;
    padding: 28px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 6px;
    color: var(--blue-900);
}

p {
    margin: 0;
    color: var(--muted);
}

.button {
    border: none;
    border-radius: 10px;
    background: var(--yellow-500);
    color: var(--blue-900);
    padding: 11px 16px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--blue-900);
}

.button-danger {
    border: none;
    border-radius: 10px;
    background: #fee4e2;
    color: var(--danger);
    padding: 9px 12px;
    font-weight: 800;
    cursor: pointer;
}

.button-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.actions-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.alert-success {
    background: #dcfae6;
    color: var(--success);
    border: 1px solid #abefc6;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 800;
}

.alert-error {
    background: #fee4e2;
    color: var(--danger);
    border: 1px solid #fecdca;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 800;
}

.alert-warning {
    background: #fff3cd;
    color: #7a4b00;
    border: 1px solid #ffe08a;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 800;
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.panel-body {
    padding: 22px;
}

.panel-narrow {
    max-width: 760px;
}

.panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-header h2 {
    margin: 0;
    color: var(--blue-900);
    font-size: 18px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: var(--blue-900);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
}

.badge.success {
    background: #dcfae6;
    color: var(--success);
}

.badge.warning {
    background: #fef0c7;
    color: var(--warning);
}

.badge.danger {
    background: #fee4e2;
    color: var(--danger);
}

.badge.neutral {
    background: #eef2f6;
    color: #475467;
}

.code {
    font-family: Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
    font-size: 13px;
    color: var(--blue-900);
    word-break: break-all;
}

.field {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 800;
    color: var(--blue-900);
    margin-bottom: 8px;
}

input,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.token-box {
    background: var(--blue-900);
    color: #ffffff;
    border-radius: 14px;
    padding: 18px;
    overflow-x: auto;
    margin-bottom: 18px;
}

.token-box code {
    font-family: Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
    font-size: 14px;
    word-break: break-all;
    white-space: pre-wrap;
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    padding: 20px;
}

.label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.metric {
    font-size: 34px;
    color: var(--blue-900);
    font-weight: 800;
}

.detail {
    max-width: 420px;
    white-space: normal;
}

.health-list {
    display: grid;
    gap: 10px;
}

.health-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.health-row:last-child {
    border-bottom: none;
}

@media (max-width: 1100px) {
    .sidebar {
        display: none;
    }

    .content {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}
EOFcd /opt/syschatia-admin/laravel

sudo tee app/resources/views/layouts/admin.blade.php > /dev/null <<'EOF'
<!doctype html>
<html lang="pt-PT">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>@yield('title', 'SYSCHATIA Admin')</title>

    <link rel="stylesheet" href="{{ asset('assets/admin.css') }}">

    @stack('styles')
</head>
<body>
    <div class="shell">
        <aside class="sidebar">
            <div class="brand">
                <div class="brand-mark">S</div>
                <div>
                    <strong>SYSCHATIA</strong>
                    <span>Admin Laravel</span>
                </div>
            </div>

            <nav class="nav">
                <a href="{{ route('admin.dashboard') }}" class="{{ request()->routeIs('admin.dashboard') ? 'active' : '' }}">Dashboard</a>
                <a href="{{ route('admin.channels') }}" class="{{ request()->routeIs('admin.channels') ? 'active' : '' }}">Canais</a>
                <a href="{{ route('admin.tokens') }}" class="{{ request()->routeIs('admin.tokens*') ? 'active' : '' }}">Tokens</a>
                <a href="{{ route('admin.audit') }}" class="{{ request()->routeIs('admin.audit') ? 'active' : '' }}">Auditoria</a>
                <a href="{{ route('admin.reports') }}" class="{{ request()->routeIs('admin.reports') ? 'active' : '' }}">Relatórios</a>
            </nav>

            <form class="logout" method="POST" action="{{ route('admin.logout') }}">
                @csrf
                <button type="submit">Sair</button>
            </form>
        </aside>

        <main class="content">
            <header class="topbar">
                <div>
                    <h1>@yield('page_title', 'SYSCHATIA')</h1>
                    <p>@yield('page_subtitle', '')</p>
                </div>

                <div class="actions-inline">
                    @yield('page_actions')
                </div>
            </header>

            @if (session('success'))
                <div class="alert-success">{{ session('success') }}</div>
            @endif

            @if ($errors->any())
                <div class="alert-error">
                    @foreach ($errors->all() as $error)
                        <div>{{ $error }}</div>
                    @endforeach
                </div>
            @endif

            @yield('content')
        </main>
    </div>

    @stack('scripts')
</body>
</html>

/* =========================================================
   LOGIN ADMINISTRATIVO
   ========================================================= */

.login-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(250, 190, 0, 0.16), transparent 32%),
        linear-gradient(135deg, #eef3fb 0%, #f8fafc 52%, #e8eef8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text, #061b3a);
}

.login-shell {
    width: 100%;
    min-height: 100vh;
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: min(100%, 440px);
    background: #ffffff;
    border: 1px solid var(--border, #d8e1ef);
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 24px 70px rgba(6, 27, 58, 0.14);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.login-brand .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #f4b400;
    color: #061b3a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 24px;
}

.login-brand strong {
    display: block;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: #061b3a;
}

.login-brand span {
    display: block;
    font-size: 13px;
    color: #53657d;
    margin-top: 2px;
}

.login-card h1 {
    margin: 0 0 8px 0;
    color: #061b3a;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.login-card p {
    margin: 0 0 24px 0;
    color: #53657d;
    font-size: 15px;
}

.login-card .field {
    margin-bottom: 18px;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    color: #061b3a;
    font-weight: 800;
    font-size: 14px;
}

.login-card input {
    width: 100%;
    border: 1px solid var(--border, #d8e1ef);
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
    background: #ffffff;
    color: #061b3a;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-card input:focus {
    border-color: #f4b400;
    box-shadow: 0 0 0 4px rgba(244, 180, 0, 0.18);
}

.button-full {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.login-note {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border, #d8e1ef);
    color: #53657d;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 560px) {
    .login-shell {
        padding: 18px;
    }

    .login-card {
        padding: 26px 22px;
        border-radius: 20px;
    }

    .login-card h1 {
        font-size: 26px;
    }
}

/* Ajustes SYSCHATIA - formulários fluidos e idioma */
.panel-narrow {
    width: min(100%, 980px);
    max-width: 980px;
}

.panel-body,
.panel-body form {
    width: 100%;
}

.field textarea {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    box-sizing: border-box;
}

.language-switcher {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    color: #ffffff;
}

.language-switcher span {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    opacity: 0.82;
}

.language-switcher div {
    display: flex;
    gap: 8px;
}

.language-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.language-switcher a.active {
    background: #f7b801;
    color: #071b4d;
}

@media (min-width: 1400px) {
    .panel-narrow {
        max-width: 1120px;
    }
}

@media (max-width: 900px) {
    .panel-narrow {
        max-width: 100%;
    }

    .field textarea {
        min-height: 140px;
    }
}

/* Correção responsiva forte - formulários de cadastro/edição */
.content {
    width: 100%;
    max-width: none;
}

.content > .panel,
.content .panel-narrow {
    width: 100%;
}

.panel-narrow {
    max-width: 1180px !important;
    width: min(100%, 1180px) !important;
}

.panel-narrow .panel-body,
.panel-narrow form {
    width: 100% !important;
}

.panel-narrow .field {
    width: 100%;
}

.panel-narrow input,
.panel-narrow select,
.panel-narrow textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.panel-narrow textarea {
    min-height: 190px !important;
    resize: vertical;
    font-family: inherit;
    line-height: 1.45;
}

@media (min-width: 1500px) {
    .panel-narrow {
        max-width: 1320px !important;
        width: min(100%, 1320px) !important;
    }
}

@media (max-width: 1100px) {
    .panel-narrow {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Botões de ação por ícone */
.icon-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.icon-actions form {
    margin: 0;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d6e0ef;
    border-radius: 10px;
    background: #ffffff;
    color: #071b4d;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.icon-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(7, 27, 77, 0.12);
    background: #f8fbff;
}

.icon-button-danger {
    border-color: #ffd2d2;
    background: #ffe6e6;
}

.icon-button-danger:hover {
    background: #ffdada;
}

.icon-button-success {
    border-color: #c7f2d2;
    background: #e7faed;
}

.icon-button-success:hover {
    background: #d8f6e2;
}
