:root {
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --text-primary: #1d1f24;
    --text-secondary: #5b6472;
    --text-muted: #9aa3b0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--text-primary);
    background: #f4f5f7;
    -webkit-font-smoothing: antialiased;
}

.boot { padding: 40px; color: var(--text-muted); font-size: 14px; }

/* ---- App shell ---- */
.app { display: flex; height: 100vh; overflow: hidden; background: #f4f5f7; }

.sidebar { width: 230px; flex-shrink: 0; background: #1a2744; display: flex; flex-direction: column; }
.sb-top { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sb-brand { font-size: 14px; font-weight: 600; color: #fff; }
.sb-role { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 2px; letter-spacing: 0.03em; }
.sb-section { padding: 14px 0 6px; }
.sb-label { font-size: 10px; font-weight: 500; color: rgba(255,255,255,0.28); letter-spacing: 0.08em; text-transform: uppercase; padding: 0 18px 6px; }
.nav-link { display: flex; align-items: center; gap: 9px; padding: 8px 18px; cursor: pointer; color: rgba(255,255,255,0.55); font-size: 13px; border-left: 2px solid transparent; transition: all 0.1s; text-decoration: none; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.9); }
.nav-link.active { background: rgba(59,111,212,0.22); color: #fff; border-left-color: #3b6fd4; }
.nav-link i { font-size: 16px; width: 16px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: #3b6fd4; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.sb-footer { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.sb-user { display: flex; align-items: center; gap: 9px; }
.sb-avatar { width: 30px; height: 30px; border-radius: 50%; background: #3b6fd4; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }
.sb-uname { font-size: 12px; color: rgba(255,255,255,0.9); font-weight: 500; }
.sb-urole { font-size: 10px; color: rgba(255,255,255,0.4); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: #fff; border-bottom: 0.5px solid rgba(0,0,0,0.09); padding: 0 24px; height: 54px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-user { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; }
.content { flex: 1; overflow-y: auto; padding: 22px 24px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; font-weight: 600; }
.page-head .sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 0.5px solid rgba(0,0,0,0.15); background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-primary); transition: background 0.12s; font-family: inherit; text-decoration: none; }
.btn:hover { background: #f4f5f7; }
.btn-primary { background: #1a2744; color: #fff; border-color: #1a2744; }
.btn-primary:hover { background: #253460; }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn i { font-size: 15px; }

/* ---- Stats ---- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 0.5px solid rgba(0,0,0,0.09); border-radius: 10px; padding: 14px 16px; }
.stat-lbl { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.stat-lbl i { font-size: 14px; }
.stat-val { font-size: 26px; font-weight: 600; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.blue { color: #185fa5; } .green { color: #0f6e56; } .amber { color: #854f0b; } .navy { color: #1a2744; }

/* ---- Cards & tables ---- */
.card { background: #fff; border: 0.5px solid rgba(0,0,0,0.09); border-radius: 10px; overflow: hidden; }
.card-hdr { padding: 14px 16px; border-bottom: 0.5px solid rgba(0,0,0,0.07); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 13px; font-weight: 600; }
.search-row { display: flex; gap: 8px; align-items: center; }
.search-inp { font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 0.5px solid rgba(0,0,0,0.12); background: #fff; color: var(--text-primary); width: 190px; font-family: inherit; }
.search-inp:focus { outline: none; border-color: #3b6fd4; box-shadow: 0 0 0 3px rgba(59,111,212,0.1); }
.filt { font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 0.5px solid rgba(0,0,0,0.12); background: #fff; color: var(--text-primary); cursor: pointer; font-family: inherit; }

table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 16px; text-align: left; background: #f8f8f8; border-bottom: 0.5px solid rgba(0,0,0,0.07); }
td { font-size: 13px; padding: 11px 16px; border-bottom: 0.5px solid rgba(0,0,0,0.06); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(0,0,0,0.014); }
.row-link { cursor: pointer; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 20px; }
.b-active { background: #e1f5ee; color: #0f6e56; }
.b-setup { background: #faeeda; color: #854f0b; }
.b-suspended { background: #fcebeb; color: #791f1f; }
.b-onboard { background: #e8effe; color: #185fa5; }
.b-offboard { background: #f3e8ff; color: #6b21a8; }
.b-muted { background: #eef0f3; color: #5b6472; }

.client-logo { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }

.act-btn { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px 6px; border-radius: 4px; font-size: 14px; transition: all 0.1s; }
.act-btn:hover { color: #3b6fd4; background: #e8effe; }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty i { font-size: 32px; margin-bottom: 10px; display: block; }
.empty-t { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

/* ---- Detail view ---- */
.detail-hdr { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.detail-logo { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600; color: #fff; }
.detail-name { font-size: 19px; font-weight: 600; }
.detail-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.detail-tabs { display: flex; gap: 0; border-bottom: 0.5px solid rgba(0,0,0,0.09); margin-bottom: 20px; }
.dtab { padding: 9px 16px; font-size: 13px; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -0.5px; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.dtab.active { color: #1a2744; border-bottom-color: #1a2744; font-weight: 600; }
.dtab:hover { color: var(--text-primary); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.il { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.iv { font-size: 13px; font-weight: 500; }
.sec-title { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; margin: 18px 0 12px; padding-bottom: 6px; border-bottom: 0.5px solid rgba(0,0,0,0.07); }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perm-item { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 0.5px solid rgba(0,0,0,0.1); border-radius: 8px; }
.perm-item.on { border-color: #3b6fd4; background: #f0f4ff; }
.perm-item input[type=checkbox] { width: 14px; height: 14px; accent-color: #3b6fd4; flex-shrink: 0; margin-top: 1px; }
.perm-label { font-size: 12px; font-weight: 500; line-height: 1.3; }
.perm-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.req-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-bottom: 0.5px solid rgba(0,0,0,0.07); }
.req-row:last-child { border-bottom: none; }
.portal-link { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0.5px solid rgba(0,0,0,0.1); border-radius: 8px; font-size: 12px; margin-bottom: 12px; }
.portal-link i { font-size: 15px; color: #3b6fd4; }
.pl-url { color: #185fa5; flex: 1; }

/* ---- Forms ---- */
.frow { margin-bottom: 15px; }
.frow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 15px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=url], select, textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 0.5px solid rgba(0,0,0,0.15); font-size: 13px; color: var(--text-primary); background: #fff; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #3b6fd4; box-shadow: 0 0 0 3px rgba(59,111,212,0.1); }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }

/* ---- Modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.42); display: flex; align-items: flex-start; justify-content: center; padding: 48px 20px; z-index: 100; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; }
.m-top { padding: 20px 24px 16px; border-bottom: 0.5px solid rgba(0,0,0,0.09); display: flex; align-items: center; justify-content: space-between; }
.m-title { font-size: 16px; font-weight: 600; }
.m-close { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 18px; padding: 4px; border-radius: 4px; line-height: 1; }
.m-close:hover { background: #f4f5f7; }
.m-body { padding: 20px 24px; }
.m-foot { padding: 14px 24px; border-top: 0.5px solid rgba(0,0,0,0.09); display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 18px; right: 18px; background: #1a2744; color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,0.18); }
.toast i { color: #6ee7b7; font-size: 15px; }
