/* =====================================================================
   KMC IGR PLATFORM - DESIGN SYSTEM
   Palette drawn from the Kano Municipal Council seal:
   maroon ring, deep green shield, gold charge, cream field.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
    --maroon:        #7A2530;
    --maroon-dark:   #5C1B24;
    --green:         #1E3A2E;
    --green-dark:    #142A21;
    --gold:          #D4A73A;
    --gold-light:    #F1D588;
    --cream:         #F7F3EA;
    --cream-deep:    #EFE8D8;
    --ink:           #2B2420;
    --ink-soft:      #6B5F55;
    --line:          #E3DAC9;
    --white:         #FFFFFF;
    --danger:        #B23A2E;
    --success:       #2E6B4F;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Work Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 10px;
    --shadow: 0 2px 10px rgba(43, 36, 32, 0.06);
    --shadow-lift: 0 10px 30px rgba(43, 36, 32, 0.12);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 6px; color: var(--green-dark); }
a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---------- Seal motif (dotted ring, echoes the logo border) ---------- */
.seal-ring {
    position: relative;
    border: 2px solid var(--maroon);
    border-radius: 50%;
}
.seal-ring::before {
    content: '';
    position: absolute; inset: 5px;
    border-radius: 50%;
    border: 1px dashed var(--gold);
    opacity: 0.7;
}

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

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--green-dark), var(--green) 70%);
    color: var(--cream);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 6px 20px;
    border-bottom: 1px solid rgba(247,243,234,0.15);
    margin-bottom: 18px;
}
.sidebar .brand img { width: 42px; height: 42px; border-radius: 50%; }
.sidebar .brand .name { font-family: var(--font-display); font-size: 15px; line-height: 1.2; color: var(--white); }
.sidebar .brand .name small { display:block; font-family: var(--font-body); font-size: 11px; color: var(--gold-light); letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar nav { flex: 1; }
.sidebar .section-label {
    font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
    color: rgba(247,243,234,0.45); margin: 18px 10px 8px;
}
.sidebar a.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 2px;
    border-radius: 8px; color: rgba(247,243,234,0.85);
    font-size: 14px; font-weight: 500;
}
.sidebar a.nav-link:hover { background: rgba(247,243,234,0.08); text-decoration: none; }
.sidebar a.nav-link.active { background: var(--gold); color: var(--green-dark); font-weight: 600; }
.sidebar .logout { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(247,243,234,0.15); }
.sidebar .logout a { color: var(--gold-light); font-size: 13px; }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: var(--white); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .user-pill { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.topbar .user-pill .avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--gold);
    display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--green-dark);
}
.content { padding: 26px 28px 50px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px;
    border-radius: 50%; border: 10px solid var(--cream-deep); opacity: 0.6;
}
.stat-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-bottom: 6px; }
.stat-card .value { font-family: var(--font-display); font-size: 28px; color: var(--maroon); font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--success); margin-top: 4px; }

/* ---------- Cards / panels ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel .panel-head h2 { font-size: 16px; margin: 0; }
.panel .panel-body { padding: 20px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: var(--font-body);
}
.btn-primary { background: var(--maroon); color: var(--white); }
.btn-primary:hover { background: var(--maroon-dark); text-decoration: none; }
.btn-gold { background: var(--gold); color: var(--green-dark); }
.btn-gold:hover { background: var(--gold-light); text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--maroon); color: var(--maroon); text-decoration: none; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input, select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-family: var(--font-body); font-size: 14px; background: var(--white); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); padding: 10px 14px; border-bottom: 2px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
tr:hover td { background: var(--cream); }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-active { background: #E4F0E9; color: var(--success); }
.badge-suspended { background: #FBEAE3; color: var(--danger); }
.badge-disengaged { background: #EFEAE3; color: var(--ink-soft); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type=text] { max-width: 260px; }
.toolbar select { max-width: 190px; }
.spacer { flex: 1; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500; }
.alert-success { background: #E4F0E9; color: var(--success); border: 1px solid #bcdccb; }
.alert-error { background: #FBEAE3; color: var(--danger); border: 1px solid #efc2b3; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 20%, var(--green) 0%, var(--green-dark) 60%);
    padding: 20px;
}
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 14px; box-shadow: var(--shadow-lift); overflow: hidden; }
.login-card .top { background: var(--maroon); padding: 28px 30px 22px; text-align: center; color: var(--white); }
.login-card .top img { width: 64px; height: 64px; border-radius: 50%; margin-bottom: 10px; border: 3px solid var(--gold); }
.login-card .top h1 { color: var(--white); font-size: 17px; margin: 0; }
.login-card .top p { margin: 4px 0 0; font-size: 12px; color: var(--gold-light); letter-spacing: 0.05em; text-transform: uppercase; }
.login-card .body { padding: 26px 30px 30px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }

/* ---------- ID Card ---------- */
.id-card-wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.id-card {
    width: 340px; border-radius: 14px; overflow: hidden;
    background: var(--cream); border: 1px solid var(--line); box-shadow: var(--shadow-lift);
    font-family: var(--font-body);
}
.id-card .head {
    background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
    color: var(--white); padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.id-card .head img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gold); }
.id-card .head .t1 { font-family: var(--font-display); font-size: 13px; line-height: 1.2; }
.id-card .head .t2 { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-light); }
.id-card .photo-row { display: flex; gap: 14px; padding: 16px; }
.id-card .photo-row img.photo { width: 84px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--white); }
.id-card .photo-row .meta h3 { font-size: 15px; margin: 0 0 4px; }
.id-card .photo-row .meta div { font-size: 11.5px; color: var(--ink-soft); margin-bottom: 2px; }
.id-card .code-strip {
    background: var(--green-dark); color: var(--gold-light); text-align: center;
    padding: 7px; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.05em;
}
.id-card .qr-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px dashed var(--line); }
.id-card .qr-row .qr canvas { display: block; }
.id-card .qr-row .valid { font-size: 10.5px; color: var(--ink-soft); text-align: right; line-height: 1.5; }
.id-card .foot { background: var(--gold); color: var(--green-dark); font-size: 10px; text-align: center; padding: 6px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

@media print {
    .no-print { display: none !important; }
    body { background: var(--white); }
    .id-card { box-shadow: none; border: 1px solid #999; }
}

@media (max-width: 860px) {
    .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 40; transition: left .2s; }
    .sidebar.open { left: 0; }
    .field-row { grid-template-columns: 1fr; }
}
