/* =============================================================================
   Karukacherry Finance — Gold Pledge Backend
   Palette: deep charcoal + warm gold + ivory, evoking a jewellery/pawn brand
   ============================================================================= */

:root {
    --kf-gold:        #c9a227;
    --kf-gold-light:  #e8c766;
    --kf-gold-dark:   #9c7c14;
    --kf-charcoal:    #1b1a17;
    --kf-charcoal-2:  #26241f;
    --kf-ivory:       #faf6ec;
    --kf-cream:       #f3ecd8;
    --kf-text:        #2b2a26;
    --kf-muted:       #8a8577;
    --kf-danger:      #c0392b;
    --kf-success:     #2f7d4f;
    --kf-warning:     #b9770e;
    --kf-info:        #3f6b8a;
    --kf-sidebar-w:   250px;
    --kf-radius:      14px;
    --kf-shadow:      0 6px 24px rgba(27, 26, 23, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--kf-ivory);
    color: var(--kf-text);
    margin: 0;
}

a { text-decoration: none; }

/* ---------------------------- Login page ------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 10% 10%, rgba(201,162,39,0.18), transparent 60%),
        radial-gradient(1000px 500px at 90% 90%, rgba(201,162,39,0.12), transparent 60%),
        linear-gradient(160deg, var(--kf-charcoal) 0%, #100f0d 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--kf-ivory);
    border-radius: var(--kf-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    overflow: hidden;
}

.login-card__brand {
    background: linear-gradient(135deg, var(--kf-charcoal) 0%, #2a2721 100%);
    padding: 34px 32px 26px;
    text-align: center;
    border-bottom: 3px solid var(--kf-gold);
}

.login-card__brand .kf-emblem {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--kf-gold-light), var(--kf-gold-dark));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    font-size: 26px;
    box-shadow: 0 4px 14px rgba(201,162,39,0.5);
}

.login-card__brand h1 {
    color: var(--kf-ivory);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.3px;
}

.login-card__brand p {
    color: var(--kf-gold-light);
    font-size: 0.85rem;
    margin: 4px 0 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-card__body { padding: 30px 32px 34px; }

.form-label { font-weight: 600; font-size: 0.86rem; color: var(--kf-text); }

.form-control {
    border-radius: 10px;
    border: 1px solid #ddd5bd;
    padding: 10px 14px;
}

.form-control:focus {
    border-color: var(--kf-gold);
    box-shadow: 0 0 0 0.2rem rgba(201,162,39,0.2);
}

.btn-gold {
    background: linear-gradient(135deg, var(--kf-gold-light), var(--kf-gold-dark));
    border: none;
    color: #201a05;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 18px;
    transition: transform .12s ease, box-shadow .12s ease;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(201,162,39,0.35); color:#201a05; }
.btn-gold:disabled { opacity: .6; transform:none; box-shadow:none; }

.btn-outline-gold {
    border: 1.5px solid var(--kf-gold);
    color: var(--kf-gold-dark);
    background: transparent;
    border-radius: 10px;
    font-weight: 600;
}
.btn-outline-gold:hover { background: var(--kf-gold); color: #201a05; }

.demo-creds {
    margin-top: 20px;
    background: var(--kf-cream);
    border: 1px dashed #d8cba0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.78rem;
    color: var(--kf-muted);
}
.demo-creds b { color: var(--kf-text); }

.alert-kf {
    border-radius: 10px;
    font-size: 0.88rem;
    padding: 10px 14px;
}

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

.kf-sidebar {
    width: var(--kf-sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--kf-charcoal) 0%, #201e1a 100%);
    color: var(--kf-ivory);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .2s ease;
}

.kf-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.kf-sidebar__brand .kf-emblem {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--kf-gold-light), var(--kf-gold-dark));
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.kf-sidebar__brand .name { font-weight: 700; font-size: 0.98rem; line-height: 1.15; color: var(--kf-ivory); }
.kf-sidebar__brand .tag { font-size: 0.68rem; color: var(--kf-gold-light); text-transform: uppercase; letter-spacing: 0.6px; }

.kf-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.kf-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cfcabc;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
    transition: background .12s ease, color .12s ease;
}

.kf-nav a .ic { width: 20px; text-align: center; font-size: 1.05rem; }

.kf-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }

.kf-nav a.active {
    background: linear-gradient(135deg, rgba(201,162,39,0.9), rgba(156,124,20,0.9));
    color: #1c1707;
    font-weight: 700;
}

.kf-nav .section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #6f6a5c;
    letter-spacing: 1px;
    margin: 16px 14px 6px;
}

.kf-sidebar__footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.72rem;
    color: #7c7768;
}

.kf-main {
    margin-left: var(--kf-sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.kf-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: #fff;
    border-bottom: 1px solid #eee4c8;
    position: sticky;
    top: 0;
    z-index: 900;
}

.kf-topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--kf-text);
}

.kf-topbar .subtitle { font-size: 0.8rem; color: var(--kf-muted); margin-top: 2px; }

.kf-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--kf-cream);
    padding: 6px 14px 6px 8px;
    border-radius: 999px;
}

.kf-user-chip .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--kf-gold-light), var(--kf-gold-dark));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #201a05;
}

.kf-user-chip .meta { line-height: 1.1; }
.kf-user-chip .meta .n { font-weight: 700; font-size: 0.82rem; }
.kf-user-chip .meta .r { font-size: 0.7rem; color: var(--kf-muted); text-transform: uppercase; letter-spacing: .5px; }

.kf-content { padding: 24px 28px 48px; flex: 1; }

.mobile-toggle {
    display: none;
    background: var(--kf-charcoal);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
}

/* ------------------------------ Cards / KPIs ------------------------------ */
.kf-card {
    background: #fff;
    border-radius: var(--kf-radius);
    box-shadow: var(--kf-shadow);
    border: 1px solid #f1e9cd;
}

