/* Plazma ERP — industrial, dense, readable. No external fonts (works offline / behind cPanel). */
:root {
  --bg: #eef1f5; --panel: #ffffff; --ink: #18212d; --ink-2: #334155; --muted: #64748b; --line: #dbe1ea; --line-2: #e9edf3;
  --brand: #1f3a5f; --brand-2: #28507f; --brand-soft: #e7eef7; --side: #132238; --side-2: #1b2f4a; --side-ink: #c9d5e5;
  --accent: #c2410c; --ok: #15803d; --ok-soft: #e7f5ec; --warn: #a16207; --warn-soft: #fdf4e3; --danger: #b91c1c; --danger-soft: #fdeceb;
  --info-soft: #e8f0fb; --radius: 6px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 13.5px/1.45 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------------- shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.brand { padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; gap: 10px; align-items: center; }
.brand .logo { width: 34px; height: 34px; border-radius: 7px; background: linear-gradient(135deg, #f59e0b, #c2410c); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex: none; overflow: hidden; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand .co { color: #fff; font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.brand .prod { font-size: 11px; color: #8ea3bf; letter-spacing: .04em; text-transform: uppercase; }
.nav-search { margin: 10px 12px 6px; }
.nav-search input { width: 100%; background: var(--side-2); border: 1px solid rgba(255,255,255,.08); color: #fff; border-radius: 5px; padding: 7px 9px; font: inherit; font-size: 12.5px; }
.nav-search input::placeholder { color: #7f93ad; }
.nav { overflow-y: auto; flex: 1; padding: 4px 8px 16px; scrollbar-width: thin; scrollbar-color: #2a4061 transparent; }
.nav-group { margin-top: 6px; }
.nav-group > button { all: unset; display: flex; justify-content: space-between; align-items: center; width: 100%; box-sizing: border-box; cursor: pointer; padding: 7px 8px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #8094ae; font-weight: 650; }
.nav-group > button:hover { color: #c7d4e6; }
.nav-group > button .chev { transition: transform .15s; font-size: 10px; }
.nav-group.collapsed > button .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 5px; color: var(--side-ink); font-size: 13px; text-decoration: none; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: #26446b; color: #fff; box-shadow: inset 3px 0 0 #f59e0b; }
.nav a .code { margin-left: auto; font-family: var(--mono); font-size: 10px; color: #6f86a5; }
.side-foot { border-top: 1px solid rgba(255,255,255,.07); padding: 10px 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { color: #8ea3bf; font-size: 11px; }
.side-foot button { background: transparent; border: 1px solid rgba(255,255,255,.15); color: var(--side-ink); border-radius: 5px; padding: 5px 8px; cursor: pointer; font: inherit; font-size: 11.5px; }
.side-foot button:hover { background: var(--side-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: 10px 22px; display: flex; align-items: center; gap: 14px; min-height: 56px; }
.top .menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; cursor: pointer; font-size: 16px; }
.top .crumbs { font-size: 12px; color: var(--muted); }
.top .crumbs a { color: var(--muted); }
.top h1 { font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top .tactions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 18px 22px 60px; max-width: 1500px; width: 100%; }

/* ---------------- buttons, inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); padding: 6px 12px; border-radius: 5px; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.35; }
.btn:hover { background: #f6f8fb; border-color: #c8d0dc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-accent { background: #fff7ed; border-color: #fed7aa; color: var(--accent); }
.btn-accent:hover { background: #ffedd5; }
.btn-danger { color: var(--danger); border-color: #f3c4c0; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--brand-soft); border-color: transparent; }
input, select, textarea { font: inherit; color: var(--ink); }
.in, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, .filters input, .filters select {
  width: 100%; border: 1px solid #cfd7e3; border-radius: 5px; padding: 6px 8px; background: #fff; font-size: 13px; min-height: 32px;
}
.field textarea { min-height: 64px; resize: vertical; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus, .grid-table input:focus, .grid-table select:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(40, 80, 127, .14);
}
.field input[readonly], .field textarea[readonly], .grid-table input[readonly], .field .ro {
  background: #f4f6f9; color: #334155; border-color: #e2e7ee;
}
.field .ro { border: 1px solid #e2e7ee; border-radius: 5px; padding: 6px 8px; min-height: 32px; white-space: pre-wrap; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; letter-spacing: .01em; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field label .auto { font-weight: 500; color: var(--muted); font-size: 10.5px; margin-left: 4px; text-transform: uppercase; letter-spacing: .04em; }
.field .help { font-size: 11px; color: var(--muted); margin-top: 3px; }
.field.wide { grid-column: 1 / -1; }

/* ---------------- cards / layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-h { padding: 11px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-h h3 { font-size: 13.5px; color: var(--ink-2); }
.card-h .sp { margin-left: auto; display: flex; gap: 6px; }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.purpose { color: var(--muted); font-size: 12.5px; margin: -4px 0 14px; }
.chip { display: inline-block; font-family: var(--mono); font-size: 10.5px; background: var(--brand-soft); color: var(--brand); border-radius: 4px; padding: 1px 6px; font-weight: 600; vertical-align: middle; }

/* ---------------- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #f8fafc; position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: #f6f9fd; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 650; background: #f8fafc; border-top: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 34px 12px !important; }

.grid-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grid-table th { background: #f3f6fa; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px; text-align: left; border: 1px solid var(--line-2); white-space: nowrap; }
.grid-table td { border: 1px solid var(--line-2); padding: 3px; vertical-align: middle; }
.grid-table td.rn { width: 30px; text-align: center; color: var(--muted); font-size: 11px; }
.grid-table input, .grid-table select { width: 100%; border: 1px solid transparent; background: transparent; padding: 5px 6px; border-radius: 4px; font-size: 12.5px; min-height: 30px; }
.grid-table input:hover, .grid-table select:hover { border-color: #d5dde8; background: #fff; }
.grid-table input[readonly] { border-color: transparent; }
.grid-table input.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid-table td.x { width: 32px; text-align: center; }
.grid-table td.x button { border: 0; background: none; color: #9aa6b6; cursor: pointer; font-size: 16px; line-height: 1; padding: 4px; }
.grid-table td.x button:hover { color: var(--danger); }
.grid-foot { padding: 8px 10px; display: flex; gap: 8px; align-items: center; }

/* ---------------- badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef1f5; color: #475569; white-space: nowrap; border: 1px solid #e2e7ee; }
.b-ok { background: var(--ok-soft); color: var(--ok); border-color: #c6e8d2; }
.b-warn { background: var(--warn-soft); color: var(--warn); border-color: #f2dfb5; }
.b-danger { background: var(--danger-soft); color: var(--danger); border-color: #f5c9c5; }
.b-info { background: var(--info-soft); color: var(--brand-2); border-color: #cddcf1; }
.b-dark { background: #1f2937; color: #fff; border-color: #1f2937; }

/* ---------------- filters / pager */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.filters input[type=search] { max-width: 260px; }
.filters input[type=date] { width: 150px; }
.filters select { width: auto; min-width: 150px; }
.filters label.chk { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.pager { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 12.5px; color: var(--muted); }
.pager .sp { margin-left: auto; display: flex; gap: 6px; }

/* ---------------- alerts, toast, modal */
.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }
.alert-error { background: var(--danger-soft); border-color: #f5c9c5; color: #7f1d1d; }
.alert-warn { background: var(--warn-soft); border-color: #f2dfb5; color: #713f12; }
.alert-info { background: var(--info-soft); border-color: #cddcf1; color: #1e3a5f; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast { padding: 10px 14px; border-radius: 6px; color: #fff; background: #1f2937; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px; animation: tin .18s ease-out; }
.toast.ok { background: #166534; } .toast.err { background: #991b1b; } .toast.warn { background: #92400e; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 900; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 8px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal.lg { width: min(980px, 100%); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-h h3 { font-size: 15px; }
.modal-b { padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------- view page */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.kv > div { padding: 8px 0; border-bottom: 1px dashed var(--line-2); min-width: 0; }
.kv > div.wide { grid-column: 1 / -1; }
.kv dt { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.next-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.links-list { display: flex; flex-direction: column; gap: 10px; }
.links-list .lg { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; margin-bottom: 4px; }
.links-list a.doc { display: inline-flex; gap: 6px; align-items: center; margin: 0 6px 6px 0; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 12.5px; background: #fafbfd; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.sig-img { max-height: 70px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.checklist { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.checklist td { padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.checklist td:first-child { width: 42%; }
.checklist select { width: 110px; min-height: 28px; border: 1px solid #d5dde8; border-radius: 4px; padding: 2px 4px; }
.checklist input { width: 100%; min-height: 28px; border: 1px solid #d5dde8; border-radius: 4px; padding: 2px 6px; }
.ms { display: flex; flex-wrap: wrap; gap: 6px; }
.ms label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfd7e3; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; background: #fff; font-weight: 500; margin: 0; color: var(--ink-2); }
.ms label.on { background: var(--brand-soft); border-color: #b9cbe3; color: var(--brand); }
.ms input { margin: 0; }
.sig { display: flex; gap: 8px; align-items: flex-end; }
.sig canvas { border: 1px dashed #b8c3d3; border-radius: 5px; background: #fff; touch-action: none; cursor: crosshair; width: 100%; max-width: 340px; height: 96px; }
.filebox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filebox .fname { font-size: 12.5px; }

/* ---------------- dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: block; text-decoration: none !important; color: inherit; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile:hover { border-color: #b9c7da; transform: translateY(-1px); }
.tile .v { font-size: 26px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.tile .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #c3d0e2; }
.tile.warn::before { background: #f59e0b; } .tile.danger::before { background: #dc2626; }
.flow { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.flow a { padding: 4px 9px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); font-weight: 600; text-decoration: none; }
.flow a:hover { background: #d6e2f1; }
.flow .ar { color: #94a3b8; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 50px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { background: #eef2f7; border-radius: 3px; height: 14px; overflow: hidden; }
.bar-fill { background: var(--brand-2); height: 100%; border-radius: 3px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

/* ---------------- trace */
.trace { position: relative; padding-left: 22px; }
.trace::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: #d3dce8; }
.tstage { position: relative; padding: 4px 0 14px; }
.tstage::before { content: ''; position: absolute; left: -20px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand-2); }
.tstage.none::before { border-color: #c3ccd8; }
.tstage h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-bottom: 5px; }
.tstage.none h4 { color: #94a3b8; }
.tdoc { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: #fff; padding: 5px 9px; border-radius: 5px; margin: 0 6px 6px 0; font-size: 12.5px; }

/* ---------------- roles matrix */
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix tr.grp td { background: #f3f6fa; font-weight: 650; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------------- login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--side); color: #dbe5f2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background-image: radial-gradient(circle at 20% 20%, rgba(245,158,11,.12), transparent 40%), radial-gradient(circle at 80% 80%, rgba(59,130,246,.12), transparent 45%); }
.login-art h1 { color: #fff; font-size: 30px; line-height: 1.2; max-width: 460px; }
.login-art .chain { font-family: var(--mono); font-size: 12px; color: #9fb3cf; line-height: 2; max-width: 520px; }
.login-box { display: grid; place-items: center; padding: 32px; }
.login-box form { width: min(360px, 100%); }
.login-box h2 { font-size: 20px; margin-bottom: 4px; }
.login-box .field { margin-top: 14px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 9px; }

/* ---------------- responsive */
@media (max-width: 1100px) { .cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .top .menu-btn { display: inline-block; }
  .top { padding: 10px 14px; }
  .content { padding: 14px 12px 60px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

/* ---------------- print */
.print-page { background: #fff; color: #000; max-width: 210mm; margin: 0 auto; padding: 10mm 12mm; font-size: 11.5px; line-height: 1.35; }
.print-bar { position: sticky; top: 0; background: #1f2937; color: #fff; padding: 8px 14px; display: flex; gap: 10px; align-items: center; z-index: 5; }
.print-bar .btn { background: #fff; }
.pdoc table { width: 100%; border-collapse: collapse; }
.pdoc td, .pdoc th { border: 1px solid #333; padding: 4px 6px; vertical-align: top; }
.pdoc th { background: #eee; font-weight: 700; text-align: left; font-size: 10.5px; }
.pdoc .nob td, .pdoc .nob th { border: 0; }
.pdoc .hdr { display: flex; gap: 12px; align-items: center; border: 1px solid #333; border-bottom: 0; padding: 8px 10px; }
.pdoc .hdr img { height: 52px; max-width: 110px; object-fit: contain; }
.pdoc .hdr .co { font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.pdoc .hdr .meta { margin-left: auto; text-align: right; font-size: 10px; }
.pdoc .ttl { border: 1px solid #333; border-bottom: 0; text-align: center; font-weight: 800; font-size: 14px; letter-spacing: .12em; padding: 5px; background: #f1f1f1; }
.pdoc .num { text-align: right; }
.pdoc .lbl { font-size: 9.5px; color: #444; display: block; }
.pdoc .sigs td { height: 64px; vertical-align: bottom; text-align: center; font-size: 10.5px; }
.pdoc .sigs img { max-height: 46px; display: block; margin: 0 auto 2px; }
.pdoc .small { font-size: 10px; }
.pdoc .terms { white-space: pre-wrap; font-size: 10px; }
.pdoc .foot { display: flex; justify-content: space-between; font-size: 9.5px; color: #444; margin-top: 6px; }
@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; }
  .print-bar, .no-print { display: none !important; }
  .print-page { padding: 0; max-width: none; }
}
