/* ============================================================
   PrimeTrust Business Suite - Admin theme
   Brand: navy #0A2540, blue #1E63C3, green #16A34A
   Fonts: Plus Jakarta Sans (headings), Inter (body)
   ============================================================ */

:root {
    --navy: #0A2540;
    --navy-deep: #071A2E;
    --blue: #1E63C3;
    --blue-deep: #1B4F9B;
    --green: #16A34A;
    --green-dark: #15803D;
    --danger: #DC2626;
    --danger-bg: #FEE2E2;
    --warning: #D97706;
    --warning-bg: #FEF3C7;

    --ink: #0F2033;
    --slate: #475569;
    --muted: #94A3B8;
    --line: #E5E9F0;
    --line-soft: #F1F5F9;
    --canvas: #F6F8FB;
    --white: #FFFFFF;

    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(10,37,64,.06);
    --shadow: 0 8px 24px rgba(10,37,64,.08);
    --shadow-lg: 0 16px 40px rgba(10,37,64,.12);

    --sidebar-w: 256px;
    --font-head: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    background: var(--canvas);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
h1,h2,h3,h4 { font-family: var(--font-head); color: var(--navy); margin: 0; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
    color: #C7D3E3;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, var(--blue), var(--green));
    color: #fff; font-family: var(--font-head); font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-head); font-weight: 800; color: #fff; font-size: 15px; }
.brand-sub { font-size: 11px; color: #7F94AE; letter-spacing: .04em; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-group {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
    color: #6B82A0; margin: 18px 12px 7px; font-weight: 700;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 10px;
    color: #C7D3E3; font-weight: 500; font-size: 13.5px;
    margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active {
    background: linear-gradient(135deg, rgba(30,99,195,.9), rgba(27,79,155,.9));
    color: #fff; box-shadow: var(--shadow-sm);
}
.nav-item.is-disabled { color: #5C728C; opacity: .5; cursor: default; }
.nav-item.is-disabled:hover { background: none; }
.nav-icon { width: 18px; text-align: center; font-size: 14px; opacity: .9; }
.nav-soon {
    margin-left: auto; font-size: 9.5px; text-transform: uppercase;
    background: rgba(255,255,255,.1); padding: 2px 6px; border-radius: 999px; letter-spacing: .05em;
}

.sidebar__footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--green));
    color: #fff; font-weight: 700; font-size: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #7F94AE; font-size: 11px; }
.btn-signout {
    width: 100%; padding: 9px; border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.04); color: #C7D3E3; border-radius: 9px;
    font-family: var(--font-body); font-weight: 600; font-size: 12.5px; cursor: pointer;
    transition: background .15s;
}
.btn-signout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 62px; background: var(--white); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar__toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--navy); }
.topbar__title { font-size: 17px; font-weight: 700; }
.topbar__right { margin-left: auto; }
.topbar__company { color: var(--muted); font-size: 12.5px; font-weight: 500; }

.content { padding: 26px 24px 48px; max-width: 1200px; width: 100%; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; font-size: 13.5px; }
.alert--success { background: #E9F8EF; color: var(--green-dark); border: 1px solid rgba(22,163,74,.2); }
.alert--error { background: var(--danger-bg); color: #991B1B; border: 1px solid rgba(220,38,38,.2); }
.alert--info { background: #EAF2FD; color: #1E4E9C; border: 1px solid rgba(30,99,195,.2); }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Cards / panels ---------- */
.card {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card__head {
    padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: center; justify-content: space-between;
}
.card__title { font-size: 15px; font-weight: 700; }
.card__body { padding: 20px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
.stat.stat--green::before { background: var(--green); }
.stat.stat--navy::before { background: var(--navy); }
.stat.stat--amber::before { background: var(--warning); }
.stat__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat__value { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--navy); margin-top: 6px; line-height: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left; padding: 11px 16px; background: var(--line-soft);
    color: var(--slate); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--line);
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FBFCFE; }
table.data tr.row--cleared td { background: #F0FBF4; }
table.data tr.row--cleared:hover td { background: #E7F7EE; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge--green { background: #E9F8EF; color: var(--green-dark); }
.badge--gray { background: var(--line-soft); color: var(--slate); }
.badge--red { background: var(--danger-bg); color: #991B1B; }
.badge--blue { background: #EFF4FC; color: var(--blue-deep); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 18px; border-radius: 10px; font-family: var(--font-body);
    font-weight: 600; font-size: 13.5px; cursor: pointer; border: 1px solid transparent;
    transition: filter .15s, background .15s; white-space: nowrap;
}
.btn--primary { background: linear-gradient(135deg, var(--blue-deep), var(--blue)); color: #fff; box-shadow: 0 4px 14px rgba(27,79,155,.28); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--green { background: linear-gradient(135deg, var(--green-dark), var(--green)); color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,.26); }
.btn--outline { background: #fff; border-color: var(--line); color: var(--slate); }
.btn--outline:hover { border-color: var(--muted); }
.btn--danger { background: #fff; border-color: rgba(220,38,38,.3); color: var(--danger); }
.btn--danger:hover { background: var(--danger-bg); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--icon { padding: 7px 10px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 4px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--slate); }
.field input, .field select, .field textarea {
    padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px;
    font-family: var(--font-body); font-size: 14px; color: var(--ink); background: #fff;
    outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field-error { color: var(--danger); font-size: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-soft); }

/* Checkbox row */
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }

/* Permission grid */
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.perm-group__head { background: var(--line-soft); padding: 10px 14px; font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); }
.perm-group__body { padding: 12px 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.perm-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.perm-item input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head__title { font-size: 22px; font-weight: 800; }
.page-head__sub { color: var(--slate); font-size: 13.5px; margin-top: 3px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select {
    padding: 9px 13px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 13.5px; font-family: var(--font-body); background: #fff; outline: none;
}
.toolbar input[type=search]:focus, .toolbar select:focus { border-color: var(--blue); }
.toolbar__spacer { flex: 1; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 5px; margin-top: 18px; list-style: none; padding: 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; color: var(--slate); background: #fff;
}
.pagination .active span { background: var(--blue); color: #fff; border-color: var(--blue); }
.pagination [aria-disabled] { opacity: .4; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty__icon { font-size: 30px; margin-bottom: 12px; opacity: .5; }
.empty__title { font-weight: 700; color: var(--navy); margin-bottom: 4px; }

/* ---------- Activity list ---------- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.activity li:last-child { border-bottom: none; }
.activity__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); margin-top: 6px; flex-shrink: 0; }
.activity__body { flex: 1; min-width: 0; }
.activity__desc { font-size: 13.5px; color: var(--ink); }
.activity__meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.text-muted { color: var(--muted); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid, .perm-group__body { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar__toggle { display: block; }
    .content { padding: 18px 16px 40px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
