/* Application controls only. Financial statement and certificate print styles
   are intentionally owned by style.css and services.css. */
@media screen {
  :root {
    --sky: #175cd3; --sky-d: #175cd3; --sky-accent: #164b9c;
    --sky-l: #eaf1ff; --sky-xl: #f3f7ff;
    --txt: #18283e; --txt2: #42546b; --txt3: #596a7e;
    --bg2: #f3f5f9; --border: #dce2eb; --border-d: #b7c3d2;
    --danger: #b42318; --ok: #157347; --warn: #9a6700;
    --radius: 7px; --gap: 1rem;
  }
  html { font-size: 15px; }
  html[lang="ne"] { --sans: 'Nirmala UI', 'Noto Sans Devanagari', 'Mangal', sans-serif; }
  body { height: 100vh; height: 100dvh; overflow: hidden; -webkit-font-smoothing: antialiased; }
  body.signed-out { height: auto; overflow: auto; }
  button, input, select, textarea { font-family: var(--sans); }
  button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
  :is(button,a,input,select,textarea,summary):focus-visible { outline: 3px solid #749ee4; outline-offset: 3px; }
  #main:focus { outline: none; }
  a { color: #1753b4; text-underline-offset: 3px; }
  .muted { color: var(--txt3); }
  .small { font-size: .85rem; }
  .topbar {
    height: 76px; padding: 0 24px; gap: 18px; background: #fff; flex-wrap: nowrap;
    color: var(--txt); border-bottom: 1px solid var(--border); box-shadow: none;
  }
  .topbar .brand { min-width: 210px; font-size: 1.12rem; letter-spacing: -.02em; }
  .topbar .brand small { font-size: .76rem; opacity: 1; color: var(--txt3); letter-spacing: 0; }
  .topbar #reportsHome { color: #29425e; background: #f6f8fb; border-color: var(--border); }
  .topbar select { color: var(--txt); background: #f6f8fb; border: 1px solid var(--border-d); padding: .55rem .65rem; max-width: 300px; }
  .lang-toggle { margin-left: auto; padding: 3px; border-radius: 8px; background: #edf1f6; gap: 2px; }
  .lang-toggle button { color: #42546b; background: transparent; border: 0; border-radius: 5px; min-height: 32px; font-weight: 600; }
  .lang-toggle button.on { background: #fff; color: #174fba; box-shadow: 0 1px 3px #23334d20; }
  .topbar #saveStatus { margin-left: 0; color: #426151; font-size: .77rem; max-width: 230px; }
  .topbar #signOut { background: #fff; border-color: var(--border-d); color: #35465d; }
  .layout { min-height: 0; height: calc(100vh - 76px); height: calc(100dvh - 76px); }
  #sidenav { width: 246px; min-width: 246px; padding: 20px 12px; background: #172a42; border: 0; box-shadow: none; scrollbar-color: #52647b transparent; }
  #sidenav .nav-g { color: #a6b8cf; font-size: .68rem; letter-spacing: .1em; padding: 16px 12px 9px; border: 0; margin: 0; }
  #sidenav .nav-g:first-child { padding-top: 5px; }
  #sidenav .nav-n { color: #e0e8f3; border: 0; border-radius: 7px; padding: 11px 12px; gap: 11px; margin: 3px 0; font-size: .91rem; line-height: 1.45; }
  #sidenav .nav-n svg { opacity: 1; width: 18px; height: 18px; flex: 0 0 18px; color: #abc1db; }
  #sidenav .nav-n:hover { background: #243c58; color: #fff; }
  #sidenav .nav-n:focus-visible { outline: 2px solid #b9d6ff; outline-offset: 1px; }
  #sidenav .nav-n.active { color: #fff; background: #285591; box-shadow: inset 3px 0 #95c4ff; }
  #sidenav .nav-n.active svg { color: #e8f2ff; }
  .nav-context { background: #243b55; color: #fff; margin: 18px 0 8px; padding: 13px; border: 1px solid #37516e; }
  .nav-context span { color: #c4d3e5; }
  #main { overflow: auto; min-width: 0; min-height: 0; padding: 28px 32px 48px; scrollbar-gutter: stable; scroll-behavior: auto; }
  .sync-banner { position: fixed; top: 76px; left: 246px; right: 0; z-index: 110; box-shadow: 0 3px 12px #172a421a; }
  .btn { min-height: 38px; border-color: #cbd5e1; border-radius: 7px; padding: .5rem .9rem; font-size: .86rem; font-weight: 600; box-shadow: 0 1px 2px #18283e08; }
  .btn:hover { border-color: #8ea6c4; background: #f0f5fc; box-shadow: none; }
  .btn-primary, .btn.primary { background: #175cd3; border-color: #175cd3; color: #fff; box-shadow: 0 1px 2px #1046a329; }
  .btn-primary:hover, .btn.primary:hover { background: #124ba9; border-color: #124ba9; }
  .btn-sm, .btn.sm { min-height: 32px; padding: .35rem .7rem; font-size: .8rem; }
  .btn-quiet { border-color: transparent; box-shadow: none; color: #1753b4; background: transparent; }
  .btn[disabled] { opacity: .6; cursor: not-allowed; }
  .card, .panel { border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 2px 5px #18283e04; }
  .card { padding: 22px; margin-bottom: 20px; }
  .card h3 { color: #253d5a; font-size: 1rem; padding-bottom: 12px; margin-bottom: 16px; border-color: #e3e8ef; }
  .page-title { color: #18283e; font-size: 1.55rem; letter-spacing: -.025em; }
  .toolbar { gap: 10px; border-color: #e3e8ef; padding-bottom: 14px; margin-bottom: 16px; }
  .fld { gap: 6px; margin-bottom: 14px; min-width: 0; }
  .fld > span, .fld label, .report-filters .fld span, .hub-form .fld span, .service-inputs .fld span {
    font-size: .85rem; font-weight: 600; color: #42546b; letter-spacing: 0;
  }
  .fld input, .fld select, .fld textarea, table.list input { border: 1px solid #b9c6d6; padding: 9px 11px; min-height: 40px; font-size: .9rem; border-radius: 6px; color: #18283e; background: #fff; }
  input::placeholder, textarea::placeholder { color: #67778b; opacity: 1; }
  .fld input:focus, .fld select:focus, .fld textarea:focus { border-color: #175cd3; box-shadow: 0 0 0 3px #175cd31a; }
  .fld input:disabled, .fld select:disabled, .fld textarea:disabled, table.list input:disabled { background: #edf1f6; color: #516174; opacity: 1; }
  .fld textarea { min-height: 88px; line-height: 1.55; }
  .grid2, .grid3, .grid4 { align-items: start; }
  .eyebrow { color: #536b87; letter-spacing: .11em; font-size: .69rem; }
  .hub-heading { margin-bottom: 24px; align-items: center; }
  .hub-heading h1 { font-size: 1.85rem; color: #172a42; line-height: 1.25; margin: 6px 0; }
  .hub-heading p { font-size: .88rem; color: #53647a; }
  .section-heading, .register-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .section-heading { margin-bottom: 10px; }
  .section-heading h2 { font-size: .82rem; color: #4b6079; font-weight: 600; }
  .service-grid { gap: 10px; margin-bottom: 24px; }
  .service-card { display: grid; grid-template-columns: 34px 1fr 24px; align-items: center; min-height: 76px; padding: 13px; gap: 11px; border-radius: 8px; color: #29425e; box-shadow: none; }
  .service-card strong { font-size: .9rem; font-weight: 600; line-height: 1.4; }
  .service-icon { width: 34px; height: 34px; border-radius: 7px; background: #edf3fc; color: #325f9b; }
  .service-icon svg { width: 20px; height: 20px; }
  .service-count { position: static; text-align: center; padding: 3px 5px; background: #eff2f6; border-radius: 5px; font-size: .75rem; color: #43546b; }
  .service-card:hover { background: #f7faff; border-color: #a2b8d6; box-shadow: none; }
  .service-card.selected { background: #eaf2ff; border-color: #5e8dd1; box-shadow: inset 0 0 0 1px #5e8dd1; }
  .service-card.selected .service-count { background: #175cd3; color: #fff; }
  .report-register { padding: 0; overflow: hidden; }
  .register-heading { padding: 18px 20px 12px; }
  .register-heading h2 { font-size: 1.05rem; color: #253d5a; }
  .register-tabs { display: flex; padding: 0 20px; gap: 20px; overflow-x: auto; border-bottom: 1px solid var(--border); }
  .register-tab { display: inline-flex; align-items: center; gap: 7px; padding: 12px 0; min-height: 44px; white-space: nowrap; font-size: .86rem; font-weight: 600; border: 0; border-bottom: 2px solid transparent; color: #56667b; background: transparent; cursor: pointer; }
  .register-tab span { background: #edf1f6; color: #455970; font-size: .72rem; border-radius: 5px; padding: 1px 6px; }
  .register-tab.selected { border-bottom-color: #175cd3; color: #1753b4; }
  .register-tab.selected span { background: #e8f0ff; color: #174fba; }
  .report-filters { padding: 16px 20px; gap: 14px; background: #fbfcfe; border-bottom: 1px solid var(--border); }
  .report-filters .fld { margin: 0; }
  table.list { font-size: .9rem; margin: 0; }
  table.list th { color: #52627a; background: #f5f7fa; padding: 12px 14px; font-size: .7rem; letter-spacing: .045em; }
  table.list td, .report-register table td { padding: 14px; border-bottom: 1px solid #e8ecf2; vertical-align: middle; line-height: 1.45; }
  table.list td strong { color: #243d59; font-weight: 600; }
  table.list td .small { margin-top: 4px; font-size: .76rem; }
  table.list tbody tr:hover td { background: #f6f9fe; }
  .report-register table { min-width: 830px; }
  .report-register td:nth-child(1) { min-width: 200px; }
  .report-register td:nth-child(2) { min-width: 190px; }
  .report-register td:nth-child(3), .report-register td:nth-child(5), .report-register td:nth-child(6) { white-space: nowrap; }
  .report-title { max-width: 300px; overflow-wrap: anywhere; }
  .register-footer { padding: 12px 20px; margin: 0; background: #fbfcfe; color: #5a6b81; font-size: .78rem; }
  .pill { padding: 4px 9px; font-size: .73rem; letter-spacing: 0; background: #eaf1fc; color: #274d80; line-height: 1.4; }
  .pill[data-status="draft"], .pill.mute { background: #edf1f6; color: #4c5e76; }
  .pill[data-status="in_review"], .pill.amber { background: #fff2d6; color: #825400; }
  .pill[data-status="reviewed"] { background: #f0ebff; color: #6335a1; }
  .pill[data-status="approved"], .pill.green { background: #e5f5ec; color: #176940; }
  .pill.red { background: #fdebea; color: #a62d26; }
  .workspace-tools { margin: 20px 0; font-size: .82rem; color: #526780; }
  .workspace-tools summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
  .workspace-tools[open] summary { margin-bottom: 10px; }
  .workspace-tools .small { margin-left: 10px; }
  .hub-form { max-width: 980px; padding: 26px; }
  .form-step { color: #294e7e; padding-bottom: 12px; }
  .workflow-panel { border-left: 3px solid #7d9fc9; }
  .workflow-people { padding: 12px 0; }
  .service-tabs { padding: 4px; background: #e9eef5; border-radius: 8px; width: fit-content; max-width: 100%; flex-wrap: wrap; }
  .service-tabs .btn { border: 0; box-shadow: none; background: transparent; color: #4b607a; }
  .service-tabs .btn-primary { background: #fff; color: #174fae; box-shadow: 0 1px 3px #23334d1a; }
  .service-summary { gap: 12px; }
  .service-summary > div { padding: 16px 18px; border-radius: 8px; }
  .service-summary strong { font-size: 1.35rem; color: #243d59; font-variant-numeric: tabular-nums; }
  .service-editor td { padding: 8px; }
  .login-panel .btn-primary { background: #175cd3; }
  .login-panel > p { color: #53647a; }
  .login-intro { background: #172a42; }
  .nav-toggle { display: none; }
  @media (min-width: 1700px) { #main { padding: 32px 42px 48px; } }
  @media (max-width: 1250px) {
    #sidenav { width: 218px; min-width: 218px; }
    #main { padding: 24px; }
    .topbar .brand { min-width: 175px; }
    .service-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .service-card { min-height: 62px; }
    .report-filters { grid-template-columns: 1.5fr 1fr; }
    .sync-banner { left: 218px; }
  }
  @media (max-width: 900px) {
    .topbar { height: 68px; padding: 0 16px; gap: 12px; }
    .topbar .brand { min-width: 0; flex: 1; }
    .topbar .brand small, .topbar #reportsHome, .topbar #saveStatus { display: none; }
    .topbar select { max-width: 185px; }
    .lang-toggle { margin-left: 0; }
    .nav-toggle { display: inline-flex; font-size: 1.1rem; padding: .35rem .65rem; }
    .layout { height: calc(100vh - 68px); height: calc(100dvh - 68px); }
    #sidenav { display: none; position: fixed; left: 0; top: 68px; bottom: 0; width: 270px; z-index: 90; box-shadow: 12px 0 30px #172a4240; }
    #sidenav .nav-n { display: flex; align-items: center; min-height: 42px; }
    #sidenav .nav-n svg { display: block; }
    body.nav-open #sidenav { display: block; }
    #main { width: 100%; padding: 20px; }
    .sync-banner { top: 68px; left: 0; }
    .workflow-people { grid-template-columns: 1fr; gap: 12px; }
    .grid3, .grid4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  }
  @media (max-width: 560px) {
    .topbar { gap: 8px; padding: 0 10px; }
    .topbar .brand { font-size: .92rem; white-space: normal; line-height: 1.2; }
    .topbar select { display: none; }
    .topbar #signOut { font-size: .72rem; padding: 5px 7px; }
    .lang-toggle button { padding: 4px 7px; font-size: .72rem; }
    #main { padding: 18px 12px 32px; }
    .hub-heading { align-items: flex-start; gap: 14px; margin-bottom: 20px; }
    .hub-heading h1 { font-size: 1.65rem; }
    .service-grid { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
    .service-card { grid-template-columns: 1fr 24px; min-height: 70px; padding: 10px; gap: 6px; flex: 0 0 170px; scroll-snap-align: start; }
    .service-card .service-icon { display: none; }
    .service-card strong { font-size: .84rem; }
    .report-filters { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px; }
    .report-filters .fld:first-child { grid-column: 1 / -1; }
    .register-heading { padding: 14px; }
    .register-tabs { padding: 0 14px; gap: 16px; }
    .card { padding: 16px; }
    .report-register { padding: 0; }
    .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
    .toolbar { align-items: flex-start; }
    .hub-form { padding: 18px; }
    .workspace-tools .small { display: block; margin: 8px 0 0; }
    .nta-report-page { padding: 20px; }
    .report-register table, .report-register tbody { display: block; min-width: 0; }
    .report-register thead { display: none; }
    .report-register tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px; gap: 12px; border-bottom: 1px solid var(--border); }
    .report-register table td { display: block; padding: 0; min-width: 0 !important; border: 0; white-space: normal !important; }
    .report-register td:first-child, .report-register td:nth-child(2), .report-register td:last-child { grid-column: 1 / -1; }
    .report-register td:first-child { font-size: .95rem; }
    .report-register td:last-child { text-align: right; }
    .report-register td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; font-weight: 600; color: #586c84; margin-bottom: 4px; }
    .report-register .report-title { max-width: none; }
    .report-register .tbl-wrap { overflow: visible; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
}
@media print { .nav-toggle { display: none !important; } }

/* Report preparation: identity, actions, review, then working content. */
@media screen {
  .btn { align-items: center; justify-content: center; gap: 8px; vertical-align: middle; line-height: 1.35; }
  .btn svg, .action-icon { width: 18px; height: 18px; flex: 0 0 18px; display: inline-block; vertical-align: middle; }
  .report-page-header { margin: 0 0 16px; }
  .report-back { display: inline-flex; align-items: center; gap: 7px; color: #536780; font-size: .82rem; text-decoration: none; margin-bottom: 16px; }
  .report-back:hover { color: #175cd3; text-decoration: underline; }
  .report-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
  .report-heading > div { min-width: 0; }
  .report-heading h1 { font-size: clamp(1.3rem, 2vw, 1.85rem); line-height: 1.3; color: #172a42; margin: 6px 0; overflow-wrap: anywhere; }
  .report-heading p { margin: 0; color: #53647a; font-size: .86rem; }
  .report-heading .pill { flex-shrink: 0; text-transform: none; }
  .report-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid #dce4ee; border-bottom: 1px solid #dce4ee; }
  .report-action-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .report-action-buttons .btn { min-height: 38px; }
  .report-save-state { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; color: #476052; }
  .report-save-state::before { content: ''; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #268257; }
  .report-save-state[data-state="saving"] { color: #785b1d; }
  .report-save-state[data-state="saving"]::before { background: #ad7b14; }
  .report-save-state[data-state="unsaved"] { color: #785b1d; }
  .report-save-state[data-state="unsaved"]::before { background: #ad7b14; }
  .report-save-state[data-state="error"] { color: #b42318; }
  .report-save-state[data-state="error"]::before { background: #b42318; }
  .workflow-panel { padding: 14px 18px; margin: 0 0 20px; border: 1px solid #dce4ee; box-shadow: none; background: #fff; }
  .workflow-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .workflow-heading > strong { font-size: .82rem; color: #405570; font-weight: 600; }
  .workflow-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .workflow-actions:empty { display: none; }
  .workflow-panel .workflow-people { padding: 12px 0; margin: 0; background: transparent; border: 0; border-radius: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .workflow-people > span + span { border-left: 1px solid #e3e8ef; padding-left: 16px; }
  .workflow-people small { font-size: .66rem; letter-spacing: .04em; }
  .workflow-people strong { font-size: .84rem; overflow-wrap: anywhere; }
  .workflow-details { border-top: 1px solid #edf0f5; padding-top: 8px; }
  .workflow-details > summary { color: #526780; font-size: .78rem; cursor: pointer; width: fit-content; }
  .workflow-details[open] > summary { margin-bottom: 12px; }
  .workflow-details > p { margin: 12px 0; }
  .workflow-assignment { margin: 12px 0; }
  .workflow-assignment .fld { margin-bottom: 10px; }
  .service-tabs { margin: 16px 0 20px; gap: 4px; }
  .service-tabs .btn { min-height: 40px; padding: 9px 14px; text-align: left; }
  .service-summary:empty { display: none; }
  @media (max-width: 700px) {
    .report-heading { align-items: flex-start; gap: 10px; }
    .report-heading .eyebrow { font-size: .66rem; }
    .report-actions { align-items: stretch; }
    .report-save-state { flex-basis: 100%; }
    .report-action-buttons { width: 100%; }
    .report-action-buttons .btn { flex: 1 1 auto; padding: 8px 10px; font-size: .76rem; }
    .workflow-panel { padding: 12px; }
    .workflow-panel .workflow-people { gap: 8px; }
    .workflow-people > span + span { padding-left: 8px; }
    .workflow-people small { font-size: .6rem; }
    .workflow-people strong { font-size: .76rem; }
    .service-tabs { width: 100%; }
    .service-tabs .btn { flex: 1 1 140px; justify-content: flex-start; font-size: .8rem; }
  }
}
.component-table { min-width: 780px; }
.component-table td:first-child { width: 22%; }
.component-table td:nth-child(2), .component-table td:nth-child(3) { width: 28%; }
.component-table td:nth-child(4) { width: 90px; }
.component-table input { width: 100%; }
.component-table td:first-child strong { overflow-wrap: anywhere; }
.component-table td:last-child small { display: block; margin-top: 4px; }
.map-t td.mapping-actions { min-width: 90px; width: 90px; }
.mapping-actions .btn { padding: 4px 8px; min-height: 28px; margin: 2px; }
.mapping-add-bottom { margin-top: 16px; }

.approp-rule { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 16px 0; }
.approp-rule-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.approp-rule-head > strong { overflow-wrap: anywhere; }
.approp-rule-actions { display: flex; flex-shrink: 0; gap: 6px; }
.approp-calculation-fields { display: grid; grid-template-columns: 2fr .7fr 1fr 1fr; gap: 16px; }
.approp-rule .fld { min-width: 0; }
.approp-rule input, .approp-rule select { width: 100%; }
.approp-deductions { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 0 0 12px; }
.approp-deductions legend { font-size: .82rem; padding: 0 6px; }
.approp-deductions label { display: inline-flex; align-items: center; gap: 8px; margin: 4px 18px 4px 0; font-size: .9rem; }
.approp-deductions input { width: auto; }
.approp-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #f3f6fa; border-radius: 6px; padding: 12px; font-variant-numeric: tabular-nums; }
.approp-preview span { display: block; font-size: .75rem; color: #52657b; margin-bottom: 4px; }
.approp-preview strong { display: block; font-size: .87rem; overflow-wrap: anywhere; }
@media print { #toast { display: none !important; } }
@media (max-width: 1000px) { .approp-calculation-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .approp-rule-head { align-items: flex-start; flex-direction: column; }
  .approp-calculation-fields, .approp-preview { grid-template-columns: 1fr; }
}
