/* =====================================================================
   i5host Support — design system
   RTL-first, purple brand, light workspace + dark navigation.
   ===================================================================== */

:root {
    --brand-50: #f5f3ff;
    --brand-100: #ede9fe;
    --brand-200: #ddd6fe;
    --brand-300: #c4b5fd;
    --brand-400: #a78bfa;
    --brand-500: #8b5cf6;
    --brand-600: #7c3aed;
    --brand-700: #6d28d9;
    --brand-800: #5b21b6;
    --brand-900: #4c1d95;

    --ink: #101828;
    --ink-2: #344054;
    --muted: #667085;
    --muted-2: #98a2b3;
    --line: #e6e8f0;
    --line-soft: #eef0f6;
    --bg: #f5f6fb;
    --surface: #ffffff;

    --ok: #079455;
    --ok-bg: #ecfdf3;
    --warn: #b54708;
    --warn-bg: #fffaeb;
    --danger: #d92d20;
    --danger-bg: #fef3f2;
    --info: #175cd3;
    --info-bg: #eff8ff;

    --sidebar-1: #150e2b;
    --sidebar-2: #0c0719;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 4px 12px rgba(16, 24, 40, .06);
    --shadow-md: 0 14px 34px rgba(16, 24, 40, .09);
    --shadow-brand: 0 12px 28px rgba(124, 58, 237, .28);
    --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure { margin: 0; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-800); }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------------
   Brand
   --------------------------------------------------------------------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    font-weight: 700;
    letter-spacing: -.3px;
}
.brand:hover { color: #fff; }
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    box-shadow: 0 6px 18px rgba(124, 58, 237, .45);
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-size: 21px; }
.brand-sub { font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, .62); letter-spacing: .3px; }
.brand-on-light { color: var(--ink); }
.brand-on-light:hover { color: var(--ink); }
.brand-on-light .brand-sub { color: var(--muted); }
.brand-light { color: #fff; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover { color: #fff; box-shadow: 0 16px 34px rgba(124, 58, 237, .38); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #fafaff; border-color: var(--brand-200); color: var(--brand-700); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-800); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b42318; color: #fff; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.btn-danger-soft:hover { background: #fee4e2; color: #b42318; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon { width: 17px; height: 17px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    transition: .15s ease;
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.inline-form { display: inline; }

/* ---------------------------------------------------------------------
   Alerts / badges / pills
   --------------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1px solid;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.65;
}
.alert-icon { width: 19px; height: 19px; margin-top: 2px; }
.alert-success { background: var(--ok-bg); border-color: #abefc6; color: #05603a; }
.alert-error { background: var(--danger-bg); border-color: #fecdca; color: #912018; }
.alert-warning { background: var(--warn-bg); border-color: #fedf89; color: #93370d; }
.alert-info { background: var(--info-bg); border-color: #b2ddff; color: #194185; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { background: #eff8ff; color: #175cd3; border-color: #d1e9ff; }
.badge-pending { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.badge-answered { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.badge-closed { background: #f2f4f7; color: #475467; border-color: #e4e7ec; }
.badge-neutral { background: #f2f4f7; color: #475467; }
.badge-internal { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.badge-internal::before { display: none; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid;
}
.pill-icon { width: 15px; height: 15px; }
.pill-brand { background: rgba(124, 58, 237, .12); border-color: rgba(139, 92, 246, .35); color: var(--brand-300); }

.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.prio::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.prio-low::before { background: #98a2b3; }
.prio-normal::before { background: #2e90fa; }
.prio-high::before { background: #f79009; }
.prio-urgent::before { background: #f04438; }

/* ---------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------- */
.app-body { background: var(--bg); }
.app-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    background: radial-gradient(120% 60% at 100% 0%, rgba(124, 58, 237, .28), transparent 60%),
                linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
    color: #fff;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-close { display: none; color: rgba(255,255,255,.7); }
.sidebar-section-label { font-size: 11px; letter-spacing: .8px; color: rgba(255, 255, 255, .38); padding: 0 10px; font-weight: 600; }
.sidebar-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 11px;
    color: rgba(255, 255, 255, .72);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: .15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.is-active {
    background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(109, 40, 217, .9));
    color: #fff;
    box-shadow: 0 10px 24px rgba(76, 29, 149, .45);
    border-color: rgba(196, 181, 253, .25);
}
.nav-icon { width: 19px; height: 19px; opacity: .9; }

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 11px;
    background: rgba(16, 185, 129, .07);
    border: 1px solid rgba(16, 185, 129, .18);
    margin-top: 4px;
}
.sidebar-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, .12);
    flex: 0 0 auto;
}
.sidebar-status strong { display: block; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .82); }
.sidebar-status small { display: block; font-size: 10px; color: rgba(255, 255, 255, .42); }

