/* AetherGuard Portal — shared theme for client.aetherguard.xyz and
   management.aetherguard.xyz. Same type system as aetherguard.xyz (Space
   Grotesk display + Inter body) so both portals read as the same company
   as the marketing site, not a bolted-on afterthought. */

@font-face {
    font-family: "Inter";
    src: url("/assets/fonts/Inter-var-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Space Grotesk";
    src: url("/assets/fonts/SpaceGrotesk-var-latin.woff2") format("woff2");
    font-weight: 500 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #10151c;
    --ink-soft: #4b5768;
    --ink-faint: #8993a3;
    --surface: #f4f6f9;
    --panel: #ffffff;
    --border: #e3e7ed;

    --navy: #0a0f18;
    --navy-soft: #131b28;
    --navy-elevated: #1b2536;
    --navy-border: rgba(255, 255, 255, 0.08);
    --navy-ink-faint: #7887a0;

    --brand: #2f7fe0;
    --brand-dark: #1f63b8;
    --brand-soft: #e8f1fd;
    --cyan: #4fd1e0;
    --steel: #97a2b4;

    --danger: #d0392f;
    --danger-soft: #fbe9e7;
    --warning: #b8720a;
    --warning-soft: #fdf1de;
    --success: #1c8a4a;
    --success-soft: #e5f6ea;
    --info: #2464c9;
    --info-soft: #e8f0fd;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 21, 28, 0.04), 0 8px 24px -8px rgba(16, 21, 28, 0.10);
    --shadow-sm: 0 1px 2px rgba(16, 21, 28, 0.06);
    --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 650; letter-spacing: -0.01em; margin: 0 0 0.4em 0; color: var(--ink); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 0.98rem; }
p { margin: 0 0 0.75em 0; color: var(--ink-soft); }

.eyebrow {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand);
}

/* ---- App shell ---- */

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

