/* IndiaLD CRM — deliberately plain. */
:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d232b; --muted: #66707c; --line: #dde1e6;
  --accent: #1f5fae; --accent-ink: #fff; --good: #1f7a45; --warn: #a26200; --bad: #b42318;
  --radius: 6px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }

/* layout */
.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: #16202c; color: #fff; }
.topbar .brand { color: #fff; font-weight: 700; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: #c9d3de; }
.topbar nav a.active { color: #fff; font-weight: 600; }
.topbar .logout { display: flex; gap: 10px; align-items: center; }
.topbar .logout .muted { color: #9aa7b4; }
.topbar .logout button { color: #c9d3de; }
main { max-width: 1280px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 420px; padding-top: 10vh; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.page-head h1 .count { color: var(--muted); font-weight: 400; font-size: 16px; margin-left: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.crumbs { margin: 0 0 6px; }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* forms */
label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 12.5px; color: #3b4450; }
.field { margin-bottom: 12px; }
.field > select { display: block; width: 100%; }
.field-label { display: block; font-weight: 600; font-size: 12.5px; color: #3b4450; margin-bottom: 4px; }
label.check { font-weight: 400; font-size: 14px; color: var(--ink); display: flex; gap: 6px; align-items: baseline; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid #c4cad1; border-radius: 4px; background: #fff; color: var(--ink); }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
textarea { resize: vertical; }
input.short { width: 80px; }
button, .button { font: inherit; padding: 6px 12px; border: 1px solid #b9c0c8; border-radius: 4px; background: #fff; color: var(--ink); cursor: pointer; display: inline-block; }
button:hover, .button:hover { background: #eef1f4; text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: #194f92; }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.danger { color: var(--bad); border-color: #e3b5b0; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.link:hover { text-decoration: underline; background: none; }
form.inline { display: inline-flex; gap: 8px; align-items: center; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; padding: 10px 14px; }
legend { font-weight: 600; padding: 0 4px; }
fieldset.columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-row { display: flex; gap: 20px; align-items: end; margin: 12px 0; }
.login-card h1 { text-align: center; }
.login-card button { width: 100%; margin-top: 6px; }

/* filters */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 14px; }
.filter-grid .wide { grid-column: span 2; }
.filter-grid select[multiple] { min-height: 84px; }
.radio-row { display: flex; gap: 12px; margin-top: 4px; }
.radio-row label { font-weight: 400; display: flex; gap: 4px; margin: 0; }
.filters .actions { margin-top: 4px; }

/* bulk bar */
.bulkbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; }
.bulk-arg[hidden] { display: none; }

/* tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
table.grid th, table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { background: #eef1f4; font-size: 12.5px; color: #3b4450; white-space: nowrap; }
table.grid th a { color: inherit; }
table.grid tbody tr:hover { background: #f8fafc; }
table.grid.compact th, table.grid.compact td { padding: 5px 8px; }
table.grid td.cb, table.grid th.cb { width: 28px; }
table.grid td.tags { color: #3b4450; font-size: 12.5px; }
table.grid td.empty { text-align: center; color: var(--muted); padding: 24px; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.old { color: var(--bad); }
table.grid td.new { color: var(--good); }
.narrow-table { max-width: 420px; }
.pager { display: flex; gap: 16px; justify-content: center; margin: 14px 0; }

/* detail */
dl.fields { display: grid; grid-template-columns: 190px 1fr; gap: 6px 12px; margin: 0; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; word-break: break-word; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-chip { display: inline-flex; gap: 6px; align-items: center; background: #e8eff8; border-radius: 12px; padding: 2px 10px; }
.tag-chip button { font-size: 15px; line-height: 1; color: var(--muted); }
.save-state { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.save-state.ok { color: var(--good); }
.save-state.err { color: var(--bad); }

/* settings */
.status-list { margin-bottom: 12px; }
.row-form { display: grid; grid-template-columns: 1fr 90px 90px 80px 70px; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.row-form.head { font-weight: 600; font-size: 12.5px; color: #3b4450; }
.row-form label.check { margin: 0; }

/* badges, stats, flashes */
.badge { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 10px; background: #eef1f4; color: #3b4450; font-weight: 600; }
.badge.warn, .badge.previewed { background: #fdf0d9; color: var(--warn); }
.badge.applied { background: #dff3e6; color: var(--good); }
.badge.cancelled, .badge.expired { background: #eceef1; color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 130px; }
.stat .n { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span:last-child { color: var(--muted); font-size: 12.5px; }
.stat.good .n { color: var(--good); } .stat.accent .n { color: var(--accent); }
.stat.warn .n { color: var(--warn); } .stat.bad .n { color: var(--bad); }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid; }
.flash-success { background: #e9f6ee; border-color: #b6dfc4; }
.flash-error { background: #fdecea; border-color: #f2c1bb; }
.flash-info { background: #eaf1fb; border-color: #bfd3ee; }
.confirm .big { font-size: 17px; }
.sticky-actions { position: sticky; bottom: 0; display: flex; gap: 16px; align-items: center; box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