.sidebar-card {
    margin-top: auto;
    display: flex;
    gap: 11px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .09);
}
.sidebar-card-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(139, 92, 246, .2); color: var(--brand-300); display: grid; place-items: center; flex: 0 0 auto; }
.sidebar-card strong { display: block; font-size: 12.5px; margin-bottom: 2px; }
.sidebar-card p { font-size: 11.5px; color: rgba(255, 255, 255, .55); line-height: 1.6; }

.sidebar-footer { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: rgba(255, 255, 255, .38); padding: 0 4px; }
.sidebar-footer a { color: rgba(255, 255, 255, .55); }
.sidebar-footer a:hover { color: #fff; }

.app-main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 30px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-end { display: flex; align-items: center; gap: 12px; }
.menu-btn { display: none; }
.page-heading { min-width: 0; }
.eyebrow { display: block; font-size: 11px; font-weight: 600; color: var(--brand-600); letter-spacing: .4px; }
.page-heading h1 { font-size: 21px; font-weight: 700; letter-spacing: -.4px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip-text strong { font-size: 12.5px; font-weight: 600; }
.user-chip-text small { font-size: 10.5px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-100), var(--brand-200));
    color: var(--brand-800);
    font-weight: 700;
    font-size: 14px;
    flex: 0 0 auto;
}
.avatar-sm { width: 32px; height: 32px; font-size: 11.5px; }
.avatar-staff { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #075985; }
.avatar-client { background: linear-gradient(135deg, var(--brand-100), var(--brand-200)); color: var(--brand-800); }
.avatar-admin { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }

.content { padding: 26px 30px 40px; width: 100%; max-width: 1400px; margin: 0 auto; flex: 1; }
.app-footer { display: flex; justify-content: center; gap: 8px; padding: 18px 30px 26px; color: var(--muted-2); font-size: 12px; }
.footer-sep { opacity: .6; }

.sidebar-overlay { display: none; }

/* ---------------------------------------------------------------------
   Cards, grids, stats
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.card + .card { margin-top: 20px; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.card-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 22px; }
.card-body-tight { padding: 0; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line-soft); background: #fcfcfe; }

.grid { display: grid; gap: 20px; }
.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)); }
.grid-main-side { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .9fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    inset-inline-start: -30px;
    bottom: -40px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, .09), transparent 70%);
}
.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.stat-icon-brand { background: var(--brand-50); color: var(--brand-700); }
.stat-icon-blue { background: #eff8ff; color: #175cd3; }
.stat-icon-green { background: #ecfdf3; color: #067647; }
.stat-icon-amber { background: #fffaeb; color: #b54708; }
.stat-icon-gray { background: #f2f4f7; color: #475467; }
.stat-value { font-size: 25px; font-weight: 700; line-height: 1.1; letter-spacing: -.6px; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.hero-card {
    position: relative;
    padding: 26px;
    border-radius: var(--radius-lg);
    background: radial-gradient(120% 120% at 100% 0%, #2a1650 0%, #170e2e 45%, #0f0a20 100%);
    color: #fff;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, .28);
}
.hero-card::before {
    content: "";
    position: absolute;
    width: 340px; height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, .35), transparent 65%);
    top: -160px; inset-inline-end: -100px;
}
.hero-card h2 { font-size: 23px; line-height: 1.45; margin-bottom: 8px; letter-spacing: -.3px; }
.hero-card p { color: rgba(255, 255, 255, .68); font-size: 13.5px; max-width: 520px; }
.hero-card .row { margin-top: 18px; position: relative; }
.hero-card .btn-ghost { border-color: rgba(255, 255, 255, .25); color: #fff; }
.hero-card .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: start;
    padding: 12px 18px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .2px;
    color: var(--muted);
    background: #fafbfe;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfaff; }
.table .ticket-subject { font-weight: 600; color: var(--ink); display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .ticket-subject:hover { color: var(--brand-700); }
.table .sub { font-size: 11.5px; color: var(--muted); }
.table .num { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12px; color: var(--muted); direction: ltr; text-align: start; }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.form-label .req { color: var(--danger); }
.form-hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    padding: 10px 13px;
    font-size: 14px;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
    box-shadow: var(--shadow-xs);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, .14);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.75; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 36px; }
.field-error { font-size: 12px; color: var(--danger); }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand-600); }

.file-drop {
    border: 1.5px dashed #cfd4e3;
    border-radius: 12px;
    background: #fbfbfe;
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
    transition: .15s ease;
}
.file-drop:hover { border-color: var(--brand-300); background: var(--brand-50); }
.file-drop input[type=file] { display: block; width: 100%; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.file-name { display: block; margin-top: 8px; font-size: 12px; color: var(--brand-700); font-weight: 600; }

.file-picker { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; position: relative; }
.file-picker-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.file-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid var(--brand-200);
    background: #fff;
    color: var(--brand-700);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: .15s ease;
}
.file-picker-btn:hover { background: var(--brand-50); border-color: var(--brand-300); }
.file-picker .file-name { margin-top: 0; max-width: 100%; overflow-wrap: anywhere; }

.filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line-soft);
    background: #fcfcfe;
}
.filters .form-group { min-width: 150px; flex: 1 1 160px; }
.filters .filter-search { flex: 2 1 240px; }
.filters .btn { flex: 0 0 auto; }

/* ---------------------------------------------------------------------
   Pagination / empty
   --------------------------------------------------------------------- */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 18px; flex-wrap: wrap; }
