/* MillSaathi app/dashboard styles — extracted from the approved Claude Design handoff. */
* { box-sizing: border-box; }
:root {
  --ink: #1B2431; --muted: #667085; --muted2: #475467; --bg: #F4F6F8; --border: #E4E7EC;
  --line: #F0F1F3; --gold: #E8B93B; --gold-dark: #BE8A16; --green: #2E7D46; --red: #C0451C;
  --red-ink: #8F2E12; --side: #1B2431; --side-line: #2A3543; --side-mut: #7D8A9A;
}
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
::selection { background: #1B2431; color: #fff; }
.ms-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.ms-scroll::-webkit-scrollbar-thumb { background: #D0D5DD; border-radius: 6px; }
@keyframes ms-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
input::placeholder { color: #98A2B3; }
.arch { font-family: 'Archivo', sans-serif; }

.shell { display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.side { width: 256px; flex-shrink: 0; background: var(--side); color: #C7CFDA; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-logo { padding: 20px 20px 16px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--side-line); }
.side-logo .mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: var(--gold); border-radius: 7px; }
.side-logo .name { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 18px; color: #fff; letter-spacing: -.02em; line-height: 1; }
.side-logo .mill { font-size: 11px; color: var(--side-mut); font-weight: 600; margin-top: 3px; }
.role-wrap { padding: 16px 16px 10px; }
.role-label { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #6B7889; margin-bottom: 9px; }
.role-tabs { display: flex; background: #141C27; border-radius: 9px; padding: 4px; gap: 3px; }
.role-tabs button { flex: 1; padding: 8px 6px; border-radius: 7px; font-family: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer; border: none; background: transparent; color: var(--side-mut); }
.role-tabs button.on { background: var(--gold); color: var(--side); }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 8px; color: #98A2B3; font-weight: 600; font-size: 14.5px; font-family: inherit; cursor: pointer; background: transparent; border: none; border-left: 3px solid transparent; width: 100%; text-align: left; }
.nav button.on { color: #fff; background: rgba(255,255,255,.07); border-left-color: var(--gold); }
.nav .sep { height: 1px; background: var(--side-line); margin: 8px 6px; }
.side-user { padding: 14px 16px; border-top: 1px solid var(--side-line); display: flex; align-items: center; gap: 10px; }
.side-user .av { width: 34px; height: 34px; border-radius: 50%; background: var(--side-line); display: flex; align-items: center; justify-content: center; color: var(--gold); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.side-user .nm { font-size: 13.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .ds { font-size: 11.5px; color: var(--side-mut); font-weight: 500; }
.side-user .out { margin-left: auto; background: none; border: none; color: var(--side-mut); cursor: pointer; font-size: 11.5px; font-weight: 700; font-family: inherit; }
.side-user .out:hover { color: #fff; }

/* ---- main ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 14px clamp(18px,3vw,32px); display: flex; align-items: center; gap: 18px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: clamp(20px,2.4vw,26px); letter-spacing: -.02em; margin: 0; line-height: 1.1; }
.topbar .sub { font-size: 13.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.topbar .grow { flex: 1; min-width: 0; }
.search { display: flex; align-items: center; gap: 9px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 9px 13px; width: clamp(160px,22vw,280px); }
.search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 14.5px; font-weight: 500; color: var(--ink); width: 100%; }
.date-chip { text-align: right; }
.date-chip .d { font-size: 13px; font-weight: 700; }
.date-chip .s { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.content { flex: 1; overflow-y: auto; padding: clamp(18px,3vw,30px); }
.page { max-width: 1240px; }

/* ---- cards / grids ---- */
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.pad { padding: 20px 22px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.kpi .l { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .v { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 30px; letter-spacing: -.02em; margin: 8px 0 4px; }
.kpi .s { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-top: 14px; }
.grid2r { display: grid; grid-template-columns: 1fr 1.5fr; gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .grid2, .grid2r { grid-template-columns: 1fr; } .side { display: none; } }
.card-h { font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 17px; }
.card-top { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hint { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---- tables ---- */
.twrap { overflow-x: auto; }
table.ms { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.ms thead tr { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; background: #FAFBFC; }
table.ms th { padding: 11px 14px; font-weight: 700; white-space: nowrap; }
table.ms td { padding: 13px 14px; font-weight: 500; border-top: 1px solid var(--line); }
table.ms th:first-child, table.ms td:first-child { padding-left: 22px; }
table.ms th:last-child, table.ms td:last-child { padding-right: 22px; }
.tok { font-weight: 700; font-family: 'Archivo', sans-serif; }
.b6 { font-weight: 600; } .b7 { font-weight: 700; } .mut { color: var(--muted2); }

.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 6px; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---- mass balance / bars ---- */
.mb-bar { display: flex; height: 13px; border-radius: 4px; overflow: hidden; margin-top: 18px; border: 1px solid var(--border); }
.mb-row { display: flex; justify-content: space-between; font-size: 14px; }
.warn-box { margin-top: 16px; background: #FBEDE7; border: 1px solid #E6BBAA; border-left: 4px solid var(--red); border-radius: 8px; padding: 12px 14px; }
.ok-box { margin-top: 16px; background: #E6F0E9; border: 1px solid #BCD8C4; border-left: 4px solid var(--green); border-radius: 8px; padding: 12px 14px; }
.gd-fill { height: 6px; background: var(--line); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.gd-fill > div { height: 100%; }

/* ---- buttons / forms ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-weight: 700; font-size: 13.5px; padding: 9px 14px; border-radius: 8px; border: none; cursor: pointer; background: var(--ink); color: #fff; }
.btn.acc { background: var(--red); box-shadow: 0 1px 0 #9E3714; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; background: #EEF1F5; color: var(--muted2); }
.btn.sm:hover { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

dialog.modal { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(440px, 92vw); box-shadow: 0 30px 70px rgba(16,20,27,.3); }
dialog.modal::backdrop { background: rgba(27,36,49,.45); }
.modal-h { padding: 18px 22px 0; font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 19px; }
.modal-b { padding: 14px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.fld label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted2); margin-bottom: 5px; }
.fld input, .fld select { width: 100%; font-family: inherit; font-size: 14.5px; font-weight: 500; color: var(--ink); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; outline: none; }
.fld input:focus, .fld select:focus { border-color: var(--ink); background: #fff; }
.frow { display: flex; gap: 10px; } .frow .fld { flex: 1; }
.form-err { color: var(--red-ink); font-size: 13px; font-weight: 600; min-height: 1em; }

/* ---- login ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--side); }
.auth-card { background: #fff; border-radius: 16px; padding: 34px 32px; width: min(420px, 94vw); }
.auth-card h1 { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 24px; margin: 14px 0 4px; letter-spacing: -.02em; }
.auth-sub { color: var(--muted); font-size: 14.5px; font-weight: 500; margin: 0 0 20px; }
.auth-alt { text-align: center; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-top: 16px; }
.auth-alt a, .auth-alt button { color: var(--red); font-weight: 700; background: none; border: none; font-family: inherit; font-size: 13.5px; cursor: pointer; text-decoration: none; }
.demo-hint { margin-top: 18px; background: #FEF7E3; border: 1px solid #EFDDA6; border-radius: 9px; padding: 11px 13px; font-size: 12.5px; font-weight: 600; color: #8A6A16; line-height: 1.5; }

/* ---- phone mock (digest) ---- */
.phone { width: 300px; background: #0F141B; border-radius: 38px; padding: 12px; border: 1px solid var(--side-line); box-shadow: 0 30px 70px rgba(16,20,27,.35); }
.phone .scr { background: var(--bg); border-radius: 27px; overflow: hidden; }
.phone .hd { background: var(--side); padding: 16px 18px 18px; color: #fff; }
.phone .bd { padding: 15px 16px; display: flex; flex-direction: column; gap: 10px; }
.phone .row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.deva { font-family: 'Noto Sans Devanagari', sans-serif; }

.note-locked { padding: 12px 22px; background: #FAFBFC; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.empty { padding: 34px 22px; text-align: center; color: var(--muted); font-weight: 600; font-size: 14px; }
