/* =====================================================================
   RIG-MAX — Maintenance Management System · UI stylesheet
   Design tokens → layout → components → modules → print
   ===================================================================== */
:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e3e8f1;
  --border-strong: #cfd7e4;
  --text: #0f1b2d;
  --text-2: #3b4a60;
  --muted: #6b7a90;
  --primary: #1d5fe0;
  --primary-600: #174fc0;
  --primary-50: #eaf1ff;
  --success: #15a05a;
  --success-50: #e6f7ee;
  --warning: #d98a04;
  --warning-50: #fff5e0;
  --danger: #e0392f;
  --danger-50: #fdecea;
  --info: #0e8fc2;
  --info-50: #e3f5fc;
  --violet: #6d4fe0;
  --violet-50: #efebff;
  --neutral-50: #eef1f6;
  --sidebar: #0a1e3c;
  --sidebar-2: #102a4f;
  --sidebar-text: #b7c4da;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 4px 16px rgba(16, 32, 64, .05);
  --shadow-lg: 0 12px 40px rgba(16, 32, 64, .18);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #121b2d;
  --surface-2: #0f1728;
  --border: #22304a;
  --border-strong: #2d3d5c;
  --text: #e7edf7;
  --text-2: #c2cde0;
  --muted: #8a99b3;
  --primary: #4d86f5;
  --primary-600: #3b74e6;
  --primary-50: #16284a;
  --success-50: #0f2e22;
  --warning-50: #33260b;
  --danger-50: #3a1714;
  --info-50: #0b2a38;
  --violet-50: #221a42;
  --neutral-50: #1a2438;
  --sidebar: #070f1d;
  --sidebar-2: #0e1a30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.hidden { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #2f7bff, #1d4fc4); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(29,95,224,.45); }
.brand-logo .ico { width: 22px; height: 22px; color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: .04em; }
.brand-text small { color: var(--sidebar-text); font-size: 11.5px; }
.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6f82a3; padding: 14px 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(29,95,224,.35); }
.sidebar-foot { font-size: 11px; color: #5d7194; padding: 12px 20px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-backdrop { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.global-search { flex: 1; max-width: 420px; position: relative; display: flex; align-items: center; }
.global-search .ico { position: absolute; left: 12px; color: var(--muted); width: 16px; height: 16px; }
.global-search input[type=search] { width: 100%; padding: 9px 12px 9px 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--neutral-50); }
.dot-count { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 8px 4px 4px; border-radius: 12px; cursor: pointer; color: var(--text); font: inherit; text-align: left; }
.user-chip:hover { background: var(--neutral-50); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #3d7bf0, #6d4fe0); color: #fff; font-weight: 700; font-size: 12.5px; display: grid; place-items: center; flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); }
.content { padding: 24px; max-width: 1560px; width: 100%; }
.only-mobile { display: none; }

/* ------------------------------------------------------------ dropdown */
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--neutral-50); }
.dropdown-menu form { margin: 0; }
.dropdown-wide { width: 330px; }
.dropdown-head { font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-empty { padding: 16px 10px; color: var(--muted); }
.notif-item { align-items: flex-start !important; }
.notif-item small { display: block; color: var(--muted); }
.notif-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }

