/* ACCTSYS for Windows - "classic" staff look: an old-style Windows program
   (menu bar, toolbar, 3-D buttons, property-sheet tabs, status bar) laid out
   like the 5250 green screen (screen header, command line, F-key bar).
   Loaded after app.css by the staff pages only; the portal keeps app.css. */
:root {
  --face: #ecebe6; --face2: #f6f5f1; --window: #ffffff; --ink: #1a1a1a; --muted: #5e5e5e;
  --hi: #ffffff; --lo: #a3a29b; --dk: #6f6e68; --line: #c9c7bd; --soft: #f1f0ea;
  --sel: #316ac5; --sel-ink: #ffffff; --hover: #dceaf9;
  --cap1: #0a246a; --cap2: #3a6ea5; --cap-ink: #ffffff;
  --scr: #0b1f12; --scr-ink: #4ce07a; --scr-hi: #ffffff;
  --panel: var(--window); --bg: var(--face);
  --blue: #1f5fbf; --blue-ink: #0b46a8; --pink: #c0174f; --purple: #5b34a8; --green: #11704f; --red: #b3172b; --yellow: #a56f00;
  --radius: 2px; --shadow: none;
  --mono: Consolas, "Cascadia Mono", "Lucida Console", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --face: #2b2b2e; --face2: #333337; --window: #1e1e20; --ink: #e8e8e8; --muted: #a8a8a8;
    --hi: #4a4a4f; --lo: #18181a; --dk: #0f0f10; --line: #45454a; --soft: #29292c;
    --sel: #2f62b8; --hover: #2c3b52;
    --cap1: #10204a; --cap2: #2b4f86;
    --blue-ink: #8fb8ff; --pink: #ff7aa6; --purple: #b79bff; --green: #6fd8a8; --red: #ff8090; --yellow: #f2c45a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --face: #2b2b2e; --face2: #333337; --window: #1e1e20; --ink: #e8e8e8; --muted: #a8a8a8;
  --hi: #4a4a4f; --lo: #18181a; --dk: #0f0f10; --line: #45454a; --soft: #29292c;
  --sel: #2f62b8; --hover: #2c3b52; --cap1: #10204a; --cap2: #2b4f86;
  --blue-ink: #8fb8ff; --pink: #ff7aa6; --purple: #b79bff; --green: #6fd8a8; --red: #ff8090; --yellow: #f2c45a;
  color-scheme: dark;
}

body.classic { font: 13px/1.4 "Segoe UI", Tahoma, system-ui, sans-serif; background: var(--face); color: var(--ink); overflow: hidden; }
.classic a { color: var(--blue-ink); }
.classic h1 { font-size: 17px; } .classic h2 { font-size: 14px; } .classic h3 { font-size: 12px; }
.classic .num, .classic .mono { font-family: var(--mono); font-size: 13px; }

/* ---------- window frame: rows = menu, toolbar, screen, command, keys, status */
.win { height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto auto auto; }

/* menu bar */
.menubar { display: flex; align-items: center; gap: 0; background: var(--face2); border-bottom: 1px solid var(--line); padding: 1px 4px; position: relative; z-index: 30; }
.menu { position: relative; }
.mtop { font: inherit; color: var(--ink); background: none; border: 1px solid transparent; padding: 3px 9px; cursor: default; }
.mtop:hover, .menu.open .mtop { background: var(--hover); border-color: color-mix(in srgb, var(--sel) 45%, transparent); }
.drop { display: none; position: absolute; left: 0; top: 100%; min-width: 240px; background: var(--window); border: 1px solid var(--dk); box-shadow: 2px 3px 6px rgba(0,0,0,.25); padding: 2px; }
.menu.open .drop { display: block; }
.drop a { display: flex; gap: 12px; align-items: center; padding: 4px 10px 4px 24px; color: var(--ink); white-space: nowrap; }
.drop a:hover { background: var(--sel); color: var(--sel-ink); text-decoration: none; }
.drop a.on { font-weight: 700; }
.drop a .cmd { margin-left: auto; font-family: var(--mono); font-size: 11px; opacity: .65; }
.drop hr { border: 0; border-top: 1px solid var(--line); margin: 3px 2px; }
.menu-fill { flex: 1; }
.classic .badge { background: var(--pink); color: #fff; border-radius: 2px; padding: 0 5px; font-size: 11px; font-weight: 700; }

/* search (F4) in the menu bar */
.classic .search { flex: 0 1 360px; max-width: 360px; margin: 1px 0; }
.classic .search input { padding: 2px 6px; width: 100%; }
.classic .results { top: 26px; border-radius: 0; border: 1px solid var(--dk); box-shadow: 2px 3px 6px rgba(0,0,0,.25); background: var(--window); }
.classic .results .grp { background: var(--face); }
.classic .results a.sel, .classic .results a:hover { background: var(--sel); color: var(--sel-ink); }
.classic .results a.sel .muted, .classic .results a:hover .muted { color: inherit; }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: 2px; padding: 3px 4px; background: linear-gradient(var(--face2), var(--face)); border-bottom: 1px solid var(--lo); flex-wrap: wrap; }
.tb { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; color: var(--ink); border: 1px solid transparent; border-radius: 2px; white-space: nowrap; }
.tb:hover { text-decoration: none; border-color: var(--lo); background: var(--hover); }
.tb-sep { width: 1px; align-self: stretch; margin: 2px 6px; background: var(--lo); box-shadow: 1px 0 var(--hi); }
.toolbar .bar { gap: 4px; }

