:root {
  --bg: #f4f6fa; --panel: #ffffff; --text: #1f2937; --muted: #6b7280; --border: #e5e7eb;
  --primary: #2563eb; --primary-d: #1d4ed8; --side: #0f172a; --side-t: #cbd5e1; --side-h: #1e293b;
  --red: #dc2626; --orange: #ea580c; --yellow: #ca8a04; --green: #16a34a; --blue: #2563eb; --gray: #6b7280; --purple: #7c3aed;
  --radius: 10px;
  font-family: "Noto Sans Thai", "Sarabun", "Leelawadee UI", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-t); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; padding: 4px 8px 14px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--side-t); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding: 14px 10px 6px; }
.nav a { display: flex; gap: 10px; align-items: center; color: var(--side-t); padding: 7px 10px; border-radius: 7px; text-decoration: none; }
.nav a:hover { background: var(--side-h); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .ic { width: 18px; text-align: center; opacity: .9; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .user { display: flex; gap: 12px; align-items: center; }
.content { padding: 22px 24px 60px; max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .iso { font-size: 12px; color: var(--muted); margin-top: 4px; }
.btn.menu-btn { display: none; }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-size: 28px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi.red .v { color: var(--red); } .kpi.orange .v { color: var(--orange); } .kpi.green .v { color: var(--green); } .kpi.blue .v { color: var(--blue); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.success { background: var(--green); color: #fff; border-color: var(--green); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea { font: inherit; width: 100%; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; min-height: 70px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #374151; font-weight: 500; }
label.f .req { color: var(--red); }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.ro { padding: 7px 10px; background: #f9fafb; border: 1px dashed var(--border); border-radius: 7px; min-height: 34px; white-space: pre-wrap; word-break: break-word; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.chk { flex-direction: row !important; align-items: center; gap: 8px !important; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 16px; background: #fff; }
legend { font-weight: 600; padding: 0 6px; color: #111827; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f9fafb; position: sticky; top: 0; cursor: pointer; user-select: none; white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f8fafc; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: #374151; white-space: nowrap; }
.b-red { background: #fee2e2; color: #991b1b; } .b-orange { background: #ffedd5; color: #9a3412; }
.b-yellow { background: #fef9c3; color: #854d0e; } .b-green { background: #dcfce7; color: #166534; }
.b-blue { background: #dbeafe; color: #1e40af; } .b-gray { background: #f3f4f6; color: #4b5563; } .b-purple { background: #ede9fe; color: #5b21b6; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.side-panel { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 70px; }
.comment { border-bottom: 1px solid var(--border); padding: 8px 0; }
.comment .meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.comment.internal { background: #fffbeb; margin: 0 -8px; padding: 8px; border-radius: 6px; }
.scroll { max-height: 360px; overflow: auto; }
.hist { font-size: 12px; border-left: 2px solid var(--border); padding: 4px 0 8px 10px; }
.hist b { color: #111827; }
.hist .chg { color: var(--muted); word-break: break-word; }

.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.bar { height: 10px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bar.red > span { background: var(--red); } .bar.orange > span { background: var(--orange); } .bar.yellow > span { background: var(--yellow); } .bar.green > span { background: var(--green); }

.heat { display: grid; grid-template-columns: 26px repeat(5, 1fr); gap: 3px; font-size: 12px; }
.heat .cell { aspect-ratio: 1.6; border-radius: 5px; display: grid; place-items: center; font-weight: 700; color: #111; }
.heat .ax { display: grid; place-items: center; color: var(--muted); }
.h-low { background: #bbf7d0; } .h-med { background: #fde68a; } .h-high { background: #fdba74; } .h-crit { background: #fca5a5; }
.legend { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.spark span { flex: 1; background: #93c5fd; border-radius: 3px 3px 0 0; min-height: 2px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 11px 16px; border-radius: 8px; z-index: 100; max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--red); }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 12px; max-height: 90vh; overflow: auto; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f172a, #1e3a8a); padding: 16px; }
.login { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login .banner { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 10px; border-radius: 8px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
details summary { cursor: pointer; color: var(--primary); }
pre { white-space: pre-wrap; word-break: break-word; background: #f9fafb; padding: 8px; border-radius: 6px; font-size: 12px; margin: 6px 0 0; }

@media print {
  .sidebar, .topbar, .no-print, .toolbar, .pager { display: none !important; }
  .layout { display: block; } .content { padding: 0; } .table-wrap { border: 0; overflow: visible; }
  th { position: static; }
}
@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; } .side-panel { position: static; }
  .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 260px; left: -270px; transition: left .2s; }
  .sidebar.open { left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .g4, .g3, .g2, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
}

/* utilities */
.u0 { color:#111; }
.u1 { display:flex;flex-direction:column;gap:12px; }
.u2 { justify-content:space-between; }
.u3 { margin-bottom:14px; }
.u4 { margin-bottom:8px; }
.u5 { margin-top:10px; }
.u6 { margin-top:10px;display:flex;flex-direction:column;gap:8px; }
.u7 { margin-top:16px; }
.u8 { margin-top:24px; }
.u9 { margin-top:8px; }
.u10 { width:140px; }

/* roles & permissions */
.center { text-align: center; }
.yes { color: var(--green); font-weight: 700; }
table.perm td, table.perm th { vertical-align: middle; }
table.perm select { min-width: 210px; }
.role-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.role-tab { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); text-decoration: none; }
.role-tab:hover { text-decoration: none; background: #f9fafb; }
.role-tab.active { border-color: var(--primary); background: #eff6ff; color: var(--primary-d); font-weight: 600; }
.perm-pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.perm-page { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.perm-page.on { border-color: #bbf7d0; background: #f0fdf4; }
.u14 { margin-bottom: 14px; }
@media (max-width: 1100px) { .perm-pages { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .perm-pages { grid-template-columns: 1fr; } }
.no { color: var(--red); font-weight: 700; }

/* MSSP / projects / E-Memo */
.cust-sel { width: auto; min-width: 220px; padding: 5px 8px; font-size: 13px; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.chk-grid { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.flow { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 10px; }
.flow-step { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.flow-step .lvl { width: 30px; height: 30px; border-radius: 50%; background: #e5e7eb; display: grid; place-items: center; font-weight: 700; }
.flow-step.done { border-color: #bbf7d0; background: #f0fdf4; } .flow-step.done .lvl { background: var(--green); color: #fff; }
.flow-step.now { border-color: #fde68a; background: #fffbeb; } .flow-step.now .lvl { background: var(--orange); color: #fff; }
.flow-mini { margin: 0; padding-left: 18px; }
.step-row { display: grid; grid-template-columns: 20px 1.4fr 1fr 1.2fr 110px auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.modal:has(#fl_steps) { max-width: 980px; }
.memo-paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 40px 48px; border: 1px solid var(--border); font-size: 15px; line-height: 1.7; }
.memo-title { text-align: center; font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.memo-head { margin-bottom: 12px; } .memo-head td { border: 0; padding: 4px 0; }
.memo-body { white-space: pre-wrap; text-indent: 2.5em; margin: 8px 0 16px; }
.memo-sign { text-align: right; margin: 24px 0; }
.memo-appr th, .memo-appr td { border: 1px solid var(--border); font-size: 13px; }
@media print { .memo-paper { border: 0; padding: 0; } }
@media (max-width: 760px) { .step-row { grid-template-columns: 1fr; } .cust-sel { min-width: 0; max-width: 160px; } }

/* E-Memo tracking */
.track-banner { border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px; padding: 10px 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.track-banner.late { border-color: #fecaca; background: #fef2f2; }
.track-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 13px; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i, i.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #e5e7eb; border: 1px solid #d1d5db; }
.dots i.d-done, i.dot.d-done { background: var(--green); border-color: var(--green); }
.dots i.d-now, i.dot.d-now { background: var(--orange); border-color: var(--orange); box-shadow: 0 0 0 3px #ffedd5; }
.dots i.d-bad { background: var(--red); border-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 99px; padding: 5px 12px; color: var(--text); font-size: 13px; text-decoration: none; }
.chip:hover { text-decoration: none; background: #f9fafb; }
.chip.on { border-color: var(--primary); background: #eff6ff; color: var(--primary-d); }
.chip.late b { color: var(--red); }
.u10w { width: 260px; }

/* settings categories */
.settings-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-bar .f { min-width: 340px; }
.settings-bar select { font-size: 15px; padding: 9px 12px; }
.with-unit { display: flex; align-items: center; gap: 6px; } .with-unit input { width: 120px; } .with-unit span { color: var(--muted); font-size: 13px; }
.sla-table td { vertical-align: middle; }
@media (max-width: 760px) { .settings-bar .f { min-width: 0; width: 100%; } }
.mfa-enroll { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.mfa-qr { width: 200px; height: 200px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.mfa-enroll ol { flex: 1; min-width: 220px; margin: 0; padding-left: 18px; line-height: 1.8; }
.sla-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.sla-block h3 { font-size: 14px; }
.num-table input, .num-table select { min-width: 0; }
.num-table .n-prefix { width: 90px; } .num-table .n-digits { width: 70px; } .num-table .n-reset { width: 190px; } .num-table .n-pattern { width: 220px; } .num-table .n-next { width: 90px; padding: 3px 6px; }
@media (max-width: 1100px) { .sla-grid { grid-template-columns: 1fr; } }

/* company logo */
.login-logo { display: flex; justify-content: center; }
.login-logo img { max-width: 220px; max-height: 180px; width: auto; height: auto; filter: drop-shadow(0 6px 14px rgba(15, 23, 42, .25)); }
.login-title { text-align: center; font-size: 20px; font-weight: 700; color: #111827; }
.login-title small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.brand-logo { max-width: 96px; max-height: 44px; width: auto; height: auto; flex-shrink: 0; }
/* settings: logo & branding */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.brand-card h3 { margin: 0 0 2px; }
.brand-prev { display: flex; gap: 10px; margin: 12px 0 8px; }
.brand-prev > div { flex: 1; min-height: 120px; display: grid; place-items: center; border-radius: 10px; padding: 12px; border: 1px solid var(--border); }
.bp-light { background: #f8fafc; }
.bp-dark { background: var(--side); }
.brand-prev img { max-width: 100%; max-height: 110px; width: auto; height: auto; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* settings: category button menu */
.set-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.set-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font: inherit; color: var(--text); text-align: left; cursor: pointer; line-height: 1.3; }
.set-btn:hover { border-color: #93c5fd; background: #f8fbff; }
.set-btn.active { border-color: var(--primary); background: #eff6ff; color: var(--primary-d); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.set-ic { font-size: 20px; width: 26px; text-align: center; flex: none; }
.set-save { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: -4px 0 12px; }
@media (max-width: 760px) { .set-menu { grid-template-columns: 1fr 1fr; } }
.psize { width: auto; display: inline-block; padding: 3px 6px; margin: 0 4px; font-size: 13px; }

/* ---------- advanced protection panel (SOC) ---------- */
.prot h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.prot .list-plain li { gap: 10px; }
.prot .list-plain li > span:last-child { text-align: right; }
.prot.alarm { border-color: #dc2626; box-shadow: 0 0 0 2px #fecaca; }
.prot-grid { align-items: start; }

/* ---------- contract document panel ---------- */
.ctr-doc .ctr-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; }
.ctr-doc h3 { margin: 0 0 4px; }
.ctr-doc h4 { margin-bottom: 6px; }

/* ---------- tabbed record page (contracts) ---------- */
.rec-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 14px; }
.rec-tab { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font: inherit; text-align: left; cursor: pointer; line-height: 1.25; }
.rec-tab > span:nth-child(3) { flex: 1; min-width: 0; }
.rec-tab:hover { border-color: #c7d2fe; background: #f5f7ff; }
.rec-tab.active { border-color: var(--primary); background: #eef2ff; color: var(--primary-d); font-weight: 600; box-shadow: 0 0 0 1px var(--primary) inset; }
.rec-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rt-no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #e5e7eb; color: #374151; font-size: 11px; font-weight: 600; }
.rec-tab.active .rt-no { background: var(--primary); color: #fff; }
.rt-err { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; }
.tab-panel { min-height: 200px; min-width: 0; }
#recForm { min-width: 0; }
.tab-steps { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0 4px; border-top: 1px dashed var(--border); margin-top: 4px; }
.tab-steps .btn:disabled { visibility: hidden; }
.split-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.split-cols fieldset { margin: 0; }
.split-cols .form-grid { grid-template-columns: 1fr; }
.prefill-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }
.ctr-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.cs-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cs-l { font-size: 11.5px; color: var(--muted); }
.cs-v { font-weight: 600; overflow-wrap: anywhere; }
.cs-act { display: flex; justify-content: flex-end; }
.item-add { display: grid; grid-template-columns: minmax(180px, 1fr) 80px 200px auto auto; gap: 8px; align-items: center; margin-top: 10px; }
.item-add input, .item-add select { width: 100%; }
@media (max-width: 900px) {
  .split-cols { grid-template-columns: 1fr; }
  .item-add { grid-template-columns: 1fr 80px; }
  .item-add select, .item-add .btn { grid-column: 1 / -1; }
  .rec-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rt-no { display: none; }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .topbar .user { flex-wrap: wrap; }
}
.perm-group { margin-bottom: 12px; }
.perm-group h4 { margin: 10px 0 6px; font-size: 13px; color: var(--muted); }
.badge.small { font-size: 10.5px; padding: 1px 6px; }

/* ---------- customer service onboarding checklist ---------- */
.svc-panel { margin-bottom: 16px; border-left: 4px solid var(--orange); }
.svc-panel.ok { border-left-color: var(--green); }
.svc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; }
.svc-head h3 { margin: 0 0 4px; }
.svc-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.svc-steps li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fafafa; }
.svc-steps li.ok { background: #f0fdf4; border-color: #bbf7d0; }
.svc-steps li.now { background: #fff7ed; border-color: #fed7aa; }
.svc-dot { flex: 0 0 auto; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cbd5e1; font-size: 11px; color: #fff; }
.svc-steps li.ok .svc-dot { background: var(--green); border-color: var(--green); }
.svc-steps li.now .svc-dot { border-color: var(--orange); }
.hint.no { color: var(--red); }

/* ---------- language switcher ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.lang-btn { border: 0; background: none; padding: 4px 10px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.lang-btn + .lang-btn { border-left: 1px solid var(--border); }
.lang-btn.active { background: var(--primary); color: #fff; font-weight: 600; }
.lang-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.login .lang-switch { float: right; margin: -4px -4px 0 0; }
.login .lang-switch { display: flex; width: max-content; margin: 0 0 4px auto; float: none; }

/* privacy notice (PDPA / GDPR) */
.privacy-text { white-space: pre-wrap; word-break: break-word; max-height: 55vh; overflow-y: auto; line-height: 1.6; font-size: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; align-self: center; }

/* change calendar (ITIL change schedule) */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day { min-height: 92px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.empty { background: transparent; border: 0; }
.cal-day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-n { font-size: 12px; color: var(--muted); }
.cal-ev { display: block; font-size: 11px; line-height: 1.3; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.ev-nor { background: #dbeafe; color: #1e3a8a; } .ev-std { background: #dcfce7; color: #14532d; } .ev-em { background: #fee2e2; color: #7f1d1d; }
.cal-ev.conflict { outline: 2px solid #f59e0b; }
.cal-legend { display: flex; gap: 8px; flex-wrap: wrap; } .cal-legend .cal-ev { display: inline-block; }
.cal-title { align-self: center; min-width: 140px; text-align: center; }
.grid.g5 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 760px) { .cal-day { min-height: 60px; } .cal-ev { font-size: 10px; } }