/* ------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .ico { width: 14px; height: 14px; }

/* ------------------------------------------------------------ cards / grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }
.card + .card { margin-top: 20px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack > * + * { margin-top: 20px; }

/* stat tiles */
.stat { display: flex; gap: 14px; align-items: center; padding: 18px; }
.stat-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-ico .ico { width: 24px; height: 24px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--muted); }
a.stat-link { color: inherit; text-decoration: none; display: flex; transition: transform .12s, box-shadow .12s; }
a.stat-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tone-primary { background: var(--primary-50); color: var(--primary); }
.tone-success { background: var(--success-50); color: var(--success); }
.tone-warning { background: var(--warning-50); color: var(--warning); }
.tone-danger { background: var(--danger-50); color: var(--danger); }
.tone-info { background: var(--info-50); color: var(--info); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
.tone-neutral { background: var(--neutral-50); color: var(--text-2); }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; line-height: 1.2; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(29,95,224,.25); }
.btn-primary:hover { background: var(--primary-600); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--neutral-50); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--neutral-50); }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-icon { padding: 6px; width: 32px; height: 32px; }
.link-danger { color: var(--danger); background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
.inline-form { display: inline; margin: 0; }

/* ------------------------------------------------------------ badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--primary-50); color: var(--primary); }
.badge-neutral { background: var(--neutral-50); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 6px; background: var(--neutral-50); color: var(--text-2); font-size: 12px; font-weight: 500; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { white-space: nowrap; text-align: right; }
.table-compact td, .table-compact th { padding: 7px 10px; }
.th-sort { color: inherit; display: inline-flex; gap: 4px; align-items: center; text-decoration: none !important; }
.th-sort span { font-size: 9px; opacity: .5; }
.th-sort.active { color: var(--primary); }
.th-sort.active span { opacity: 1; }
.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.row-success td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { width: 40px; height: 40px; opacity: .35; display: block; margin: 0 auto 10px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-size: 13px; text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .4; }

/* ------------------------------------------------------------ filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { margin: 0; min-width: 140px; }
.filters .field-search { flex: 1; min-width: 200px; }
.filters label { font-size: 11.5px; }

/* ------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req::after { content: " *"; color: var(--danger); }
.input, input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
input[type=file] { padding: 7px 10px; background: var(--surface-2); }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,95,224,.14); }
input[readonly], .input-readonly { background: var(--surface-2); color: var(--text-2); }
.help { font-size: 12px; color: var(--muted); }
.input-group { display: flex; align-items: stretch; }
.input-group > input { border-radius: 9px 0 0 9px; }
.input-group > .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 9px 9px 0; background: var(--surface-2); color: var(--muted); font-size: 12.5px; }
.input-group > .btn { border-radius: 0 9px 9px 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.select-search { margin-bottom: 6px; }

/* ------------------------------------------------------------ wizard */
.wizard { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.wizard-steps { border-right: 1px solid var(--border); padding: 18px 12px; background: var(--surface-2); border-radius: var(--radius) 0 0 var(--radius); }
.wizard-step { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font: inherit; }
.wizard-step .num { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; background: var(--surface); }
.wizard-step.active { background: var(--primary-50); color: var(--primary); }
.wizard-step.active .num { background: var(--primary); border-color: var(--primary); color: #fff; }
.wizard-step.done .num { background: var(--success); border-color: var(--success); color: #fff; }
.wizard-body { padding: 22px 24px; min-width: 0; }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; animation: fade .2s ease; }
.wizard-pane > h3 { margin-bottom: 16px; }
.wizard-nav { display: flex; justify-content: space-between; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); grid-column: 1 / -1; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ repeater */
.repeater-table td { vertical-align: top; }
.repeater-table input, .repeater-table select, .repeater-table textarea { padding: 7px 9px; font-size: 13px; }
.repeater-table textarea { min-height: 38px; }
.repeater-table .seq { width: 40px; text-align: center; color: var(--muted); font-weight: 600; padding-top: 16px; }

/* ------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 12px; scrollbar-width: thin; }
.tab { padding: 13px 14px; border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { background: var(--neutral-50); color: var(--muted); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ------------------------------------------------------------ key-value */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.kv-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.pre { white-space: pre-line; }

/* ------------------------------------------------------------ hero (detail header) */
.hero { display: flex; gap: 20px; padding: 20px; align-items: flex-start; flex-wrap: wrap; }
.hero-photo { width: 132px; height: 132px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex: none; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-photo .ico { width: 44px; height: 44px; color: var(--muted); opacity: .5; }
.hero-main { flex: 1; min-width: 260px; }
.hero-main h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; margin-top: 14px; }
.hero-meta div small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.hero-meta div strong { font-weight: 600; }

/* ------------------------------------------------------------ attachments */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.attach { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); position: relative; display: flex; flex-direction: column; }
.attach-thumb { height: 100px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-thumb .ico { width: 32px; height: 32px; color: var(--muted); }
.attach-body { padding: 8px 10px; font-size: 12px; }
.attach-body strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.attach-del { position: absolute; top: 6px; right: 6px; }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.thumbs img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ------------------------------------------------------------ misc components */
.alert { display: block; position: relative; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; line-height: 1.55; }
.alert:has(.alert-close) { padding-right: 40px; }
.alert code { background: rgba(255,255,255,.55); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.alert-success { background: var(--success-50); color: var(--success); border-color: rgba(21,160,90,.25); }
.alert-danger, .alert-error { background: var(--danger-50); color: var(--danger); border-color: rgba(224,57,47,.25); }
.alert-warning { background: var(--warning-50); color: var(--warning); border-color: rgba(217,138,4,.25); }
.alert-info { background: var(--primary-50); color: var(--primary); border-color: rgba(29,95,224,.2); }
.alert-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: .6; }
.progress { height: 8px; background: var(--neutral-50); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.list-activity { list-style: none; margin: 0; padding: 0; }
.list-activity li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-activity li:last-child { border-bottom: 0; }
.list-activity .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.act-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.act-ico .ico { width: 16px; height: 16px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quick { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 11px; color: inherit; text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.quick:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.quick strong { display: block; }
.quick small { color: var(--muted); }
.tree { list-style: none; margin: 0; padding-left: 18px; border-left: 1px dashed var(--border-strong); }
.tree li { position: relative; padding: 4px 0 4px 10px; }
.tree li::before { content: ""; position: absolute; left: -18px; top: 15px; width: 22px; border-top: 1px dashed var(--border-strong); }
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-item .sw { width: 10px; height: 10px; border-radius: 50%; }
.legend-item .v { margin-left: auto; font-weight: 700; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
.donut-wrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: center; }
.kpi-inline { display: flex; gap: 24px; flex-wrap: wrap; }
.kpi-inline div small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-inline div strong { font-size: 18px; }
.remaining { font-weight: 600; }
.pill-tabs { display: inline-flex; background: var(--neutral-50); padding: 3px; border-radius: 10px; gap: 2px; }
.pill-tabs a { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.pill-tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(8, 18, 38, .55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.open { display: flex; }
.modal-dialog { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: fade .2s ease; }
.modal-dialog.lg { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* toast */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: fade .2s ease; }

/* ------------------------------------------------------------ auth */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-visual { background: radial-gradient(1200px 600px at 10% 10%, #1f58c9 0%, #0a1e3c 60%); color: #dce6f7; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-visual h2 { color: #fff; font-size: 34px; line-height: 1.15; max-width: 480px; letter-spacing: -.02em; }
.auth-visual p { max-width: 460px; color: #b8c7e3; font-size: 15px; }
.auth-visual .rig-art { position: absolute; right: -40px; bottom: -20px; width: 420px; opacity: .12; color: #fff; }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 520px; }
.auth-feats div { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; margin: 18px 0 6px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; padding: 12px; }
.demo-box { margin-top: 22px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 10px 12px; border-radius: 10px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; }
  .app.sidebar-open .sidebar { box-shadow: var(--shadow-lg); }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,18,38,.5); z-index: 35; }
  .only-mobile { display: inline-grid; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .wizard-steps { border-right: 0; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; gap: 4px; border-radius: var(--radius) var(--radius) 0 0; padding: 10px; }
  .wizard-step { width: auto; white-space: nowrap; }
  .wizard-step .lbl { display: none; }
  .wizard-step.active .lbl { display: inline; }
  .wizard-nav { grid-column: 1; border-radius: 0 0 var(--radius) var(--radius); }
  .wizard-body { padding: 16px; }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
  .kv-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); }
  .check-grid { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 19px; }
  .global-search { max-width: none; }
  .table th, .table td { padding: 9px 10px; }
}

/* ------------------------------------------------------------ print */
@media print {
  .sidebar, .topbar, .page-actions, .filters, .no-print, .form-actions, .tabs, .alert, .toast-wrap { display: none !important; }
  body { background: #fff; font-size: 11.5px; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .tab-pane { display: block !important; }
  .print-only { display: block !important; }
  a { color: inherit; }
}
.print-only { display: none; }
h1 .mono, h2 .mono { font-size: inherit; }