/* ---------- the screen: 5250 header + scrolling body */
.screen { min-height: 0; display: flex; flex-direction: column; margin: 6px 6px 0; background: var(--window); border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); box-shadow: inset 1px 1px var(--dk); }
.scr-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 4px 10px; background: linear-gradient(90deg, var(--cap1), var(--cap2)); color: var(--cap-ink); font-family: var(--mono); font-size: 12px; line-height: 1.3; }
.scr-head .c { text-align: center; font-family: "Segoe UI", Tahoma, sans-serif; }
.scr-head .c b { font-size: 15px; letter-spacing: .02em; }
.scr-head .c small { opacity: .8; letter-spacing: .08em; text-transform: uppercase; font-size: 10px; }
.scr-head .r { text-align: right; }
.classic .content { flex: 1; overflow: auto; padding: 10px 12px 20px; max-width: none; }
.classic .page-head { margin-bottom: 10px; align-items: center; }
.classic .page-head > div > h1 { display: none; }      /* the title is in the screen header */
.classic .page-head .muted { color: var(--muted); }
.classic .page-head > div > .muted:first-of-type::before { content: "\25B8  "; color: var(--blue-ink); }

/* command line + F-key bar */
.cmdline { display: flex; align-items: center; gap: 8px; margin: 0 6px; padding: 4px 10px; background: var(--window); border: 1px solid; border-color: var(--hi) var(--lo) var(--lo) var(--hi); border-top: 0; font-family: var(--mono); font-size: 12px; }
.cmdline label { color: var(--muted); white-space: nowrap; }
.cmdline .arrow { color: var(--blue-ink); font-weight: 700; }
.cmdline input { flex: 1; font-family: var(--mono); border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 1px 2px; border-radius: 0; text-transform: uppercase; }
.cmdline input::placeholder { text-transform: none; }
.cmdline input:focus { outline: none; border-bottom-color: var(--sel); }
.fkeys { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 6px; }
.fk { font: 12px var(--mono); color: var(--ink); padding: 2px 8px; cursor: pointer; background: linear-gradient(var(--face2), var(--face)); border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo); border-radius: 2px; }
.fk b { color: var(--blue-ink); }
.fk:hover { background: var(--hover); }
.fk:active { border-color: var(--dk) var(--hi) var(--hi) var(--dk); box-shadow: inset 1px 1px var(--lo); }

