/* HR demo: a responsive web layout for the three forms. Colours and header follow the FormsRefresh site. */
:root {
  --ink: #1d232b; --muted: #5b6672; --line: #d8dde3; --line-strong: #b9c2cc; --accent: #2b5d8a; --accent-ink: #fff;
  --accent-soft: #e8f0f8; --bg: #f2f4f7; --card: #fff; --head: #1d2b3a; --warn: #9a5b00; --ok: #2f6f3e; --row: 30px;
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); }
button, input { font: inherit; color: inherit; }

/* Page shell: header and notice on top, the work area scrolls, the message line stays at the bottom. */
#frame { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.fr-header { background: var(--head); color: #fff; display: flex; align-items: center; gap: 10px 22px; padding: 10px 24px; flex-wrap: wrap; }
.fr-brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; }
.fr-app { color: #c9d3de; font-size: 14px; padding-left: 14px; border-left: 1px solid #3b4b5c; }
.fr-nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
.fr-nav a { color: #c9d3de; text-decoration: none; font-size: 14px; }
.fr-nav a:hover { color: #fff; text-decoration: underline; }
.demo-notice { background: #fff8e1; border-bottom: 1px solid #ecd9a0; padding: 6px 24px; font-size: 13px; color: #4d4227; }
#main { flex: 1; overflow: auto; padding: 24px; }
#statusbar { display: flex; align-items: center; gap: 16px; padding: 7px 24px; min-height: 36px; background: #fff;
  border-top: 1px solid var(--line-strong); box-shadow: 0 -2px 8px rgba(29, 43, 58, .06); font-size: 13px; }
#message { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#statusbar.has-message #message::before { content: "\2139"; display: inline-block; margin-right: 8px; color: var(--accent); font-weight: 700; }
#statusbar.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #fff1c2; } to { background: #fff; } }
#position { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Windows */
#mdi { display: flex; flex-direction: column; align-items: center; gap: 20px; max-width: 1400px; margin: 0 auto; }
#mdi.with-employees { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
@media (max-width: 1360px) { #mdi.with-employees { grid-template-columns: 196px minmax(0, 1fr); gap: 16px; } #main { padding: 20px 16px; } }
#mdi.with-employees > .window { width: auto; }
#mdi.with-employees > [data-window="CONSOLE"], #mdi.with-employees > [data-window="LOGIN"] { grid-column: 1; position: sticky; top: 0; }
#mdi.with-employees > [data-window="EMPLOYEES"] { grid-column: 2; grid-row: 1 / span 2; }
.window { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 3px rgba(29, 43, 58, .08), 0 6px 20px rgba(29, 43, 58, .06); width: 100%; overflow: hidden; }
.window.form-login, .window.form-console { max-width: 380px; }
.window.form-employees { max-width: 1160px; }
.window.active { border-color: #9fb6cc; }
.titlebar { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); user-select: none; background: #fafbfc; }
.window.active .titlebar { color: var(--accent); }
.titlebar .close { border: none; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; width: 30px; height: 26px; border-radius: 6px; cursor: pointer; }
.titlebar .close:hover { background: #fde8e8; color: #a12828; }
.body { padding: 20px; }
.brandmark { text-align: center; margin-bottom: 18px; }
.brandmark h2 { margin: 0; font-size: 24px; letter-spacing: .02em; }
.brandmark p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.form-note { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Items */
input.item { width: 100%; height: var(--row); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 8px; background: #fff; }
input.item:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43, 93, 138, .2); }
input.item:disabled { background: #f1f3f5; color: var(--muted); border-color: var(--line); }
input.item.right { text-align: right; font-variant-numeric: tabular-nums; }
input.item.plain, input.item.plain:disabled { border: none; background: transparent; padding: 0; height: auto; color: var(--ink); font-weight: 600; width: auto; }
.btn { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f4f7fa; border-color: #98a6b4; }
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(43, 93, 138, .25); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #234d73; }
.btn.apex { color: var(--accent); border-color: #a9c1d8; background: var(--accent-soft); }
.btn.apex::after { content: " \2197"; }

/* Stacked control blocks (LOGIN, CONSOLE) */
.block.stack > .rec { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field.plain .lbl { white-space: nowrap; }
.field.plain { flex-direction: row; gap: 6px; align-items: baseline; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.block.stack .btn { width: 100%; }
#blk-console .rec { gap: 10px; }
#blk-console [name="logout"] { margin-top: 18px; }
.form-console .field.plain { order: 9; }

/* Console beside EMPLOYEES: a side panel */
#mdi.with-employees .form-console .brandmark { text-align: left; margin-bottom: 14px; }
#mdi.with-employees .form-console .brandmark h2 { font-size: 18px; }

/* EMPLOYEES toolbar */
.block.toolbar > .rec { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.tb-group { display: flex; gap: 6px; align-items: center; }
.tb-search { flex: 1 1 320px; }
.tb-search input { flex: 1; min-width: 120px; height: 34px; }
.tb-apex { margin-left: auto; }
.group { margin-top: 18px; }
.group-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Multi-record blocks: a table of display rows with its own scrollbar */
.block.grid { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.grid-scroll { flex: 1; min-width: 0; overflow-x: auto; }
.grid-inner { width: 100%; }
.grid-rows input.item, .grid-rows .btn { min-width: 0; }
.grid-head, .grid-rows .rec { display: grid; column-gap: 0; align-items: center; }
.grid-head { background: #f6f8fa; border-bottom: 1px solid var(--line); }
.grid-head .prompt { padding: 7px 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.grid-head .prompt.right { text-align: right; }
.grid-rows { touch-action: pan-x; }
.grid-rows .rec { border-bottom: 1px solid #edf0f3; }
.grid-rows .rec:last-child { border-bottom: none; }
.grid-rows .rec input.item { border-color: transparent; border-radius: 0; background: transparent; padding: 0 6px; height: calc(var(--row) + 1px); }
.grid-rows .rec input.item:disabled { color: var(--muted); background: transparent; }
.grid-rows .rec input.item:focus { border-color: var(--accent); background: #fff; box-shadow: inset 0 0 0 1px var(--accent); }
.grid-rows .rec:hover:not(.empty) { background: #f8fafc; }
.grid-rows .rec.current { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.grid-rows .rec.current input.item { color: #173f63; }
.grid-rows .rec.unsaved input.item:not(:disabled) { color: #1f4fd1; }
.grid-rows .rec.empty .btn { opacity: .25; }
.grid-rows .btn { height: 24px; padding: 0 8px; margin: 0 6px; font-size: 12.5px; }
.vscroll { width: 18px; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #f6f8fa; }
.vs-btn { border: none; background: transparent; color: var(--muted); font-size: 9px; height: 22px; cursor: pointer; padding: 0; }
.vs-btn:hover { color: var(--ink); background: #e9edf1; }
.vs-track { position: relative; flex: 1; cursor: pointer; }
.vs-thumb { position: absolute; left: 4px; right: 4px; min-height: 16px; border-radius: 5px; background: #b8c3ce; }
.block.grid:not(.scrollable) .vs-thumb { background: #dde3e9; }
.block.grid:not(.scrollable) .vs-btn { color: #c3cbd3; }

/* Tab pages */
.tabs { margin-top: 18px; }
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabbar button { border: 1px solid transparent; border-bottom: none; background: transparent; padding: 8px 16px; border-radius: 8px 8px 0 0;
  color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabbar button:hover { color: var(--ink); background: #f4f6f8; }
.tabbar button[aria-selected="true"] { background: #fff; border-color: var(--line); color: var(--accent); font-weight: 600; }
.tabbar button:focus { outline: none; box-shadow: 0 0 0 3px rgba(43, 93, 138, .2); }
.tabpage { border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px; padding: 16px; min-height: 196px; }
.tabpage[hidden] { display: none; }
.block.pairs > .rec { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px 28px; }
.block.pairs .field { flex-direction: row; align-items: center; gap: 12px; }
.block.pairs .field .lbl { width: 128px; flex: none; }
.block.pairs input.item { flex: 1; background: #f8fafb; }
.tabpage .block.grid .rec input.item { cursor: default; }

/* Ended */
#ended { display: flex; justify-content: center; padding-top: 40px; }
#ended[hidden] { display: none; }
.ended-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px; text-align: center; max-width: 420px; }
.ended-card h2 { margin: 0 0 8px; font-size: 20px; }
.ended-card p { color: var(--muted); margin: 0 0 18px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

/* Dialogs: alerts and lists of values */
.modal { position: fixed; inset: 0; background: rgba(20, 30, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.dialog { background: #fff; border-radius: 12px; min-width: min(340px, 100%); max-width: min(640px, 100%); box-shadow: 0 18px 50px rgba(0, 0, 0, .3); overflow: hidden; }
.dlg-title { padding: 14px 20px 0; font-weight: 700; font-size: 15px; min-height: 14px; }
.alert-body { display: flex; gap: 14px; padding: 14px 20px 18px; align-items: flex-start; }
.alert-body p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.alert-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: var(--accent-soft); color: var(--accent); }
.alert-icon:empty { display: none; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; background: #f6f8fa; border-top: 1px solid var(--line); }
.dlg-buttons button { min-width: 84px; height: 34px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; cursor: pointer; }
.dlg-buttons button:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43, 93, 138, .25); }
.dlg-buttons button:focus, .dlg-buttons button:hover { background: var(--accent-soft); }
.lov { width: 580px; }
.lov-find { display: flex; gap: 8px; align-items: center; padding: 12px 20px 0; }
.lov-find label { color: var(--muted); font-size: 13px; }
.lov-find input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 8px; }
.lov-find input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43, 93, 138, .2); }
.lov-find button { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; cursor: pointer; }
.lov-hint { margin: 6px 20px 0; font-size: 12px; color: var(--muted); }
.lov-list { max-height: min(340px, 50vh); overflow: auto; margin: 10px 20px 14px; border: 1px solid var(--line); border-radius: 8px; }
.lov table { border-collapse: collapse; width: 100%; }
.lov th { text-align: left; background: #f6f8fa; padding: 7px 10px; position: sticky; top: 0; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.lov td { padding: 6px 10px; white-space: nowrap; cursor: default; border-bottom: 1px solid #f0f2f5; }
.lov tr:hover td { background: #f6f9fc; }
.lov tr.selected td { background: var(--accent); color: #fff; }
#lov-empty { margin: 0; padding: 14px; color: var(--muted); text-align: center; }

/* Stand-in pages for the APEX application */
.apex-body { height: auto; }
.apex-main { max-width: 980px; margin: 0 auto; padding: 24px; }
.apex-note { background: #fff8e1; border: 1px solid #ecd9a0; border-radius: 8px; padding: 12px 16px; color: #4d4227; }
.apex-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; }
.apex-card h1 { margin: 0 0 6px; font-size: 22px; }
.apex-who { color: var(--muted); margin-top: 0; }
.apex-stats { display: flex; gap: 16px; padding: 0; list-style: none; flex-wrap: wrap; }
.apex-stats li { background: var(--accent-soft); border-radius: 8px; padding: 14px 20px; }
.apex-stats b { display: block; font-size: 24px; }
.apex-table { overflow-x: auto; }
.apex-table table { border-collapse: collapse; width: 100%; font-size: 13px; }
.apex-table th, .apex-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.apex-details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; }
.apex-details dt { color: var(--muted); }
.apex-details dd { margin: 0; }

/* Narrow screens: one column, the console as a strip above EMPLOYEES */
@media (max-width: 860px) {
  .fr-header { padding: 8px 14px; gap: 4px 14px; }
  .fr-nav { margin-left: 0; gap: 14px; width: 100%; }
  .fr-nav a { font-size: 13px; }
  .demo-notice { padding: 6px 14px; font-size: 12px; }
  .demo-notice .wide { display: none; }
  #main { padding: 12px; }
  #statusbar { padding: 6px 12px; }
  #mdi.with-employees { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  #mdi.with-employees > [data-window="CONSOLE"], #mdi.with-employees > [data-window="LOGIN"] { position: static; max-width: none; }
  #mdi.with-employees .form-console .brandmark { display: none; }
  #mdi.with-employees .form-console .body { padding: 10px 12px; }
  #mdi.with-employees #blk-console .rec { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  #mdi.with-employees #blk-console .btn { width: auto; flex: 1 1 auto; height: 32px; }
  #mdi.with-employees #blk-console [name="logout"] { margin-top: 0; }
  #mdi.with-employees .form-console .field.plain { width: 100%; margin: 0; padding-top: 6px; }
  .body { padding: 14px; }
  .tb-apex { margin-left: 0; }
  .block.pairs > .rec { grid-template-columns: 1fr; }
  .block.pairs .field .lbl { width: 110px; }
  .tabbar button { padding: 8px 12px; }
}
