/* Smartss CRM — application styles */
:root {
  --navy: #0e2a47;
  --navy-2: #13365b;
  --primary: #1a5fb4;
  --primary-600: #154f97;
  --primary-50: #eaf2fc;
  --accent: #0fa3b1;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e3e7ee;
  --border-strong: #cfd6e1;
  --text: #16202e;
  --text-2: #475467;
  --muted: #7a8699;
  --green: #12805c; --green-bg: #e6f5ee;
  --red: #c4302b; --red-bg: #fdecec;
  --amber: #b25e09; --amber-bg: #fff4e0;
  --blue: #1a5fb4; --blue-bg: #e8f0fc;
  --teal: #0b7f8a; --teal-bg: #e2f6f7;
  --purple: #6b3fb8; --purple-bg: #f1ebfb;
  --grey: #5b6678; --grey-bg: #eef1f5;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 240px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.pad { padding: 14px 16px; }
.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 }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }
.fw-600 { font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: #cfd9e6; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; color: #fff; text-decoration: none !important; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--primary));
  display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: .5px; color: #fff;
}
.brand-text { font-weight: 650; font-size: 15.5px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #c5d1e0;
  font-weight: 500; margin-bottom: 2px; text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .13); color: #fff; }
.nav a.active .ic { color: #5fd4de; }
.nav-count { margin-left: auto; font-style: normal; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7f93ad; padding: 16px 12px 6px; }
.sidebar-foot { padding: 12px 20px; font-size: 11px; color: #6c819c; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 10px 24px; min-height: 60px;
}
.global-search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.global-search > .ic { position: absolute; left: 12px; color: var(--muted); }
.global-search input[type=search] {
  width: 100%; border: 1px solid var(--border); background: var(--bg); border-radius: 9px; padding: 9px 12px 9px 36px; font: inherit;
}
.global-search input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-50); }
.search-suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 60;
}
.search-suggest a { display: flex; gap: 10px; padding: 9px 14px; color: var(--text); border-bottom: 1px solid var(--border); text-decoration: none; }
.search-suggest a:hover, .search-suggest a.focus { background: var(--primary-50); }
.search-suggest .type { font-size: 11px; color: var(--muted); text-transform: uppercase; min-width: 74px; padding-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.branch-switch select { padding: 7px 28px 7px 10px; font-weight: 600; font-size: 13px; }
.icon-btn { position: relative; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text-2); display: inline-flex; }
.icon-btn:hover { background: var(--grey-bg); }
.icon-btn .dot { position: absolute; top: 2px; right: 1px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; min-width: 16px; text-align: center; }
.avatar-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 9px; font: inherit; color: var(--text); }
.avatar-btn:hover { background: var(--grey-bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.user-name { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 22px 24px 48px; max-width: 1480px; width: 100%; }
.scrim { display: none; }
.only-mobile { display: none; }

/* ---------- Dropdowns ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none;
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text);
  background: none; border: 0; font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--grey-bg); text-decoration: none; }
.dropdown-menu .danger { color: var(--red); }
.dropdown-menu hr { margin: 6px 0; }
.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown-head .muted { font-size: 12px; }
.notif-menu { width: 360px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-head form { margin: 0; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-50); }
.notif-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.notif-item span { font-size: 12.5px; color: var(--text-2); display: block; }
.notif-item time { font-size: 11.5px; color: var(--muted); }
.notif-all { display: block; text-align: center; padding: 10px; font-weight: 600; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: 12.5px; padding: 0; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.3; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--grey-bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #0e6a4c; }
.btn-danger { background: #fff; border-color: #f0c6c4; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 18px; }
.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-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: block; color: var(--text); text-decoration: none !important; position: relative; }
a.kpi:hover { border-color: var(--border-strong); }
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi-label .ic { color: var(--muted); }
.kpi-value { font-size: 23px; font-weight: 700; margin-top: 6px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.warn .kpi-value { color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); font-weight: 650; background: #fafbfc; white-space: nowrap; }
.table th a { color: inherit; text-decoration: none; }
.table th.sorted { color: var(--primary); }
.table tbody tr:hover { background: #fafcff; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .primary-cell a { font-weight: 600; color: var(--text); }
.table .primary-cell a:hover { color: var(--primary); }
.table .sub { display: block; font-size: 12px; color: var(--muted); }
.table-sm th, .table-sm td { padding: 7px 10px; }
.table tfoot td { font-weight: 650; background: #fafbfc; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .ic { color: var(--border-strong); margin-bottom: 8px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.filters .search { flex: 1 1 220px; min-width: 180px; max-width: 340px; }
.filters select, .filters input { width: auto; }
.filters .grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: #fff; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none !important; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip em { font-style: normal; opacity: .7; margin-left: 3px; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pager-links { display: flex; gap: 4px; }
.pager-links a { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-2); text-decoration: none; }
.pager-links a.current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 650; white-space: nowrap; line-height: 18px; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-grey { background: var(--grey-bg); color: var(--grey); }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--text); }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; color: var(--text);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: 6px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8699' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 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 { min-width: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.error-text { color: var(--red); font-size: 12.5px; margin-top: 4px; }

/* Alerts */
.alert { padding: 11px 40px 11px 14px; border-radius: 9px; margin-bottom: 14px; position: relative; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--green-bg); border-color: #b7e2cf; color: #0b5e43; }
.alert-error { background: var(--red-bg); border-color: #f3c3c1; color: #a02622; }
.alert-warning { background: var(--amber-bg); border-color: #f6d9a8; color: #8a4a06; }
.alert-info { background: var(--blue-bg); border-color: #c5d8f5; color: #174b8f; }
.alert-x { position: absolute; right: 8px; top: 7px; border: 0; background: none; font-size: 20px; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- Detail views ---------- */
.dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 12px; }
.tabs a { padding: 12px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a em { font-style: normal; background: var(--grey-bg); border-radius: 10px; padding: 0 7px; font-size: 11.5px; margin-left: 4px; color: var(--text-2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { font-size: 13.5px; }
.timeline .note-body { background: var(--bg); border-radius: 8px; padding: 8px 12px; margin-top: 4px; white-space: pre-wrap; }

.progress-steps { display: flex; gap: 0; margin: 4px 0 0; overflow-x: auto; }
.progress-steps .step { flex: 1; min-width: 92px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); position: relative; padding-top: 22px; }
.progress-steps .step::before { content: ""; position: absolute; top: 6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--border-strong); z-index: 1; }
.progress-steps .step::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--border-strong); }
.progress-steps .step:first-child::after { display: none; }
.progress-steps .step.done { color: var(--green); }
.progress-steps .step.done::before, .progress-steps .step.done::after { background: var(--green); }
.progress-steps .step.current { color: var(--primary); }
.progress-steps .step.current::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.progress-steps .step.bad { color: var(--red); }
.progress-steps .step.bad::before { background: var(--red); }

.bar { height: 8px; background: var(--grey-bg); border-radius: 5px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 5px; }

.totals { margin-left: auto; width: 100%; max-width: 360px; }
.totals td { padding: 6px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals tr.grand td { border-top: 2px solid var(--text); font-size: 16px; font-weight: 750; padding-top: 10px; }

/* Line item editor */
.items-table { min-width: 760px; }
.items-table th { background: #fafbfc; }
.items-table td { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--border); }
.items-table input, .items-table textarea { padding: 7px 8px; }
.items-table textarea { min-height: 38px; height: 38px; }
.items-table .col-qty { width: 84px; }
.items-table .col-unit { width: 78px; }
.items-table .col-price { width: 128px; }
.items-table .col-disc { width: 76px; }
.items-table .col-total { width: 130px; text-align: right; font-weight: 600; padding-top: 14px; font-variant-numeric: tabular-nums; }
.items-table .col-x { width: 40px; }
.items-table .product-pick { position: relative; }
.product-results { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 20; max-height: 260px; overflow-y: auto; }
.product-results div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.product-results div:hover, .product-results div.focus { background: var(--primary-50); }
.product-results small { color: var(--muted); display: block; }
.row-handle { cursor: grab; color: var(--muted); }

/* Auth pages */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at top left, #1d4f80 0%, var(--navy) 55%, #0a1f36 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); padding: 32px 30px; }
.auth-card .brand { padding: 0 0 18px; color: var(--navy); }
.auth-card .brand-text { color: var(--navy); font-size: 18px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card form > * + * { margin-top: 14px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-2); }

/* Charts */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .grow { flex: 1; min-width: 0; }
.list-plain .title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attach-list .file-ic { width: 36px; height: 36px; border-radius: 8px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-size: 10px; font-weight: 800; text-transform: uppercase; flex-shrink: 0; }

.perm-table select { min-width: 130px; }
.inline-form { display: inline; margin: 0; }
.task-done { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--red); font-weight: 600; }
.due-soon { color: var(--amber); font-weight: 600; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 60px 16px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal-box.lg { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 8px 12px; gap: 6px; }
  .content { padding: 16px 12px 40px; }
  .hide-sm { display: none !important; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .notif-menu { position: fixed; left: 8px; right: 8px; top: 58px; width: auto; }
  .branch-switch select { padding: 6px 24px 6px 8px; font-size: 12px; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 18px; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 19px; }
  .page-head { margin-bottom: 14px; }
  .page-actions { width: 100%; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .filters { padding: 10px 12px; }
  .filters .search { max-width: none; flex-basis: 100%; }
  .filters select { flex: 1 1 45%; }
  .card-body { padding: 14px; }
  .card-head { padding: 12px 14px; }
  /* Tables become stacked cards on phones */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .table.responsive td { border: 0; padding: 3px 0; text-align: left !important; display: flex; justify-content: space-between; gap: 12px; }
  .table.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; flex-shrink: 0; }
  .table.responsive td.primary-cell { font-size: 15px; display: block; }
  .table.responsive td.actions { justify-content: flex-end; padding-top: 6px; }
  .table.responsive td:empty { display: none; }
  .global-search input { padding-left: 32px; }
  .global-search input::placeholder { font-size: 13px; }
}

@media print {
  .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}

/* Notification items inside the dropdown stack vertically */
.dropdown-menu a.notif-item { display: block; border-radius: 0; padding: 10px 14px; }
.dropdown-menu a.notif-item.unread { background: var(--primary-50); }
.attach-list .grow > span.small { display: block; }
