/* Srijan admin — layout: fixed sidebar (apps → modules, role wise) + content column.
   Palette: deep indigo ink, warm saffron accent (the brand mark), cool slate neutrals. */
:root {
    --bg: #f5f6f9;
    --surface: #ffffff;
    --sunk: #eef0f5;
    --line: #dde1ea;
    --fg: #1b2033;
    --muted: #5c6479;
    --ink: #2c3a8c;          /* primary actions */
    --ink-soft: #e6e9f8;
    --saffron: #e08a1e;      /* brand mark only */
    --ok: #1d7a4f; --ok-soft: #dff3e8;
    --warn: #93600a; --warn-soft: #fbf0d9;
    --bad: #b3352b; --bad-soft: #fbe4e1;
    --sidebar: #1c2340; --sidebar-fg: #c9cee2; --sidebar-active: #2f3a66;
    --display: "Mukta", "Segoe UI", system-ui, sans-serif;
    --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
    --mono: "JetBrains Mono", Consolas, monospace;
    --r: 8px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151f; --surface: #1a1e2b; --sunk: #222738; --line: #2e3446;
        --fg: #e5e8f1; --muted: #9aa2b8; --ink: #8c9cf2; --ink-soft: #262e52;
        --ok: #5ccf96; --ok-soft: #173326; --warn: #f0bf5e; --warn-soft: #382c12; --bad: #ff8b80; --bad-soft: #3d1c1a;
        --sidebar: #0e111b; --sidebar-fg: #aab1c9; --sidebar-active: #232a45;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; margin-top: .6rem; }
h1:focus { outline: none; }
a { color: var(--ink); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .85em; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; }
.strong { font-weight: 600; font-size: 1.05rem; }
.label { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: .3rem; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-fg); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-family: var(--display); font-size: 1.35rem; font-weight: 700; padding: .2rem .5rem 1rem; }
.brand small { font-family: var(--body); font-weight: 500; font-size: .75rem; color: var(--sidebar-fg); letter-spacing: .08em; text-transform: uppercase; }
.mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--saffron); color: #1c2340; font-size: 1.15rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: var(--sidebar-fg); text-decoration: none; padding: .42rem .65rem; border-radius: 6px; }
.nav a:hover { background: var(--sidebar-active); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--saffron); }
.nav-title { margin: 1.4rem .65rem .4rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #8088a6; font-weight: 600; }
.nav-app { margin: .7rem .65rem .2rem; font-size: .8rem; color: #fff; opacity: .75; }
.nav-empty { padding: 0 .65rem; font-size: .85rem; color: #8088a6; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .6rem 1.75rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar form { margin: 0; }
.content { padding: 1.5rem 1.75rem 4rem; display: flex; flex-direction: column; gap: 1.25rem; max-width: 1400px; width: 100%; }

/* ---------- headings, tabs ---------- */
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tag { background: var(--sunk); border: 1px solid var(--line); border-radius: 5px; padding: .1rem .5rem; font-size: .8rem; color: var(--muted); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--fg); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.two-col.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.sticky { position: sticky; top: 1rem; }
@media (max-width: 1100px) { .two-col, .two-col.wide-left { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } }
@media (max-width: 760px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; }
    .content { padding: 1rem; }
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; }
details.panel > summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.panel[open] > summary { margin-bottom: .9rem; }
details.panel[open] { display: flex; flex-direction: column; gap: .75rem; }
.empty-card { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit; }
.card.link:hover { border-color: var(--ink); }
.card-top { display: flex; justify-content: space-between; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.stat b { font-family: var(--display); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.link:hover { border-color: var(--ink); }
.stat.bad b { color: var(--bad); }

/* ---------- forms ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    width: 100%; min-width: 0; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
input:disabled, select:disabled, textarea:disabled { background: var(--sunk); color: var(--muted); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field > span, .field > label { font-size: .85rem; font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; gap: .5rem; }
.field.inline > span { white-space: nowrap; }
.field.inline select, .field.inline input { width: auto; }
.field.inline.grow input { width: 100%; }
.req { color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; gap: .8rem 1rem; }
.form-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }
.span-3 { grid-column: span 3; }
@media (max-width: 700px) { .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); } .span-3 { grid-column: auto; } }
.form-section { border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem 1rem; margin: 0 0 .8rem; }
.form-section legend { font-family: var(--display); font-weight: 700; padding: 0 .35rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; }
.num { width: 5rem !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .45rem .95rem; border-radius: 6px;
       border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--fg); white-space: nowrap; }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel .table-wrap { border: none; }
table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.grid th, .grid td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid th { background: var(--sunk); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tr.click { cursor: pointer; }
.grid tr.click:hover td { background: var(--sunk); }
.grid tr.selected td { background: var(--ink-soft); }
.grid tr.system td { color: var(--muted); }
.grid td.empty { text-align: center; color: var(--muted); padding: 1.6rem; }
.grid td.actions { white-space: nowrap; text-align: right; }
.grid.compact th, .grid.compact td { padding: .35rem .55rem; }
.grid.matrix td:not(:first-child), .grid.matrix th:not(:first-child) { text-align: center; }
.grid tr.detail td { background: var(--sunk); }
pre { background: var(--sunk); border: 1px solid var(--line); border-radius: 6px; padding: .75rem; overflow-x: auto; font: .82rem/1.5 var(--mono); margin: .4rem 0 0; white-space: pre-wrap; }
pre.sql { max-height: 480px; }
.pager { display: flex; align-items: center; gap: .6rem; justify-content: flex-end; }
.pager .muted { margin-right: auto; }

/* ---------- badges, chips, alerts ---------- */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .badge.lvl-error { background: var(--bad-soft); color: var(--bad); }
.badge.lvl-warn { background: var(--warn-soft); color: var(--warn); }
.badge.lvl-info { background: var(--ink-soft); color: var(--ink); }
.badge.chg-add { background: var(--ok-soft); color: var(--ok); }
.badge.chg-modify { background: var(--ink-soft); color: var(--ink); }
.badge.chg-delete { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { font-size: .75rem; padding: .05rem .45rem; border-radius: 4px; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 5px; font-weight: 600; font-size: .85rem; border: 1px solid var(--line); }
.pill.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.danger { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.alert { padding: .7rem .9rem; border-radius: var(--r); border: 1px solid transparent; }
.alert.error { background: var(--bad-soft); color: var(--bad); }
.alert.success { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.rights { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .25rem; }
.rights li::before { content: "✓"; display: inline-block; width: 1.3rem; color: var(--ok); font-weight: 700; }
.rights li.no { color: var(--muted); }
.rights li.no::before { content: "–"; color: var(--muted); }
.changes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; }

/* ---------- designers ---------- */
.field-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.field-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
.field-list li:last-child { border-bottom: none; }
.section-edit { border-left: 3px solid var(--ink); }
.preview { background: var(--bg); }
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.member-list li { display: flex; justify-content: space-between; align-items: center; }
.cond { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.cond-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: .4rem; width: 100%; max-width: 760px; }
.step { border: 1px solid var(--line); border-radius: var(--r); padding: .75rem; display: flex; flex-direction: column; gap: .6rem; background: var(--bg); }
.step select { width: auto; }
.email-preview { border: 1px solid var(--line); border-radius: 6px; padding: .8rem; background: #fff; color: #1b2033; }
.file-field { display: flex; flex-direction: column; gap: .3rem; }

.flow { display: flex; gap: .9rem; overflow-x: auto; padding-bottom: .3rem; }
.flow-stage { min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.flow-stage-name { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.flow-state { border: 1px solid var(--line); border-radius: 6px; padding: .45rem .55rem; background: var(--bg); }
.flow-state.start { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }
.flow-state.final { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.flow-arrow { font-size: .85rem; margin-top: .2rem; }

.wf-panel { border-top: 1px solid var(--line); padding-top: .75rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: .7rem; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(-1rem - 6px); top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.quote { border-left: 3px solid var(--line); padding-left: .5rem; margin-top: .2rem; font-style: italic; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--sidebar); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 12px; padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.brand-lg { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-size: 1.8rem; font-weight: 700; }

/* ---------- blazor ---------- */
#blazor-error-ui { background: var(--warn-soft); color: var(--warn); bottom: 0; display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