/* status bar */
.status { display: flex; gap: 2px; padding: 2px; background: var(--face); border-top: 1px solid var(--hi); font-size: 12px; }
.sb { padding: 1px 8px; border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb.grow { flex: 1; }
.sb.err { color: var(--red); font-weight: 600; }

/* ---------- controls */
.classic .btn { border-radius: 3px; padding: 3px 12px; font-weight: 400; color: var(--ink); background: linear-gradient(var(--face2), var(--face)); border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo); }
.classic .btn:hover { border-color: var(--hi) var(--dk) var(--dk) var(--hi); background: var(--hover); }
.classic .btn:active { border-color: var(--dk) var(--hi) var(--hi) var(--dk); box-shadow: inset 1px 1px var(--lo); }
.classic .btn:focus-visible { outline: 1px dotted var(--ink); outline-offset: -4px; }
.classic .btn.primary { font-weight: 700; box-shadow: inset -1px -1px var(--lo), 0 0 0 1px var(--dk); }
.classic .btn.primary, .classic .btn.pink, .classic .btn.purple { color: var(--ink); background: linear-gradient(var(--face2), var(--face)); }
.classic .btn.pink { border-left: 3px solid var(--pink); } .classic .btn.purple { border-left: 3px solid var(--purple); }
.classic .btn.danger { color: var(--red); }
.classic .btn.sm { padding: 1px 7px; font-size: 12px; }
.classic .btn .k { font-family: var(--mono); border-radius: 0; border-color: var(--lo); color: var(--blue-ink); opacity: 1; }
.classic input, .classic select, .classic textarea { border-radius: 0; padding: 3px 5px; background: var(--window); border: 1px solid; border-color: var(--dk) var(--line) var(--line) var(--dk); box-shadow: inset 1px 1px var(--lo); }
.classic input:focus, .classic select:focus, .classic textarea:focus { outline: none; border-color: var(--sel); box-shadow: inset 1px 1px var(--lo), 0 0 0 1px color-mix(in srgb, var(--sel) 40%, transparent); }
.classic input[type=checkbox], .classic input[type=radio] { box-shadow: none; }
.classic label.f { color: var(--ink); font-weight: 400; }
.classic label.f input, .classic label.f select, .classic label.f textarea { font-size: 13px; }

/* group boxes */
.classic .card { border-radius: 0; box-shadow: none; padding: 10px 12px; background: var(--window); border: 1px solid var(--line); outline: 1px solid var(--hi); outline-offset: -2px; }
.classic .card > h2:first-child, .classic .card > h3:first-child { margin: -10px -12px 10px; padding: 4px 12px; font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); background: linear-gradient(var(--face2), var(--face)); border-bottom: 1px solid var(--line); }
.classic .grid { gap: 8px; }
.classic .kpi .value { font-family: var(--mono); font-size: 22px; }
.classic .kpi.accent, .classic .kpi.warn, .classic .kpi.ok, .classic .kpi.purple { border-top-width: 3px; }

/* list views */
.classic table.t th { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); padding: 3px 8px; background: linear-gradient(var(--window), var(--face)); border-bottom: 1px solid var(--lo); border-right: 1px solid var(--line); }
.classic .t td { padding: 3px 8px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.classic .t tr:nth-child(even) td { background: color-mix(in srgb, var(--soft) 70%, var(--window)); }
.classic .t tr.click:hover td { background: var(--hover); }
.classic .scroll { border-radius: 0; }
.classic .pill { border-radius: 2px; font-weight: 600; font-size: 11px; padding: 0 5px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); }

/* property-sheet tabs */
.classic .tabs { gap: 0; border-bottom: 1px solid var(--dk); margin-bottom: 0; padding-left: 2px; overflow: visible; }
.classic .tabs a { padding: 3px 12px; margin-bottom: -1px; margin-right: -1px; font-weight: 400; color: var(--ink); background: var(--face); border: 1px solid var(--dk); border-bottom-color: var(--dk); border-radius: 3px 3px 0 0; position: relative; top: 2px; }
.classic .tabs a.on { background: var(--window); border-bottom-color: var(--window); top: 0; padding-bottom: 5px; z-index: 1; color: var(--ink); }
.classic .tab.card { border-top: 0; outline: none; border-color: var(--dk); }
.classic .actions-bar { margin: 8px 0; gap: 4px; }

/* dialogs = windows */
.classic dialog { border-radius: 0; border: 1px solid var(--dk); box-shadow: 4px 6px 18px rgba(0,0,0,.35); background: var(--face); }
.classic dialog::backdrop { background: rgba(0, 0, 0, .18); }
.classic .dlg-head { padding: 4px 4px 4px 10px; background: linear-gradient(90deg, var(--cap1), var(--cap2)); color: var(--cap-ink); border-bottom: 0; }
.classic .dlg-head h2 { font-size: 13px; color: var(--cap-ink); }
.classic .dlg-head .x { width: 22px; height: 20px; font-size: 15px; line-height: 1; color: var(--ink); background: linear-gradient(var(--face2), var(--face)); border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); padding: 0; }
.classic .dlg-body { background: var(--face); }
.classic .dlg-foot { background: var(--face); border-top: 1px solid var(--lo); border-radius: 0; }

