/*
 * PaySlip Maker — web app styles (Asaan Tech free online tools).
 * The desktop app's styles, scoped under .psm so they never touch the site
 * around the tool (which has its own .btn, .badge, .dot …), with resets where
 * a site rule would otherwise leak in.
 */
.psm {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #66727f;
  --line: #dde3e9;
  --brand: #0E7A46;
  --brand-ink: #ffffff;
  --brand-soft: #e6f2ec;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --warn-soft: #fff6e5;
  --err: #c53030;
  --err-soft: #fdecec;
  --skip: #8a94a0;
  --info: #2b6cb0;
  --info-soft: #ebf4ff;
  --sel: #eaf3ee;
  --radius: 8px;

  font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
  height: min(860px, calc(100vh - 96px));
  min-height: 600px;
  position: relative;
  box-shadow: 0 18px 40px rgba(11, 21, 18, 0.08);
}
.psm *, .psm *::before, .psm *::after { box-sizing: border-box; }
.psm [hidden] { display: none !important; }
.psm .muted { color: var(--muted); }
.psm .spacer { flex: 1; }
.psm h1, .psm h2 { font-family: inherit; letter-spacing: 0; }

/* ---------- buttons & inputs ---------- */
.psm .btn {
  font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  display: inline-block; box-shadow: none; gap: 0; transition: none;
}
.psm .btn:hover:not(:disabled) { border-color: #b8c2cc; background: #fafbfc; color: var(--ink); }
.psm .btn:disabled { opacity: .5; cursor: default; }
.psm .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.psm .btn.primary:hover:not(:disabled) { background: #0B6339; color: var(--brand-ink); }
.psm .btn.ghost { background: transparent; }
.psm .btn.small { padding: 4px 10px; font-size: 12px; }
.psm .btn.icon { width: 32px; padding: 4px 0; font-size: 18px; line-height: 1; text-align: center; }
.psm input, .psm select, .psm textarea {
  font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; background: #fff;
}
.psm input:focus, .psm select:focus, .psm textarea:focus, .psm .btn:focus-visible, .psm .list:focus-visible {
  outline: 2px solid #7fb89a; outline-offset: 1px;
}
.psm .chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- top bar ---------- */
.psm .topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.psm .tb-title { font-weight: 700; font-size: 14px; margin-right: 6px; display: flex; align-items: center; gap: 8px; }
.psm .tb-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.psm .file-chip {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 12px;
}
.psm .period { display: flex; align-items: center; gap: 6px; }
.psm .period label { color: var(--muted); }
.psm .period input { width: 76px; }

/* ---------- empty state ---------- */
.psm .empty { flex: 1; display: grid; place-items: center; padding: 24px; overflow: auto; }
.psm .drop {
  width: min(640px, 100%); text-align: center; background: var(--panel); border: 2px dashed #c4ced8;
  border-radius: 14px; padding: 36px 32px;
}
.psm .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.psm .drop-icon { font-size: 40px; color: var(--brand); line-height: 1; }
.psm .drop h2 { font-size: 20px; margin: 10px 0 6px; font-weight: 700; }
.psm .drop p { color: var(--muted); margin: 0 0 14px; }
.psm .drop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.psm .privacy { margin: 18px 0 0; font-size: 12.5px; color: var(--ok); font-weight: 600; }
.psm .howto { text-align: left; color: var(--muted); margin: 18px 0 0; padding-left: 18px; }
.psm .howto li { margin: 4px 0; }
.psm .setup-hint {
  margin: 10px 12px 0; background: var(--info-soft); border: 1px solid #c6dcf5; border-radius: 6px;
  padding: 7px 10px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; justify-content: space-between;
}

/* ---------- workspace ---------- */
.psm .workspace { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.psm .sidebar {
  display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line);
}
.psm .file-issues { margin: 12px 12px 0; }
.psm .file-issues .issue { margin: 0 0 6px; }
.psm .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 12px 6px; }
.psm .stat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; cursor: pointer; background: #fff;
  text-align: left; font: inherit; color: inherit;
}
.psm .stat .n { font-size: 17px; font-weight: 700; }
.psm .stat .l { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.psm .stat.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: var(--brand-soft); }
.psm .totals-line { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding: 2px 2px 0; }
.psm .totals-line b { color: var(--ink); }
.psm .filters { display: grid; grid-template-columns: 1fr 130px; gap: 6px; padding: 6px 12px; }
.psm .filters input, .psm .filters select { min-width: 0; }
.psm .list-head {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 14px;
  border-bottom: 1px solid var(--line); font-size: 12px;
}
.psm .list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.psm .list .office {
  position: sticky; top: 0; z-index: 1; background: #f0f3f6; color: var(--muted); font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 5px 14px; border-bottom: 1px solid var(--line);
}
.psm .list .emp {
  display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center;
  padding: 7px 14px; border-bottom: 1px solid #eef1f4; cursor: pointer;
}
.psm .list .emp:hover { background: #f8fafb; }
.psm .list .emp.current { background: var(--sel); box-shadow: 3px 0 0 var(--brand) inset; }
.psm .emp .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psm .emp .ds { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psm .emp .rt { text-align: right; }
.psm .emp .net { font-variant-numeric: tabular-nums; font-weight: 600; }
.psm .badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; margin-top: 2px; border: 0;
}
.psm .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: transparent; }
.psm .s-ok { color: var(--ok); } .psm .s-ok .dot, .psm .dot.s-ok { background: var(--ok); }
.psm .s-warning { color: var(--warn); } .psm .s-warning .dot, .psm .dot.s-warning { background: var(--warn); }
.psm .s-error { color: var(--err); } .psm .s-error .dot, .psm .dot.s-error { background: var(--err); }
.psm .s-skip { color: var(--skip); } .psm .s-skip .dot, .psm .dot.s-skip { background: var(--skip); }
.psm .badge.s-ok { background: #e7f5ec; } .psm .badge.s-warning { background: var(--warn-soft); }
.psm .badge.s-error { background: var(--err-soft); } .psm .badge.s-skip { background: #eef0f2; }
.psm .no-results { padding: 24px; text-align: center; color: var(--muted); }

/* ---------- preview ---------- */
.psm .center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.psm .preview-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.psm .who-title { margin-left: 6px; min-width: 0; flex: 1 1 160px; }
.psm .pv-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psm .pv-sub { font-size: 12px; }
.psm .pv-totals { display: flex; gap: 18px; font-variant-numeric: tabular-nums; }
.psm .pv-totals div { text-align: right; }
.psm .pv-totals .k { font-size: 11px; color: var(--muted); }
.psm .pv-totals .v { font-weight: 700; }
.psm .emp-issues { padding: 0 16px; }
.psm .emp-issues:not(:empty) { padding-top: 10px; }
.psm .issue {
  display: flex; gap: 8px; align-items: flex-start; border-radius: 6px; padding: 7px 10px; margin-bottom: 6px; font-size: 12.5px;
  border: 1px solid transparent;
}
.psm .issue .tag { font-weight: 700; font-size: 10.5px; text-transform: uppercase; padding-top: 1px; flex: none; width: 58px; }
.psm .issue.error { background: var(--err-soft); border-color: #f5c2c2; }
.psm .issue.error .tag { color: var(--err); }
.psm .issue.warning { background: var(--warn-soft); border-color: #f3dcae; }
.psm .issue.warning .tag { color: var(--warn); }
.psm .issue.info { background: var(--info-soft); border-color: #c6dcf5; }
.psm .issue.info .tag { color: var(--info); }
.psm .issue.skip { background: #f0f2f4; border-color: #dfe3e7; }
.psm .issue.skip .tag { color: var(--skip); }
.psm .paper-wrap { flex: 1; overflow: auto; padding: 18px; display: flex; justify-content: center; min-height: 0; }
.psm .paper {
  flex: none; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
  transform-origin: top center; overflow: hidden;
}
.psm .paper iframe { width: 794px; height: 1123px; border: 0; display: block; transform-origin: top left; }

/* ---------- dialogs ---------- */
.psm .dlg {
  border: 0; border-radius: 12px; padding: 0; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3);
  color: var(--ink); font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
.psm .dlg.wide { width: min(820px, 96vw); }
.psm .dlg::backdrop { background: rgba(15, 25, 35, .45); }
.psm .dlg form { padding: 20px 22px 18px; }
.psm .dlg h2 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.psm .dlg .dlg-note { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.psm .dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.psm .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; max-height: 60vh; overflow: auto; padding: 2px; }
.psm .field { display: flex; flex-direction: column; gap: 4px; }
.psm .field.span2 { grid-column: span 2; }
.psm .field > label { font-weight: 600; font-size: 12px; }
.psm .field small { color: var(--muted); font-size: 11px; }
.psm .field textarea { resize: vertical; font-family: inherit; }
.psm .field.checks { justify-content: center; gap: 8px; }
.psm .logo-pick { display: flex; align-items: center; gap: 8px; }
.psm .logo-pick img, .psm .logo-pick .none {
  width: 54px; height: 54px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.psm .logo-pick .none { display: grid; place-items: center; font-size: 10.5px; color: var(--muted); text-align: center; }
.psm .setup-account { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.psm .setup-account h3 { margin: 0 0 8px; font: inherit; font-size: 13.5px; font-weight: 700; letter-spacing: 0; }
.psm .setup-account h3 .muted { font-weight: 400; }
.psm .radios { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.psm .radios legend { font-weight: 600; font-size: 12px; padding: 0 4px; }
.psm .radios small { color: var(--muted); margin-left: 22px; margin-top: -4px; font-size: 11.5px; }
.psm .callout { border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin: 8px 0; }
.psm .callout.warn { background: var(--warn-soft); border: 1px solid #f3dcae; }
.psm .progress { margin-top: 14px; }
.psm .progress .bar { height: 8px; background: #e7ebef; border-radius: 99px; overflow: hidden; }
.psm .progress .bar div { height: 100%; width: 0; background: var(--brand); transition: width .15s; }
.psm .progress .muted { margin-top: 6px; font-size: 12px; }

.psm-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #1f2a35; color: #fff;
  padding: 9px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 60; max-width: min(70vw, 560px);
  font: 13px/1.4 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
.psm-toast.error { background: var(--err, #c53030); }

/* ---------- narrow screens: list above preview, page scrolls ---------- */
@media (max-width: 900px) {
  .psm { height: auto; min-height: 0; }
  .psm .workspace { grid-template-columns: 1fr; }
  .psm .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: 440px; }
  .psm .center { min-height: 520px; }
  .psm .grid2 { grid-template-columns: 1fr; }
  .psm .field.span2 { grid-column: auto; }
  .psm .file-chip { max-width: 100%; }
}