.page-btn {
    min-width: 36px; height: 36px;
    padding: 0 10px;
    display: inline-grid; place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
}
.page-btn:hover { border-color: var(--brand-300); color: var(--brand-700); }
.page-btn.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-50); color: var(--brand-600); }
.empty-state h3 { font-size: 16px; color: var(--ink); margin-bottom: 5px; }
.empty-state p { font-size: 13px; max-width: 380px; margin: 0 auto 16px; }

/* ---------------------------------------------------------------------
   Ticket detail
   --------------------------------------------------------------------- */
.ticket-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 22px;
    border-bottom: 1px solid var(--line-soft);
}
.ticket-head h2 { font-size: 19px; line-height: 1.55; letter-spacing: -.3px; margin-bottom: 6px; }
.ticket-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.ticket-meta .mono { font-family: ui-monospace, Menlo, monospace; direction: ltr; }
.ticket-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.thread { padding: 24px 22px; display: flex; flex-direction: column; gap: 20px; }
.msg { display: flex; gap: 12px; }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-author { font-size: 13.5px; font-weight: 700; }
.msg-role { font-size: 10.5px; font-weight: 600; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); padding: 1px 7px; border-radius: 999px; }
.msg-time { font-size: 11px; color: var(--muted-2); }
.msg-bubble {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 17px;
    font-size: 14px;
    line-height: 1.9;
    color: var(--ink-2);
    box-shadow: var(--shadow-xs);
}
.msg-bubble p + p { margin-top: 10px; }
.msg.is-client .msg-bubble { background: linear-gradient(180deg, #faf8ff, #f7f4ff); border-color: var(--brand-100); }
.msg.is-staff .msg-bubble { background: #fff; }
.msg.is-admin .msg-bubble { background: #fffdf5; border-color: #fdecc8; }
.msg.is-internal .msg-bubble { background: #fffaeb; border-color: #fedf89; }
.msg-internal-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: #b54708; margin-bottom: 6px; }

.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 500;
    max-width: 100%;
}
.file-chip:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-50); }
.file-chip .icon { color: var(--brand-600); }
.file-chip .size { color: var(--muted-2); font-size: 10.5px; }

.reply-box { padding: 20px 22px; border-top: 1px solid var(--line-soft); background: #fcfcfe; }
.reply-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.reply-box .textarea { min-height: 110px; background: #fff; }
.reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.side-list { display: flex; flex-direction: column; }
.side-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.side-item:last-child { border-bottom: 0; }
.side-item .k { color: var(--muted); }
.side-item .v { font-weight: 600; text-align: end; }
.side-item .v a { font-weight: 600; }

.timeline { padding: 6px 22px 18px; }
.timeline-item { position: relative; padding: 12px 22px 12px 0; border-inline-start: 2px solid var(--line); margin-inline-start: 6px; }
.timeline-item:last-child { border-inline-start-color: transparent; }
.timeline-dot { position: absolute; inset-inline-start: -7px; top: 17px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-500); border: 2px solid #fff; box-shadow: 0 0 0 3px var(--brand-50); }
.timeline-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.timeline-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------------
   Auth
   --------------------------------------------------------------------- */
.auth-body { background: #f6f5fb; }
.auth-shell { display: grid; grid-template-columns: 1.02fr 1fr; min-height: 100vh; }
.auth-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 40px 52px;
    color: #fff;
    background:
        radial-gradient(80% 60% at 80% 10%, rgba(139, 92, 246, .4), transparent 60%),
        radial-gradient(60% 50% at 10% 90%, rgba(76, 29, 149, .55), transparent 60%),
        linear-gradient(160deg, #1a1033 0%, #120b26 55%, #0b0617 100%);
    overflow: hidden;
}
.auth-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 60% 40%, #000 10%, transparent 75%);
    pointer-events: none;
}
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel-body { margin: auto 0; padding: 48px 0; max-width: 500px; }
.auth-panel-head h2 { font-size: 33px; line-height: 1.5; letter-spacing: -.7px; margin: 18px 0 12px; }
.auth-panel-head p { color: rgba(255, 255, 255, .64); font-size: 14px; line-height: 1.9; }
.auth-features { display: flex; flex-direction: column; gap: 13px; margin-top: 30px; }
.auth-features li { display: flex; align-items: flex-start; gap: 11px; font-size: 13px; color: rgba(255, 255, 255, .8); }
.auth-features .icon { width: 18px; height: 18px; color: var(--brand-300); margin-top: 3px; }
.auth-trust { display: flex; gap: 30px; margin-top: 38px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .1); }
.auth-trust div { display: flex; flex-direction: column; }
.auth-trust strong { font-size: 21px; letter-spacing: -.4px; }
.auth-trust span { font-size: 11px; color: rgba(255, 255, 255, .5); }
.auth-panel-footer { display: flex; justify-content: space-between; font-size: 11.5px; color: rgba(255, 255, 255, .4); }
.auth-panel-footer a { color: rgba(255, 255, 255, .6); }
.auth-panel-footer a:hover { color: #fff; }

.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-card-head { margin-bottom: 26px; }
.auth-card-head h1 { font-size: 26px; letter-spacing: -.5px; margin-bottom: 6px; }
.auth-card-head p { color: var(--muted); font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .btn { margin-top: 4px; padding-block: 12px; }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-top: 4px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted-2); font-size: 11px; margin: 22px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-note { display: flex; gap: 9px; padding: 12px 14px; border-radius: 10px; background: #f8f7ff; border: 1px solid var(--brand-100); font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 22px; }
.auth-note .icon { color: var(--brand-600); width: 17px; height: 17px; margin-top: 2px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 24px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-left: 44px; }
.password-toggle { position: absolute; inset-inline-end: auto; left: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.password-toggle:hover { background: var(--brand-50); color: var(--brand-700); }

/* ---------------------------------------------------------------------
   Public landing
   --------------------------------------------------------------------- */
.public-body { background: #0b0716; color: #fff; }
.public-header { position: sticky; top: 0; z-index: 40; background: rgba(11, 7, 22, .82); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255, 255, 255, .07); }
.public-container { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: 24px; }
.public-nav { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 20px; }
.public-links { display: flex; gap: 28px; font-size: 13.5px; }
.public-links a { color: rgba(255, 255, 255, .65); }
.public-links a:hover { color: #fff; }
.public-actions { display: flex; align-items: center; gap: 12px; }
.public-actions .btn-primary { padding: 9px 18px; }

.hero { position: relative; overflow: hidden; padding: 80px 0 90px; }
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(50% 55% at 78% 18%, rgba(124, 58, 237, .35), transparent 70%),
        radial-gradient(40% 40% at 20% 80%, rgba(76, 29, 149, .3), transparent 70%);
    pointer-events: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.08fr .92fr; gap: 56px; align-items: center; }
.hero-copy h1 { font-size: 45px; line-height: 1.4; letter-spacing: -1.2px; margin: 20px 0 16px; }
.hero-copy h1 .grad { background: linear-gradient(120deg, #c4b5fd, #8b5cf6 55%, #d8b4fe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: rgba(255, 255, 255, .64); font-size: 15px; line-height: 2; max-width: 540px; }
.hero-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-actions .btn-ghost { border-color: rgba(255, 255, 255, .22); color: #fff; }
.hero-actions .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.hero-trust { display: flex; gap: 28px; margin-top: 36px; flex-wrap: wrap; }
.hero-trust div { display: flex; flex-direction: column; }
.hero-trust strong { font-size: 22px; letter-spacing: -.4px; }
.hero-trust span { font-size: 11.5px; color: rgba(255, 255, 255, .45); }

.hero-visual { position: relative; }
.mock-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
}
.mock-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.mock-top strong { font-size: 12.5px; }
.mock-dots { display: flex; gap: 5px; }
.mock-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.mock-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 4px 4px; }
.mock-msg { display: flex; gap: 10px; align-items: flex-start; }
.mock-avatar { width: 30px; height: 30px; border-radius: 50%; background: rgba(139, 92, 246, .35); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: 0 0 auto; }
.mock-bubble { flex: 1; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; padding: 10px 12px; }
.mock-line { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .16); margin-bottom: 6px; }
.mock-line.w-80 { width: 80%; }
.mock-line.w-60 { width: 60%; }
.mock-line.w-45 { width: 45%; margin-bottom: 0; }
.mock-bubble.brand { background: rgba(124, 58, 237, .22); border-color: rgba(167, 139, 250, .3); }
.mock-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; padding: 3px 8px; border-radius: 999px; background: rgba(16, 185, 129, .15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, .3); }
.mock-float {
    position: absolute;
    bottom: -22px;
    inset-inline-start: -18px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: #fff;
    color: var(--ink);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 11.5px;
    font-weight: 600;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.mock-float .icon { color: var(--ok); }

.section { padding: 76px 0; position: relative; }
.section-alt { background: #0e091d; border-block: 1px solid rgba(255, 255, 255, .06); }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 44px; }
.section-head h2 { font-size: 30px; letter-spacing: -.7px; margin: 14px 0 10px; }
.section-head p { color: rgba(255, 255, 255, .55); font-size: 14px; line-height: 1.9; }
.section-head .pill { margin-bottom: 4px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature {
    background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 16px;
    padding: 24px;
    transition: .2s ease;
}
.feature:hover { border-color: rgba(139, 92, 246, .4); transform: translateY(-3px); }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(124, 58, 237, .18); color: var(--brand-300); margin-bottom: 16px; border: 1px solid rgba(139, 92, 246, .25); }
.feature h3 { font-size: 15.5px; margin-bottom: 7px; }
.feature p { font-size: 12.5px; color: rgba(255, 255, 255, .55); line-height: 1.9; }

.security-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.security-copy h2 { font-size: 30px; letter-spacing: -.6px; margin: 14px 0 12px; }
.security-copy p { color: rgba(255, 255, 255, .58); font-size: 13.5px; line-height: 2; }
.security-list { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.security-list li { display: flex; gap: 11px; font-size: 13px; color: rgba(255, 255, 255, .78); }
.security-list .icon { color: #6ee7b7; width: 18px; height: 18px; margin-top: 3px; }

.tenants { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.tenant {
    border-radius: 16px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
}
.tenant-head { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.tenant-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-400); }
.tenant-line { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); margin-bottom: 7px; }
.tenant-line.w-70 { width: 70%; }
.tenant-line.w-50 { width: 50%; margin-bottom: 0; }
.tenant-shield { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(124, 58, 237, .25); border: 1px solid rgba(167, 139, 250, .4); color: var(--brand-300); }
.tenant-blocked { margin-top: 12px; font-size: 10.5px; color: #fca5a5; display: flex; align-items: center; gap: 5px; }

.faq-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item { border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; background: rgba(255, 255, 255, .03); padding: 16px 20px; }
.faq-item summary { cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 20px; color: var(--brand-300); line-height: 1; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { color: rgba(255, 255, 255, .55); font-size: 12.5px; line-height: 1.9; margin-top: 10px; }

.cta-band { padding: 60px 0 80px; }
.cta-inner {
    border-radius: 22px;
    padding: 44px;
    background: linear-gradient(120deg, rgba(124, 58, 237, .3), rgba(76, 29, 149, .2));
    border: 1px solid rgba(167, 139, 250, .3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.cta-inner h2 { font-size: 26px; letter-spacing: -.5px; margin-bottom: 6px; }
.cta-inner p { color: rgba(255, 255, 255, .6); font-size: 13.5px; }

.public-footer { border-top: 1px solid rgba(255, 255, 255, .07); padding: 28px 0; }
.public-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.public-footer p { font-size: 12px; color: rgba(255, 255, 255, .4); }
.public-footer-links { display: flex; gap: 18px; font-size: 12px; }
.public-footer-links a { color: rgba(255, 255, 255, .55); }
.public-footer-links a:hover { color: #fff; }

/* ---------------------------------------------------------------------
   Error page
   --------------------------------------------------------------------- */
.error-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(60% 50% at 50% 0%, #f0eaff, #f7f7fb 70%); }
.error-card { width: 100%; max-width: 520px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 40px 32px; box-shadow: var(--shadow-md); position: relative; }
.error-code { position: absolute; top: 10px; inset-inline-start: 24px; font-size: 74px; font-weight: 700; color: #f4f1ff; letter-spacing: -4px; line-height: 1; }
.error-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 20px auto 18px; background: var(--brand-50); color: var(--brand-700); position: relative; }
.error-icon .icon { width: 30px; height: 30px; }
.error-card h1 { font-size: 22px; letter-spacing: -.4px; margin-bottom: 8px; }
.error-card p { color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.error-actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.error-foot { margin-top: 26px; font-size: 11px; color: var(--muted-2); }

/* ---------------------------------------------------------------------
   Misc
   --------------------------------------------------------------------- */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 17px; letter-spacing: -.2px; }
.section-title a { font-size: 12.5px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; direction: ltr; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.w-full { width: 100%; }

.note-inline { display: flex; align-items: flex-start; gap: 8px; padding: 10px 13px; border-radius: 9px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800); font-size: 12px; line-height: 1.7; }
.note-inline .icon { width: 16px; height: 16px; margin-top: 2px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 1180px) {
    .grid-main-side { grid-template-columns: minmax(0, 1fr); }
    .grid-4, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-grid { gap: 36px; }
    .hero-copy h1 { font-size: 38px; }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        width: 280px;
        z-index: 60;
        transform: translateX(100%);
        transition: transform .25s ease;
        height: 100dvh;
    }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    [dir="ltr"] .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-close { display: inline-grid; }
    .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(10, 6, 20, .5); z-index: 55; opacity: 0; visibility: hidden; transition: .2s ease; }
    .sidebar-overlay.is-open { opacity: 1; visibility: visible; }
    .menu-btn { display: inline-grid; }
    .topbar { padding: 12px 18px; }
    .content { padding: 20px 18px 32px; }
    .grid-3, .feature-grid { grid-template-columns: 1fr; }
    .grid-2, .security-grid { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-panel { display: none; }
    .auth-form-side { min-height: 100vh; padding: 32px 20px; }
    .hero-grid { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
    .public-links { display: none; }
}

@media (max-width: 720px) {
    .stat-grid, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar-end .user-chip-text { display: none; }
    .topbar-end .btn-soft span { display: none; }
    .page-heading h1 { font-size: 17px; }
    .ticket-head { padding: 18px; }
    .thread { padding: 18px; }
    .reply-box { padding: 16px 18px; }
    .hero { padding: 52px 0 64px; }
    .hero-copy h1 { font-size: 30px; }
    .section { padding: 52px 0; }
    .section-head h2, .security-copy h2 { font-size: 24px; }
    .cta-inner { padding: 28px; }
    .tenants { grid-template-columns: 1fr; }
    .tenant-shield { margin: 0 auto; }
    .filters { padding: 14px 16px; }
    .filters .form-group { min-width: 100%; }
    .table th, .table td { padding: 11px 14px; }
    .auth-form-wrap { max-width: 100%; }
}