/* messages */
.classic .flash { border-radius: 0; padding: 5px 10px; margin-bottom: 10px; font-family: var(--mono); font-size: 12px; }
.classic .form-error, .classic .form-warn { border-radius: 0; }
.classic .toast { border-radius: 0; background: #ffffe1; color: #000; border: 1px solid #000; box-shadow: 2px 2px 4px rgba(0,0,0,.3); right: 12px; bottom: 74px; }
.classic .alert-box { border-radius: 0; border: 1px solid var(--dk); border-top: 3px solid var(--pink); top: 64px; }

/* workspace */
.classic .ws { grid-template-columns: 250px 1fr; gap: 8px; }
.classic .ws.ws-one { grid-template-columns: 1fr; }
.classic .cpick-card { margin-bottom: 8px; padding: 6px 8px; }
.classic .cpick-list { border-radius: 0; border: 1px solid var(--dk); box-shadow: 2px 3px 6px rgba(0,0,0,.25); background: var(--window); }
.classic .cpick-list a.sel, .classic .cpick-list a:hover { background: var(--sel); color: var(--sel-ink); }
.classic .cpick-list a.sel .muted, .classic .cpick-list a:hover .muted { color: inherit; }
.classic .card-title { padding: 4px 8px; background: var(--face); border-bottom: 1px solid var(--dk); }
.classic .ledger-grid, .classic .ledger-side { gap: 8px; }
.classic .ws-list { top: 0; max-height: calc(100vh - 230px); padding: 6px; }
.classic .ws-list a { border-radius: 0; padding: 3px 6px; }
.classic .ws-list a.on { background: var(--sel); color: var(--sel-ink); }
.classic .ws-list a.on small { color: inherit; opacity: .85; }
.classic .ws-list small span:first-child { font-family: var(--mono); }
.classic .hero { gap: 8px; }
.classic .money-row div { border-radius: 0; border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); background: var(--soft); }
.classic .money-row b { font-family: var(--mono); font-size: 18px; }
.classic .note { border-radius: 0; }
.classic .aging, .classic .aging span { border-radius: 0; }
.classic .thumb { border-radius: 0; }

/* main menu (dashboard) */
.mainmenu { font-family: var(--mono); font-size: 13px; columns: 2 220px; column-gap: 24px; margin: 4px 0 0; padding: 0; list-style: none; }
.mainmenu li { break-inside: avoid; padding: 1px 0; }
.mainmenu a { color: var(--ink); display: inline-flex; gap: 10px; }
.mainmenu a b { color: var(--blue-ink); width: 2.5ch; text-align: right; }
.mainmenu a:hover { background: var(--sel); color: var(--sel-ink); text-decoration: none; }
.mainmenu a:hover b { color: inherit; }

