/* ============================================================
   HDUDA Challan Portal — style.css
   Palette: White / Government Blue / Light Gray / Green / Red
   ============================================================ */
:root{
  --blue:#0b4a8b;        /* government blue */
  --blue-d:#08305c;      /* navy */
  --blue-l:#1565c0;
  --blue-soft:#e8f0fb;
  --ink:#1c2733;
  --muted:#64748b;
  --line:#e3e8ef;
  --bg:#f4f6f9;          /* light gray */
  --card:#ffffff;
  --green:#157a47;
  --green-soft:#e6f4ec;
  --red:#c0392b;
  --red-soft:#fce8e6;
  --amber:#b7791f;
  --amber-soft:#fdf3e2;
  --saffron:#e07b00;
  --radius:12px;
  --shadow:0 1px 2px rgba(16,40,80,.06), 0 4px 16px rgba(16,40,80,.06);
  --shadow-lg:0 12px 40px rgba(11,74,139,.16);
  --font:'Inter','Segoe UI',system-ui,-apple-system,sans-serif;
  --kn:'Noto Sans Kannada','Inter',sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{font-family:var(--font);background:var(--bg);color:var(--ink);line-height:1.5;font-size:14px}
:lang(kn),.kn{font-family:var(--kn)}
a{text-decoration:none;color:inherit}
button{font-family:inherit;cursor:pointer}
img{max-width:100%}
::selection{background:var(--blue-soft)}

/* ---------------- App shell ---------------- */
#app-shell{display:flex;min-height:100vh}
#page{flex:1;min-width:0;display:flex;flex-direction:column}
.page-body{padding:24px 28px 48px;flex:1}

/* ---------------- Sidebar ---------------- */
.sidebar{
  width:260px;flex-shrink:0;background:linear-gradient(180deg,var(--blue-d),var(--blue));
  color:#dbe6f5;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;
}
.brand{display:flex;align-items:center;gap:12px;padding:20px 18px;border-bottom:1px solid rgba(255,255,255,.12)}
.brand img{width:42px;height:42px;border-radius:8px;background:#fff;padding:3px;object-fit:contain}
.brand-txt strong{display:block;font-size:17px;letter-spacing:.5px;color:#fff}
.brand-txt small{font-size:11px;color:#9db8dc;letter-spacing:.6px;text-transform:uppercase}
.nav{flex:1;overflow-y:auto;padding:14px 12px;display:flex;flex-direction:column;gap:3px}
.nav-item{
  display:flex;align-items:center;gap:12px;width:100%;background:none;border:0;color:#cdddf2;
  padding:11px 14px;border-radius:9px;font-size:13.5px;font-weight:500;text-align:left;transition:.15s;
}
.nav-item:hover{background:rgba(255,255,255,.09);color:#fff}
.nav-item.active{background:#fff;color:var(--blue-d);font-weight:600;box-shadow:0 4px 12px rgba(0,0,0,.15)}
.nav-ic{width:19px;height:19px;flex-shrink:0;display:grid;place-items:center}
.nav-ic svg{width:19px;height:19px}
.nav-group .caret{margin-left:auto;width:15px;height:15px;opacity:.6;transition:.2s}
.nav-group .caret svg{width:15px;height:15px}
.nav-toggle .caret{transform:rotate(0)}
.nav-group.open .caret{transform:rotate(90deg)}
.nav-subwrap{max-height:0;overflow:hidden;transition:max-height .25s ease;padding-left:14px}
.nav-group.open .nav-subwrap{max-height:300px}
.nav-sub{display:block;padding:9px 14px;margin:2px 0;font-size:12.5px;color:#bcd2ee;border-radius:8px;border-left:2px solid rgba(255,255,255,.18)}
.nav-sub:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-sub.active{background:rgba(255,255,255,.16);color:#fff;font-weight:600;border-left-color:var(--saffron)}
.logout-btn{margin:8px 12px 4px;color:#ffd0c8}
.logout-btn:hover{background:rgba(255,80,60,.2);color:#fff}
.dev-credit{padding:12px 18px;font-size:10.5px;color:#7e9dc8;letter-spacing:1px;text-transform:uppercase;border-top:1px solid rgba(255,255,255,.1)}

/* ---------------- Topbar ---------------- */
.topbar{
  position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:16px;
  background:#fff;padding:13px 26px;border-bottom:1px solid var(--line);
}
.hamburger{display:none;background:none;border:0;color:var(--blue);width:34px;height:34px}
.hamburger svg{width:24px;height:24px}
.tb-title h1{font-size:19px;font-weight:700;color:var(--ink)}
.tb-title p{font-size:11px;color:var(--muted);letter-spacing:.4px}
.tb-right{margin-left:auto;display:flex;align-items:center;gap:18px}
.tb-bell{color:var(--muted);width:22px;height:22px;cursor:pointer}
.tb-bell svg{width:22px;height:22px}
.tb-user{display:flex;align-items:center;gap:11px}
.avatar{width:40px;height:40px;border-radius:50%;background:linear-gradient(135deg,var(--blue),var(--blue-l));color:#fff;display:grid;place-items:center;font-weight:700;font-size:16px}
.tb-user-txt strong{font-size:13.5px;display:flex;align-items:center;gap:7px}
.tb-user-txt small{font-size:11px;color:var(--muted);font-family:var(--kn)}
.ro-badge{background:var(--amber-soft);color:var(--amber);font-size:9.5px;padding:2px 7px;border-radius:20px;font-weight:700;letter-spacing:.4px}

/* ---------------- Cards / sections ---------------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.section-head{display:flex;align-items:center;justify-content:space-between;margin:26px 0 14px;gap:14px;flex-wrap:wrap}
.section-head h2{font-size:16px;font-weight:700;color:var(--ink)}
.section-head .sub{font-size:12px;color:var(--muted)}

/* KPI grid */
.kpi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:16px}
.kpi{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.kpi::before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--blue)}
.kpi.k-green::before{background:var(--green)} .kpi.k-amber::before{background:var(--amber)} .kpi.k-red::before{background:var(--red)} .kpi.k-blue::before{background:var(--blue-l)}
.kpi .k-label{font-size:12px;color:var(--muted);font-weight:500;margin-bottom:8px}
.kpi .k-value{font-size:26px;font-weight:800;letter-spacing:-.5px;color:var(--ink)}
.kpi .k-foot{font-size:11px;color:var(--muted);margin-top:6px}
.kpi .k-ic{position:absolute;right:14px;top:14px;width:34px;height:34px;border-radius:9px;background:var(--blue-soft);color:var(--blue);display:grid;place-items:center}
.kpi .k-ic svg{width:18px;height:18px}

/* Charts */
.chart-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:18px}
.chart-card{padding:18px 18px 8px}
.chart-card h3{font-size:14px;font-weight:700;margin-bottom:4px}
.chart-card p{font-size:11.5px;color:var(--muted);margin-bottom:12px}
.chart-wrap{position:relative;height:260px}

/* Tables */
.table-wrap{overflow-x:auto;border-radius:var(--radius)}
table.data{width:100%;border-collapse:collapse;background:#fff;font-size:13px}
table.data th{background:#f1f5fb;color:#46566b;text-align:left;padding:12px 14px;font-weight:600;font-size:11.5px;letter-spacing:.4px;text-transform:uppercase;border-bottom:1px solid var(--line);white-space:nowrap}
table.data td{padding:12px 14px;border-bottom:1px solid var(--line);vertical-align:middle}
table.data tbody tr:hover{background:#f8fafd}
table.data tbody tr:last-child td{border-bottom:0}
.mono{font-variant-numeric:tabular-nums;font-weight:600}

/* Badges */
.badge{display:inline-flex;align-items:center;gap:6px;padding:4px 11px;border-radius:30px;font-size:11.5px;font-weight:600}
.badge::before{content:"";width:7px;height:7px;border-radius:50%}
.b-paid{background:var(--green-soft);color:var(--green)} .b-paid::before{background:var(--green)}
.b-pending{background:var(--amber-soft);color:var(--amber)} .b-pending::before{background:var(--amber)}
.b-rejected{background:var(--red-soft);color:var(--red)} .b-rejected::before{background:var(--red)}
.b-cancelled{background:#eef0f3;color:#64748b} .b-cancelled::before{background:#94a3b8}
.chip{display:inline-block;padding:3px 9px;border-radius:6px;background:var(--blue-soft);color:var(--blue);font-size:11px;font-weight:600}

/* Buttons */
.btn{display:inline-flex;align-items:center;gap:8px;padding:10px 18px;border-radius:9px;border:1px solid transparent;font-size:13px;font-weight:600;transition:.15s}
.btn svg{width:16px;height:16px}
.btn-primary{background:var(--blue);color:#fff}
.btn-primary:hover{background:var(--blue-d)}
.btn-ghost{background:#fff;border-color:var(--line);color:var(--ink)}
.btn-ghost:hover{border-color:var(--blue);color:var(--blue)}
.btn-green{background:var(--green);color:#fff}.btn-green:hover{filter:brightness(.93)}
.btn-red{background:#fff;border-color:#f0c4bd;color:var(--red)}.btn-red:hover{background:var(--red-soft)}
.btn-sm{padding:7px 12px;font-size:12px}
.btn[disabled]{opacity:.5;cursor:not-allowed}

/* Forms */
.field label{display:block;font-size:12px;font-weight:600;color:#445268;margin-bottom:6px}
.field input,.field select,.field textarea{
  width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:9px;font-size:13px;font-family:inherit;background:#fff;transition:.15s;color:var(--ink)
}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-soft)}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}

/* Toolbar / search */
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.search-box{position:relative;flex:1;min-width:220px}
.search-box input{width:100%;padding:10px 12px 10px 38px;border:1px solid var(--line);border-radius:9px;font-size:13px}
.search-box svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--muted)}
.filter-select{padding:10px 12px;border:1px solid var(--line);border-radius:9px;font-size:13px;background:#fff;color:var(--ink)}

/* Modal */
.modal-overlay{position:fixed;inset:0;background:rgba(15,30,55,.55);backdrop-filter:blur(2px);display:none;align-items:center;justify-content:center;z-index:100;padding:20px}
.modal-overlay.show{display:flex}
.modal{background:#fff;border-radius:16px;width:100%;max-width:520px;box-shadow:var(--shadow-lg);max-height:92vh;overflow:auto}
.modal-head{padding:20px 22px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:flex-start}
.modal-head h3{font-size:16px}
.modal-head p{font-size:12px;color:var(--muted);margin-top:3px}
.modal-x{background:none;border:0;font-size:24px;color:var(--muted);line-height:1}
.modal-body{padding:22px}
.modal-foot{padding:16px 22px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:10px;background:#fafbfc;border-radius:0 0 16px 16px}

/* misc */
.empty{text-align:center;padding:50px 20px;color:var(--muted)}
.empty svg{width:46px;height:46px;opacity:.4;margin-bottom:10px}
.notice{display:flex;gap:10px;align-items:center;background:var(--blue-soft);border:1px solid #cfe0f7;color:var(--blue-d);padding:12px 16px;border-radius:10px;font-size:12.5px;margin-bottom:16px}
.notice>svg{width:20px;height:20px;flex-shrink:0}
.section-head svg{width:16px;height:16px}
.hidden{display:none!important}

/* ---------------- Login ---------------- */
.login-wrap{display:flex;min-height:100vh;position:relative}
/* full-width government tricolor header band across the whole page top */
.tricolor{position:fixed;top:0;left:0;right:0;height:6px;z-index:50;
  background:linear-gradient(90deg,#ff9933 0 33.33%,#ffffff 33.33% 66.66%,#138808 66.66% 100%)}

.login-left{flex:1.08;background:linear-gradient(155deg,var(--blue-d) 0%,var(--blue) 55%,var(--blue-l) 100%);
  color:#fff;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:72px 64px 56px;overflow:hidden}
.login-left::after{content:"";position:absolute;right:-140px;bottom:-140px;width:400px;height:400px;border-radius:50%;background:rgba(255,255,255,.05)}
.login-left::before{content:"";position:absolute;left:-110px;top:-90px;width:280px;height:280px;border-radius:50%;background:rgba(255,255,255,.045)}
.login-left>*{position:relative;z-index:2}

/* big centered emblem */
.login-emblem{width:128px;height:128px;background:#fff;border-radius:24px;padding:12px;object-fit:contain;
  box-shadow:0 16px 40px rgba(0,0,0,.28);margin-bottom:22px}
.login-org{font-family:var(--kn);font-size:21px;font-weight:700;line-height:1.4;max-width:460px}
.login-eyebrow{font-size:11.5px;color:#bcd4f3;letter-spacing:2.5px;text-transform:uppercase;margin-top:8px;font-weight:600}
.login-divider{width:64px;height:3px;border-radius:3px;background:linear-gradient(90deg,#ff9933,#fff,#138808);margin:28px 0}
.login-left h1{font-size:34px;font-weight:800;line-height:1.18;letter-spacing:-.6px}
.login-left .lead{font-size:14.5px;color:#cfe0f7;margin-top:16px;max-width:430px;line-height:1.6}

/* feature list inside a soft glass card */
.login-feats{margin-top:34px;display:flex;flex-direction:column;gap:6px;text-align:left;
  background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);border-radius:16px;padding:18px 20px}
.login-feat{display:flex;gap:13px;align-items:center;font-size:13.5px;color:#eaf2fd;padding:7px 0}
.login-feat+.login-feat{border-top:1px solid rgba(255,255,255,.1)}
.login-feat .lf-ic{width:36px;height:36px;border-radius:10px;background:rgba(255,255,255,.14);display:grid;place-items:center;flex-shrink:0}
.login-feat .lf-ic svg{width:18px;height:18px}
.gov-tag{position:absolute;bottom:26px;left:0;right:0;text-align:center;font-size:11px;color:#9db8dc;letter-spacing:1.5px;z-index:2}

.login-right{flex:1;display:flex;flex-direction:column;justify-content:center;
  padding:56px 60px;max-width:580px;background:#fff;margin:0 auto}
.login-right h3{font-size:25px;font-weight:800;letter-spacing:-.3px}
.login-right .sub{color:var(--muted);font-size:13.5px;margin-top:5px;margin-bottom:24px}
.role-label{font-size:11.5px;font-weight:700;color:#445268;letter-spacing:.6px;text-transform:uppercase;margin-bottom:12px}
.role-cards{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:26px}
.role-card{border:1.5px solid var(--line);border-radius:13px;padding:14px 15px;cursor:pointer;transition:.16s;
  display:flex;gap:13px;align-items:center;background:#fff;min-height:70px}
.role-card:hover{border-color:var(--blue-l);box-shadow:var(--shadow);transform:translateY(-1px)}
.role-card.sel{border-color:var(--blue);background:var(--blue-soft);box-shadow:0 0 0 3px var(--blue-soft)}
.role-card .rc-ic{width:40px;height:40px;border-radius:11px;background:var(--blue-soft);color:var(--blue);display:grid;place-items:center;flex-shrink:0;transition:.16s}
.role-card.sel .rc-ic{background:var(--blue);color:#fff}
.role-card .rc-ic svg{width:21px;height:21px}
.role-card .rc-txt{min-width:0}
.role-card strong{font-size:13px;display:block;line-height:1.25}
.role-card small{font-size:10.5px;color:var(--muted);font-family:var(--kn);display:block;margin-top:2px}
.role-card.span-2{grid-column:1 / -1}
.login-form .field{margin-bottom:15px}
.login-btn{width:100%;justify-content:center;padding:14px;font-size:14.5px;margin-top:8px;border-radius:11px}
.login-msg{font-size:13px;margin-top:12px;text-align:center;min-height:18px}
.login-msg.err{color:var(--red)} .login-msg.ok{color:var(--green)}
.cred-hint{margin-top:20px;font-size:11.5px;color:var(--muted);background:#f7f9fc;border:1px dashed var(--line);border-radius:11px;padding:13px 15px;line-height:1.7}
.cred-hint code{background:#fff;border:1px solid var(--line);padding:1px 6px;border-radius:5px;font-size:11px}
/*.dev-foot{margin-top:28px;padding-top:20px;border-top:1px solid var(--line);display:flex;align-items:center;gap:9px;font-size:11.5px;color:var(--muted)}
.dev-foot img{height:28px;width:28px;border-radius:6px;object-fit:contain;background:#f4f6f9;padding:2px}*/
.dev-foot{
    margin-top:28px;
    padding-top:20px;
    border-top:1px solid var(--line);
    display:flex;
    align-items:center;
    justify-content:center;
    gap:12px;
    font-size:13px;
    color:var(--muted);
    font-weight:500;
}
.dev-foot img{
    width:130px;
    height:auto;
    object-fit:contain;
    background:transparent;
    padding:0;
    border-radius:0;
}

/* ---------------- Responsive ---------------- */
@media(max-width:1024px){
  .sidebar{position:fixed;left:0;top:0;z-index:60;transform:translateX(-100%);transition:.25s;box-shadow:var(--shadow-lg)}
  .sidebar.show{transform:translateX(0)}
  .hamburger{display:grid;place-items:center}
}
@media(max-width:860px){
  .login-left{display:none}
  .login-right{max-width:100%;padding:36px 24px}
  .role-cards{grid-template-columns:1fr}
  .grid-2,.grid-3,.grid-4{grid-template-columns:1fr}
}
@media(max-width:560px){
  .page-body{padding:16px}
  .tb-user-txt{display:none}
  .tb-title h1{font-size:16px}
}

/* ============================================================
   Village Searchable + Creatable Dropdown — HDUDA theme
   ============================================================ */

/* wrapper */
.vd-wrap { position: relative; width: 100%; }

/* input row: icon + text input + badge + clear + arrow */
.vd-input-row {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
  min-height: 42px;
}
.vd-wrap.vd-open .vd-input-row,
.vd-input-row:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.vd-input-icon {
  width: 15px; height: 15px; flex-shrink: 0;
  color: var(--muted); pointer-events: none;
}
.vd-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--ink); padding: 10px 0;
  font-family: var(--font);
}
.vd-input::placeholder { color: #94a3b8; }

/* "New" badge shown after creating a custom village */
.vd-badge {
  display: none; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 20px;
  background: var(--green-soft); color: var(--green);
  border: 1px solid #b2dfca; white-space: nowrap; flex-shrink: 0;
}

/* clear ✕ button */
.vd-clear {
  display: none; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: #cbd5e1; color: #fff;
  font-size: 10px; font-weight: 800; cursor: pointer;
  flex-shrink: 0; transition: background .15s; line-height: 1;
}
.vd-clear:hover { background: var(--red); }

/* chevron arrow */
.vd-arrow {
  display: flex; align-items: center; color: var(--muted); flex-shrink: 0;
  transition: transform .2s;
}
.vd-arrow svg { width: 16px; height: 16px; }
.vd-wrap.vd-open .vd-arrow { transform: rotate(180deg); }

/* dropdown panel */
.vd-panel {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 999;
  background: #fff;
  border: 1px solid var(--blue); border-top: none;
  border-bottom-left-radius: 9px; border-bottom-right-radius: 9px;
  box-shadow: 0 8px 28px rgba(11,74,139,.14);
  overflow: hidden;
}
.vd-panel.open { display: block; }

/* scrollable list */
.vd-list {
  max-height: 220px; overflow-y: auto;
  padding: 4px 0;
}
.vd-list::-webkit-scrollbar { width: 4px; }
.vd-list::-webkit-scrollbar-track { background: #f1f5fb; }
.vd-list::-webkit-scrollbar-thumb { background: #c0d0ea; border-radius: 4px; }

/* existing option row */
.vd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; font-size: 13px; color: var(--ink); cursor: pointer;
  transition: background .1s; border-left: 3px solid transparent;
}
.vd-item:hover, .vd-item.cursor {
  background: var(--blue-soft); color: var(--blue);
  border-left-color: var(--blue);
}
.vd-item.selected {
  background: var(--blue-soft); color: var(--blue);
  border-left-color: var(--blue); font-weight: 600;
}
.vd-item-icon {
  width: 13px; height: 13px; flex-shrink: 0;
  color: var(--muted);
}
.vd-item:hover .vd-item-icon,
.vd-item.cursor .vd-item-icon,
.vd-item.selected .vd-item-icon { color: var(--blue); }
.vd-item span { flex: 1; }
.vd-item mark {
  background: #fef08a; color: var(--ink);
  border-radius: 2px; padding: 0 1px;
}
.vd-check {
  width: 14px; height: 14px; flex-shrink: 0; color: var(--blue);
}

/* ＋ Add new village row */
.vd-create {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; font-size: 13px; cursor: pointer;
  color: var(--green); background: var(--green-soft);
  border-top: 1px solid #c8e6d0;
  font-weight: 500; transition: background .12s;
}
.vd-create:hover, .vd-create.cursor {
  background: #d4edda;
}
.vd-create svg {
  width: 15px; height: 15px; flex-shrink: 0;
  stroke: var(--green);
}
.vd-create strong { font-weight: 700; }

/* empty / no-match state */
.vd-empty {
  padding: 16px 14px; color: var(--muted);
  font-size: 13px; text-align: center;
}