.app-sidebar {
    width: 254px;
    flex-shrink: 0;
    background: var(--navy);
    background-image: radial-gradient(circle at 15% 0%, rgba(47, 127, 224, 0.16), transparent 55%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-sidebar .brand {
    padding: 22px 20px 18px 20px;
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    gap: 11px;
}
.app-sidebar .brand img { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.app-sidebar .brand .name { font-family: var(--font-display); color: #fff; font-weight: 650; font-size: 1.04rem; letter-spacing: -0.01em; line-height: 1.2; }
.app-sidebar .brand .sub { color: var(--navy-ink-faint); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; margin-top: 2px; font-weight: 600; }

.app-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.app-nav .nav-group { margin-bottom: 20px; }
.app-nav .nav-label { font-family: var(--font-display); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em; color: #4d5c72; padding: 0 12px; margin-bottom: 8px; font-weight: 650; }
.app-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #a7b4c6;
    font-size: 0.89rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 2px;
    border-left: 2px solid transparent;
    transition: background-color .12s, color .12s;
}
.app-nav a:hover { background: var(--navy-elevated); color: #fff; text-decoration: none; }
.app-nav a.active { background: rgba(47, 127, 224, 0.16); color: #fff; font-weight: 620; border-left-color: var(--brand); }
.app-nav a .icon-slot { display: flex; opacity: 0.85; flex-shrink: 0; }
.app-nav a.active .icon-slot, .app-nav a:hover .icon-slot { opacity: 1; }
.app-nav a .badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
}

.app-sidebar .sidebar-foot {
    padding: 14px 16px;
    border-top: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-sidebar .sidebar-foot img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.app-sidebar .sidebar-foot .who { font-size: 0.82rem; color: #e2e8f2; font-weight: 600; line-height: 1.2; }
.app-sidebar .sidebar-foot .role { font-size: 0.71rem; color: var(--navy-ink-faint); }
.app-sidebar .sidebar-foot a.logout { margin-left: auto; color: #7c8ba1; display: flex; }
.app-sidebar .sidebar-foot a.logout:hover { color: #fff; }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-topbar h1 { font-size: 1.22rem; margin: 0; }
.app-content { padding: 26px 30px 64px 30px; max-width: 1180px; }

/* ---- Cards / panels ---- */

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    margin-bottom: 18px;
}
.panel-tight { padding: 14px 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.btn.sidebar-toggle-btn { display: none; }
@media (max-width: 860px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .app-sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .app-sidebar.open { transform: translateX(0); }
    .btn.sidebar-toggle-btn { display: inline-flex; }
}

.stat-card { display: flex; align-items: flex-start; gap: 14px; }
.stat-card .stat-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand-dark);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--ink-faint); margin-top: 3px; }

/* ---- Forms ---- */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.field-hint { font-size: 0.76rem; color: var(--ink-faint); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d6dce4;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { resize: vertical; min-height: 90px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-body);
}
.btn-solid { background: var(--brand); color: #fff; }
.btn-solid:hover { background: var(--brand-dark); text-decoration: none; }
.btn-outline { background: #fff; color: var(--ink); border-color: #d6dce4; }
.btn-outline:hover { background: #f2f4f7; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b12f27; text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }

/* password strength meter */
.pw-meter { height: 5px; border-radius: 4px; background: #e4e7ec; overflow: hidden; margin-top: 6px; }
.pw-meter-fill { height: 100%; width: 0%; transition: width .15s, background-color .15s; }
.pw-label { font-size: 0.75rem; font-weight: 600; margin-top: 4px; }

/* ---- Alerts / flash ---- */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 0.86rem; margin-bottom: 14px; }
.alert-error { background: var(--danger-soft); color: #8c231b; }
.alert-success { background: var(--success-soft); color: #145c31; }
.alert-info { background: var(--info-soft); color: #1a4586; }
.alert-warning { background: var(--warning-soft); color: #7a4d05; }

/* ---- Tables ---- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
table.data-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); padding: 9px 10px; border-bottom: 1px solid var(--border); font-weight: 650; }
table.data-table td { padding: 11px 10px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
table.data-table tr:hover td { background: #fafbfd; }
table.data-table tr.clickable { cursor: pointer; }

/* ---- Badges / dots (severity + status, kept as small symbols not full blocks) ---- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pill-severity-low { background: #eaf1fc; color: #2464c9; }
.pill-severity-normal { background: var(--brand-soft); color: var(--brand-dark); }
.pill-severity-high { background: var(--warning-soft); color: #a1620a; }
.pill-severity-critical { background: var(--danger-soft); color: #b12f27; }
.pill-status-open { background: var(--brand-soft); color: var(--brand-dark); }
.pill-status-pending { background: var(--warning-soft); color: #a1620a; }
.pill-status-resolved { background: var(--success-soft); color: #145c31; }
.pill-status-closed { background: #eef0f3; color: #64707e; }

/* ---- Sidebar list (ticket list panel) ---- */
.ticket-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.ticket-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    border-bottom: 1px solid #eef0f3;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: #fafbfd; text-decoration: none; }
.ticket-row.active { background: var(--brand-soft); }
.ticket-row .subject { font-weight: 600; font-size: 0.88rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-row .meta { font-size: 0.72rem; color: var(--ink-faint); }

/* ---- Chat ---- */
.chat-window { display: flex; flex-direction: column; height: 560px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.chat-presence { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--ink-soft); background: #fbfcfd; min-height: 20px; }
.chat-presence img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 78%; }
.chat-msg .bubble { padding: 9px 13px; border-radius: 12px; font-size: 0.87rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-msg .who { font-size: 0.7rem; color: var(--ink-faint); margin-bottom: 3px; }
.chat-msg.self { align-self: flex-end; }
.chat-msg.self .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg.self .who { text-align: right; }
.chat-msg.other .bubble { background: #f0f2f5; color: var(--ink); border-bottom-left-radius: 3px; }
.typing-indicator { font-size: 0.76rem; color: var(--ink-faint); font-style: italic; padding: 0 16px 8px 16px; height: 18px; }
.typing-dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); margin-right: 2px; animation: typingBounce 1s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.chat-compose { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; }
.chat-compose textarea { flex: 1; min-height: 40px; max-height: 120px; }

/* ---- Misc ---- */
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.muted { color: var(--ink-faint); }
.text-sm { font-size: 0.82rem; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.empty-state { text-align: center; padding: 52px 20px; color: var(--ink-faint); }
.empty-state .icon-wrap { display: flex; justify-content: center; margin-bottom: 12px; color: var(--steel); }

/* ---- Login shell ---- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    background-image:
        radial-gradient(circle at 20% 15%, rgba(47, 127, 224, 0.22), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(79, 209, 224, 0.10), transparent 40%),
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: auto, auto, 28px 28px, 28px 28px;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 408px;
    background: var(--panel);
    border-radius: 16px;
    padding: 36px 34px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.4);
    text-align: center;
}
.login-card .login-logo { width: 56px; height: 56px; margin: 0 auto 14px auto; display: block; }
.login-card .brand-mark { color: var(--brand-dark); font-family: var(--font-display); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.11em; margin-bottom: 4px; }
.login-card h1 { font-size: 1.35rem; }
.login-card p { text-align: left; }
.login-card form { text-align: left; }
.login-card .alert { text-align: left; }