/* ---------- sign-on (a dialog window on the desktop) */
.classic .login { background: linear-gradient(160deg, #1d4f91, #0a246a 60%, #071a4d); }
.classic .login .signon { width: min(520px, 94vw); background: var(--face); border: 1px solid var(--dk); box-shadow: 6px 8px 24px rgba(0,0,0,.45); }
.classic .login .dlg-head h2 { margin: 0; }
.classic .login .so-body { padding: 14px 18px; display: grid; gap: 10px; }
.so-sys { font: 12px var(--mono); color: var(--muted); display: grid; grid-template-columns: auto 1fr; gap: 0 12px; }
.so-row { display: grid; grid-template-columns: 1fr 200px; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; }
.so-row label { white-space: nowrap; overflow: hidden; }
.so-row label::after { content: " . . . . . . . . . . . . . . . . . . . . . ."; color: var(--muted); }
.so-row input { font-family: var(--mono); }
.classic .login .tag { font-size: 11px; }

@media print { .menubar, .toolbar, .cmdline, .fkeys, .status, .scr-head { display: none !important; } body.classic { overflow: visible; } .win { display: block; height: auto; } }
@media (max-width: 700px) { .scr-head { grid-template-columns: 1fr; text-align: center; } .scr-head .l, .scr-head .r { display: none; } .toolbar .tb { display: none; } .cmdline label { display: none; } }

/* ---------- print template editor */
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: start; }
@media (max-width: 1100px) { .tpl-edit { grid-template-columns: 1fr; } }
.tpl-edit textarea.code { font: 12.5px/1.45 var(--mono); min-height: 52vh; white-space: pre; tab-size: 2; resize: vertical; }
.tpl-fields { margin-top: 8px; }
.tpl-fields summary { cursor: pointer; padding: 2px 0; }
.fieldlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px; margin: 6px 0; }
.fld { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font: inherit; padding: 3px 6px; background: var(--window); color: var(--ink); border: 1px solid transparent; cursor: pointer; }
.fld:hover { background: var(--hover); border-color: var(--line); }
.fld code { font: 12px var(--mono); color: var(--blue-ink); }
.fld span { font-size: 11px; color: var(--muted); }
.tpl-right { position: sticky; top: 0; }
.paper-wrap { background: #8a8a8a; padding: 8px; overflow: hidden; border: 1px solid; border-color: var(--dk) var(--hi) var(--hi) var(--dk); }
.paper-wrap iframe { width: 816px; height: 1056px; border: 0; background: #fff; transform-origin: 0 0; box-shadow: 2px 3px 8px rgba(0,0,0,.4); display: block; }

/* ---------- template designer */
.dz-top { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.dz { display: grid; grid-template-columns: 330px minmax(0, 1fr) 290px; gap: 8px; align-items: start; }
@media (max-width: 1250px) { .dz { grid-template-columns: 300px minmax(0, 1fr); } .dz-right { grid-column: 1 / -1; } }
.dz-left, .dz-right { padding: 0 !important; max-height: calc(100vh - 250px); overflow: auto; position: sticky; top: 0; }
.dz-right { padding: 8px 10px !important; display: grid; gap: 8px; align-content: start; }
.dz-right h2 { margin: -8px -10px 0 !important; }
.dz-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--dk); background: var(--face); position: sticky; top: 0; z-index: 2; }
.dz-tabs a { padding: 4px 9px; color: var(--ink); border-right: 1px solid var(--line); }
.dz-tabs a.on { background: var(--window); font-weight: 700; }
.dz-tabs a:hover { text-decoration: none; background: var(--hover); }
.dz-pane { display: none; padding: 8px 10px; } .dz-pane.on { display: block; }
.dz-layout, .dz-style, .dz-pal { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--window); border: 1px solid var(--line); padding: 6px 8px; margin-bottom: 4px; cursor: pointer; }
.dz-layout:hover, .dz-style:hover, .dz-pal:hover { background: var(--hover); }
.dz-style.on { border: 2px solid var(--sel); }
.dz-style b { font-size: 15px; } .dz-style span { font-size: 11px; color: var(--muted); }
.dz-mini { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.dz-mini i { font-style: normal; font-size: 10px; background: var(--soft); border: 1px solid var(--line); padding: 0 4px; }
.dz-pal { flex-direction: row; align-items: center; gap: 0; }
.dz-pal i { width: 26px; height: 22px; display: block; border: 1px solid rgba(0,0,0,.15); }
.dz-pal span { margin-left: 8px; font-size: 12px; }
.dz-roles { display: grid; gap: 4px; }
.dz-role { display: grid; grid-template-columns: 38px 1fr 80px; gap: 6px; align-items: center; }
.dz-role input[type=color], .dz-color input[type=color] { width: 36px; height: 24px; padding: 0 2px; }
.dz-color { display: grid; grid-template-columns: 36px 1fr auto; gap: 4px; }
.dz-stack { list-style: none; margin: 0; padding: 0; }
.dz-stack li { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border: 1px solid var(--line); margin-bottom: 2px; background: var(--window); cursor: pointer; }
.dz-stack li.on { background: var(--sel); color: var(--sel-ink); }
.dz-stack li.on small { color: inherit; }
.dz-stack li.off .nm { opacity: .45; text-decoration: line-through; }
.dz-stack li.over { border-top: 3px solid var(--sel); }
.dz-stack li.drag { opacity: .4; }
.dz-stack .grip { cursor: grab; color: var(--muted); letter-spacing: -3px; padding: 0 4px; }
.dz-stack .nm { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dz-stack .nm small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-stack button { font: 11px inherit; background: none; border: 1px solid transparent; color: inherit; cursor: pointer; padding: 0 3px; }
.dz-stack button:hover { border-color: var(--lo); background: var(--face); color: var(--ink); }
.dz-lib { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.dz-lib button { display: flex; flex-direction: column; align-items: center; gap: 2px; font: 10px inherit; color: var(--ink); background: var(--window); border: 1px solid var(--line); padding: 4px 2px; cursor: pointer; }
.dz-lib button:hover { background: var(--hover); }
.dz-lib img { width: 40px; height: 40px; object-fit: contain; }
.dz-lib button.pic { grid-column: span 2; padding: 6px; }
.dz-mid { min-width: 0; }
.dz textarea { width: 100%; }