.kpi {
    padding: 18px 20px;
    border-radius: var(--kf-radius);
    background: #fff;
    box-shadow: var(--kf-shadow);
    border: 1px solid #f1e9cd;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.kpi::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--kf-gold-light), var(--kf-gold-dark));
}

.kpi .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--kf-muted); font-weight: 700; }
.kpi .value { font-size: 1.5rem; font-weight: 800; margin-top: 6px; color: var(--kf-text); }
.kpi .icon {
    position: absolute; right: 16px; top: 14px;
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--kf-cream);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.kpi .hint { font-size: 0.72rem; color: var(--kf-muted); margin-top: 4px; }
.kpi.danger .value { color: var(--kf-danger); }
.kpi.success .value { color: var(--kf-success); }

/* --------------------------------- Tables --------------------------------- */
.table-kf {
    background: #fff;
    border-radius: var(--kf-radius);
    overflow: hidden;
}
.table-kf thead th {
    background: var(--kf-charcoal);
    color: var(--kf-gold-light);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    border: none;
    white-space: nowrap;
    padding: 12px 14px;
}
.table-kf tbody td { padding: 11px 14px; vertical-align: middle; font-size: 0.87rem; border-color: #f1ead2; }
.table-kf tbody tr:hover { background: #fbf6e6; }

.badge-kf { font-size: 0.7rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; letter-spacing: .3px; }
.badge-current   { background: #e4f3e9; color: var(--kf-success); }
.badge-duesoon   { background: #fdf1dc; color: var(--kf-warning); }
.badge-overdue   { background: #fbe3e0; color: var(--kf-danger); }
.badge-closed    { background: #e7ecf1; color: var(--kf-info); }
.badge-auctioned { background: #eee; color: #555; }
.badge-active    { background: #e4f3e9; color: var(--kf-success); }
.badge-inactive  { background: #f0f0f0; color: #888; }

.section-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title .bar { width: 4px; height: 18px; background: var(--kf-gold); border-radius: 3px; display:inline-block; }

.perm-table th, .perm-table td { text-align: center; vertical-align: middle; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }

.form-check-input:checked { background-color: var(--kf-gold-dark); border-color: var(--kf-gold-dark); }

@media (max-width: 900px) {
    .kf-sidebar { transform: translateX(-100%); }
    .kf-sidebar.open { transform: translateX(0); }
    .kf-main { margin-left: 0; }
    .mobile-toggle { display: inline-flex; align-items:center; }
}
