/* =========================================================================
   Digital Education Technology Team Management System
   Theme: Light blue / white — clean, institutional, bilingual (Sinhala+English)
   ========================================================================= */

:root {
    --brand-900: #0b3d91;   /* deep institutional blue   */
    --brand-700: #1565c0;
    --brand-600: #1976d2;   /* primary                   */
    --brand-500: #2196f3;
    --brand-300: #90caf9;
    --brand-100: #e3f1fd;   /* light blue surfaces       */
    --brand-50:  #f3f8fe;

    --ink:       #14263b;   /* primary text              */
    --ink-muted: #5b6b7c;
    --line:      #e4ecf4;
    --bg:        #f5f9fe;
    --white:     #ffffff;

    --ok:   #1e8e5a;
    --warn: #c77700;
    --bad:  #c62828;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(20,38,59,.06), 0 8px 24px rgba(20,38,59,.06);
    --shadow-sm: 0 1px 3px rgba(20,38,59,.08);
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Noto Sans Sinhala', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

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

/* ---- Sidebar ---------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand-900), var(--brand-700));
    color: #dbe9fb;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar__brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar__brand .logo {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 700; letter-spacing: .2px;
}
.sidebar__brand .logo i { font-size: 26px; }
.sidebar__brand small { display:block; color:#aecbf3; font-weight:500; margin-top:2px; font-size:11.5px; }

.sidebar__nav { padding: 12px 12px 20px; overflow-y: auto; flex: 1; }
.sidebar__section { color:#8db5ec; font-size:11px; text-transform:uppercase; letter-spacing:.08em;
    padding: 14px 12px 6px; }
.nav-link-side {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: #cfe1f8; font-weight: 500; margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-link-side i { font-size: 18px; width: 22px; text-align:center; }
.nav-link-side:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-link-side.active { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); }

.sidebar__foot {
    padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12);
    font-size: 12px; color: #9fc1ee;
}

/* ---- Main ------------------------------------------------------------- */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-width: 0;
}
.topbar {
    height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 1020;
}
.topbar__toggle {
    display: none; background: none; border: none; color: var(--ink);
    font-size: 24px; cursor: pointer; padding: 4px 6px;
}
.topbar__title { font-weight: 700; font-size: 17px; }
.topbar__spacer { flex: 1; }
.topbar__user {
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--brand-100); color: var(--brand-700);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
}
.topbar__user .meta { line-height: 1.2; }
.topbar__user .meta b { font-size: 13.5px; }
.topbar__user .meta small { color: var(--ink-muted); font-size: 11.5px; }

.content { padding: 24px; max-width: 1200px; width: 100%; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0 0 2px; font-weight: 700; }
.page-head p { color: var(--ink-muted); margin: 0; font-size: 13.5px; }

/* ---- Cards ------------------------------------------------------------ */
.card-x {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-x .card-x__head {
    padding: 16px 20px; border-bottom: 1px solid var(--line);
    display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.card-x .card-x__head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.card-x .card-x__body { padding: 20px; }

/* ---- Stat cards ------------------------------------------------------- */
.stat-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-bottom: 20px;
}
.stat {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat::before {
    content:""; position:absolute; left:0; top:0; bottom:0; width:4px;
    background: var(--brand-500);
}
.stat .ic {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--brand-100); color: var(--brand-700);
    display:flex; align-items:center; justify-content:center; font-size:22px;
    margin-bottom: 12px;
}
.stat .num { font-size: 30px; font-weight: 800; line-height: 1; color: var(--ink); }
.stat .lbl { color: var(--ink-muted); font-size: 13px; margin-top: 4px; }
.stat.is-warn::before { background: var(--warn); }
.stat.is-warn .ic { background: #fff3e0; color: var(--warn); }
.stat.is-ok::before { background: var(--ok); }
.stat.is-ok .ic { background: #e6f4ec; color: var(--ok); }

/* ---- Tables ----------------------------------------------------------- */
.table-x { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-x th {
    text-align: left; padding: 12px 14px; color: var(--ink-muted);
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table-x td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-x tr:last-child td { border-bottom: none; }
.table-x tbody tr:hover { background: var(--brand-50); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Badges / chips --------------------------------------------------- */
.chip {
    display:inline-flex; align-items:center; gap:5px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--brand-100); color: var(--brand-700);
}
.chip.role-super_admin      { background:#ede7f6; color:#5e35b1; }
.chip.role-provincial_admin { background:#e3f1fd; color:#1565c0; }
.chip.role-zone_admin       { background:#e6f4ec; color:#1e8e5a; }
.chip.role-member           { background:#eceff3; color:#4a5b6c; }
.chip.ok  { background:#e6f4ec; color:var(--ok); }
.chip.bad { background:#fdecea; color:var(--bad); }
.chip.warn{ background:#fff3e0; color:var(--warn); }

/* ---- Buttons ---------------------------------------------------------- */
.btn-x {
    display:inline-flex; align-items:center; gap:8px; justify-content:center;
    padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
    font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s;
    background: var(--brand-600); color: #fff;
}
.btn-x:hover { background: var(--brand-700); color:#fff; }
.btn-x.ghost { background: var(--white); color: var(--brand-700); border-color: var(--brand-300); }
.btn-x.ghost:hover { background: var(--brand-50); }
.btn-x.soft { background: var(--brand-100); color: var(--brand-700); }
.btn-x.danger { background:#fdecea; color:var(--bad); }
.btn-x.danger:hover { background:#f9d9d6; }
.btn-x.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-x.block { width:100%; }

.btn-icon {
    width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
    background:#fff; color: var(--ink-muted); display:inline-flex;
    align-items:center; justify-content:center; cursor:pointer; font-size:16px;
}
.btn-icon:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-300); }
.btn-icon.danger:hover { background:#fdecea; color:var(--bad); border-color:#f4bdb8; }

/* ---- Forms ------------------------------------------------------------ */
.form-grid { display:grid; gap:16px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.field label { display:block; font-weight:600; font-size:13px; margin-bottom:6px; color:var(--ink); }
.field .hint { color: var(--ink-muted); font-size:12px; margin-top:5px; }
.input, .select, .textarea {
    width:100%; padding: 11px 13px; border:1px solid var(--line); border-radius:10px;
    font: inherit; color: var(--ink); background:#fff; transition:.15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline:none; border-color: var(--brand-500); box-shadow:0 0 0 3px var(--brand-100);
}
.form-actions { display:flex; gap:10px; margin-top:22px; flex-wrap:wrap; }

/* ---- Alerts / flash --------------------------------------------------- */
.alert {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size:14px;
    display:flex; align-items:flex-start; gap:10px; border:1px solid;
}
.alert i { font-size:18px; margin-top:1px; }
.alert.success { background:#e6f4ec; border-color:#bfe3cd; color:#11633e; }
.alert.error   { background:#fdecea; border-color:#f4bdb8; color:#a02019; }
.alert.info    { background:var(--brand-100); border-color:#bcdcfa; color:#0d4a8a; }

/* ---- Auth screen ------------------------------------------------------ */
.auth-wrap {
    min-height:100vh; display:flex; align-items:center; justify-content:center;
    padding: 24px;
    background:
        radial-gradient(1200px 500px at 80% -10%, #cfe3fb 0%, transparent 60%),
        radial-gradient(900px 500px at -10% 110%, #d7eafc 0%, transparent 55%),
        var(--bg);
}
.auth-card {
    width:100%; max-width: 410px; background:#fff; border-radius: 18px;
    box-shadow: 0 20px 60px rgba(11,61,145,.12); overflow:hidden;
    border:1px solid var(--line);
}
.auth-card__head {
    background: linear-gradient(180deg, var(--brand-700), var(--brand-600));
    color:#fff; padding: 28px 28px 24px; text-align:center;
}
.auth-card__head .badge-ic {
    width:56px; height:56px; border-radius:16px; background:rgba(255,255,255,.18);
    display:flex; align-items:center; justify-content:center; margin:0 auto 12px; font-size:28px;
}
.auth-card__head h1 { font-size:18px; margin:0; font-weight:700; }
.auth-card__head p { margin:4px 0 0; font-size:12.5px; color:#d6e6fb; }
.auth-card__body { padding: 26px 28px 30px; }

/* ---- Credentials box -------------------------------------------------- */
.cred {
    background: var(--brand-50); border:1px dashed var(--brand-300);
    border-radius: 12px; padding: 18px 20px; margin: 16px 0;
}
.cred .row-c { display:flex; justify-content:space-between; gap:12px; padding:8px 0; }
.cred .row-c + .row-c { border-top:1px dashed var(--brand-300); }
.cred .row-c .k { color: var(--ink-muted); font-size:13px; }
.cred .row-c .v { font-weight:700; font-family: 'Inter', monospace; letter-spacing:.4px; }

/* ---- Utility ---------------------------------------------------------- */
.muted { color: var(--ink-muted); }
.text-center { text-align:center; }
.mt-0{margin-top:0}.mb-0{margin-bottom:0}.mt-2{margin-top:14px}.mb-2{margin-bottom:14px}
.empty { text-align:center; color:var(--ink-muted); padding: 36px 16px; }
.empty i { font-size:40px; color: var(--brand-300); display:block; margin-bottom:10px; }
.soon {
    border:1px dashed var(--brand-300); border-radius:var(--radius); padding:18px;
    background: var(--brand-50); color: var(--ink-muted); text-align:center; font-size:13.5px;
}
.soon i { color: var(--brand-500); }

.sidebar-backdrop {
    display:none; position:fixed; inset:0; background:rgba(11,30,55,.45); z-index:1030;
}

/* ---- Responsive (tablet & mobile) ------------------------------------- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar__toggle { display: inline-flex; }
    .sidebar-backdrop.show { display:block; }
}
@media (max-width: 640px) {
    .content { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 19px; }
    .topbar__user .meta { display:none; }
    .stat .num { font-size: 26px; }
}
