/* Coarser Spinning – shared theme (derived from the original Store / Gate Pass designs) */
:root {
    --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-num: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-subtle: #f8fafc;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, .12);
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-title: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;

    --danger: #dc2626; --danger-bg: #fef2f2; --danger-border: #fecaca;
    --warning: #d97706; --warning-bg: #fffbeb; --warning-border: #fde68a;
    --success: #16a34a; --success-bg: #f0fdf4; --success-border: #bbf7d0;
    --info: #2563eb; --info-bg: #eff6ff; --info-border: #bfdbfe;

    --pending-bg: #fffbe6; --pending-border: #ffe58f; --pending-text: #d48806; --pending-bar: #faad14;
    --partial-bg: #e6f7ff; --partial-border: #91d5ff; --partial-text: #096dd9; --partial-bar: #1890ff;
    --ok-bg: #f6ffed; --ok-border: #b7eb8f; --ok-text: #389e0d; --ok-bar: #52c41a;

    --radius: 16px;
    --shadow: 0 4px 12px rgba(15, 23, 42, .04);
    --shadow-hover: 0 12px 24px rgba(37, 99, 235, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
button, input, select, textarea { font-family: var(--font-ui); }
/* Figures: same as trt_erp_2 – amounts, counts and number boxes use the mono face. */
table td.text-right, table th.text-right, input[type="number"], .tile .count {
    font-family: var(--font-num); font-variant-numeric: tabular-nums;
}
body {
    font-family: var(--font-ui);
    background: var(--bg-main);
    color: var(--text-body);
    font-size: 18px;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { color: var(--text-title); margin: 0; font-weight: 800; letter-spacing: -.3px; }
.muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 10px 24px; min-height: 62px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--text-title); }
.topbar-brand .logo {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: var(--info-bg); border: 1.5px solid var(--info-border); font-size: 19px;
}
.topbar-brand strong { font-size: 18px; font-weight: 800; display: block; line-height: 1.1; }
.topbar-brand small { font-size: 18px; color: var(--text-muted); font-weight: 600; }
.topnav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.topnav a {
    padding: 8px 12px; border-radius: 10px; color: var(--text-body); font-weight: 700; font-size: 18px;
}
.topnav a:hover { background: var(--bg-subtle); }
.topnav a.active { background: var(--info-bg); color: var(--primary); }
.module-badge {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); /* centred in the top bar */
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 6px; border-radius: 12px;
    font-size: 20px; font-weight: 800; letter-spacing: .3px; color: #fff; background: linear-gradient(180deg, #1d4ed8, #1e3a8a);
    box-shadow: 0 4px 12px rgba(30,58,138,.25); white-space: nowrap;
}
.module-badge .icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #fff; font-size: 20px; }
.module-badge.module-gatepass { background: linear-gradient(180deg, #ea580c, #c2410c); box-shadow: 0 4px 12px rgba(194,65,12,.25); }
@media (max-width: 1000px) { .module-badge { position: static; transform: none; } }
@media (max-width: 600px) {
    .module-badge { margin-left: 6px; padding: 4px 10px 4px 4px; font-size: 15px; gap: 6px; }
    .module-badge .icon { width: 26px; height: 26px; font-size: 15px; }
}
.user-menu { position: relative; margin-left: auto; }
.user-menu > button {
    display: flex; align-items: center; gap: 10px; background: none; border: 1px solid var(--border);
    border-radius: 12px; padding: 5px 12px 5px 5px; cursor: pointer; font: inherit;
}
.avatar {
    width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.user-menu .who { text-align: left; line-height: 1.15; }
.user-menu .who b { display: block; font-size: 18px; color: var(--text-title); }
.user-menu .who small { font-size: 18px; color: var(--text-muted); }
.dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
    background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.12);
    padding: 6px; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
    display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text-body);
    font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg-subtle); }
.menu-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-size: 18px; cursor: pointer; }

/* ---------- page ---------- */
.page { max-width: none; margin: 0; padding: 22px 24px 40px; }
.crumbs {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
    background: #fff; border: 1px solid var(--border-strong); border-radius: 12px;
    padding: 11px 18px; font-size: 18px; font-weight: 700; margin-bottom: 18px; color: var(--text-muted);
}
.crumbs > a { color: #245ac5; }
.crumbs .crumb-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs .sep { color: #a0adbd; }
.crumbs .current { color: var(--primary); font-weight: 800; }

.page-head {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: #fff; border-radius: 20px; padding: 18px 26px; box-shadow: var(--shadow);
    border: 1px solid var(--border); margin-bottom: 20px;
}
.page-head .icon {
    width: 46px; height: 46px; border-radius: 12px; background: var(--info-bg); border: 1.5px solid var(--info-border);
    display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
}
.page-head h1 { font-size: 21px; }
.page-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 18px; font-weight: 600; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- dashboard ---------- */
.brand-card {
    display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--border);
    border-radius: 22px; padding: 20px 26px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.brand-card .icon {
    width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 26px;
    background: var(--info-bg); border: 1.5px solid var(--info-border);
}
.brand-card h1 { font-size: 24px; }
.brand-card p { margin: 2px 0 0; color: var(--text-muted); font-weight: 600; }
.section-title {
    font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted);
    margin: 26px 4px 12px;
}
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tile-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tile {
    --c: var(--primary); --c-bg: var(--info-bg);
    display: flex; align-items: center; gap: 16px; min-height: 104px;
    background: var(--c-bg); border: 2px solid var(--c); border-radius: 20px; padding: 20px 22px;
    color: var(--text-title); transition: transform .18s, box-shadow .18s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.tile .iconbox {
    width: 54px; height: 54px; border-radius: 14px; background: #fff; display: grid; place-items: center;
    font-size: 25px; flex-shrink: 0; box-shadow: 0 2px 6px rgba(15,23,42,.06);
}
.tile h3 { font-size: 18px; color: var(--c-text, var(--text-title)); }
.tile p { margin: 3px 0 0; font-size: 18px; color: var(--text-muted); font-weight: 600; }
.tile .count { margin-left: auto; font-size: 24px; font-weight: 800; color: var(--c); }
.tile.green  { --c: #10b981; --c-bg: #f0fdf4; --c-text: #059669; }
.tile.blue   { --c: #2563eb; --c-bg: #eff6ff; --c-text: #1d4ed8; }
.tile.amber  { --c: #f59e0b; --c-bg: #fffbeb; --c-text: #b45309; }
.tile.cyan   { --c: #06b6d4; --c-bg: #ecfeff; --c-text: #0e7490; }
.tile.purple { --c: #8b5cf6; --c-bg: #f5f3ff; --c-text: #6d28d9; }
.tile.red    { --c: #ef4444; --c-bg: #fef2f2; --c-text: #b91c1c; }
.tile.slate  { --c: #64748b; --c-bg: #f8fafc; --c-text: #334155; }

/* ---------- small delete icon ---------- */
.icon-del {
    display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; margin-right: 6px; vertical-align: middle;
    border: 1px solid #dc2626; border-radius: 8px; background: #dc2626; color: #fff; line-height: 1; cursor: pointer; transition: .15s;
}
.icon-del:hover { background: #b91c1c; border-color: #b91c1c; }
.indent-delete { display: flex; justify-content: flex-end; margin-top: 12px; }
.indent-delete .icon-del { margin-right: 0; }

/* ---------- panels ---------- */
.panel {
    background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 24px 26px;
    box-shadow: var(--shadow); margin-bottom: 20px;
}
.panel-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 18px; }
.panel-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 18px; font-weight: 600; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow); }
.stat-card .lbl { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.stat-card .val { font-size: 18px; font-weight: 800; color: var(--text-title); margin-top: 4px; }

/* ---------- filter bar ---------- */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 16px; padding: 12px; margin-bottom: 14px;
}
.filter-bar .pill {
    display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border-strong);
    border-radius: 12px; padding: 0 10px; height: 40px; min-width: 170px; flex: 0 1 220px;
}
.filter-bar .pill:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.filter-bar .pill input, .filter-bar .pill select {
    border: 0; outline: 0; background: transparent; font: inherit; font-weight: 600; width: 100%; height: 100%; color: var(--text-body);
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
    border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-body);
    font: inherit; font-weight: 700; font-size: 18px; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { background: var(--bg-subtle); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 18px; border-radius: 8px; }
.btn-xs { height: 27px; padding: 0 9px; font-size: 18px; border-radius: 7px; }
.btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #10b981; border-color: #059669; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); border-color: #e11d48; color: #fff; }
.btn-danger:hover { background: #e11d48; }
.btn-warning { background: #f59e0b; border-color: #d97706; color: #fff; }
.btn-dark { background: #111827; border-color: #111827; color: #fff; }
.btn-dark:hover { background: var(--primary); }
.btn-outline-primary { color: var(--primary); border-color: var(--info-border); background: var(--info-bg); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-danger { color: var(--danger); border-color: var(--danger-border); background: var(--danger-bg); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-outline-success { color: var(--success); border-color: var(--success-border); background: var(--success-bg); }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-warning { color: #b45309; border-color: var(--warning-border); background: var(--warning-bg); }
.btn-outline-warning:hover { background: #f59e0b; color: #fff; }
.btn-purple { background: #6d4ae8; border-color: #6d4ae8; color: #fff; }
.btn-orange { background: #e08a00; border-color: #e08a00; color: #fff; }
.btn-green { background: #16a36a; border-color: #16a36a; color: #fff; }
.btn-dashed { border: 1.5px dashed var(--primary); color: var(--primary); background: var(--info-bg); }
.inline-form { display: inline; }

/* ---------- tables (card-style rows) ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.data-table th {
    font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted);
    padding: 6px 14px; text-align: left; white-space: nowrap;
}
.data-table td {
    background: #fff; padding: 13px 14px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table td:first-child { border-left: 1px solid var(--border); border-radius: 12px 0 0 12px; }
.data-table td:last-child { border-right: 1px solid var(--border); border-radius: 0 12px 12px 0; }
.data-table tbody tr:hover td { background: #fbfdff; border-color: var(--info-border); }
.data-table tr.row-warn td { background: var(--pending-bg); }
.data-table tr.row-danger td { background: #fff5f5; }
.data-table .empty td { text-align: center; color: var(--text-muted); padding: 30px; font-weight: 600; }
.data-table.center th, .data-table.center td { text-align: center; }
.data-table.compact td { padding: 9px 10px; font-size: 18px; }
.data-table.compact th { padding: 4px 10px; }

/* grid-style table for editable line items */
.grid-table { width: 100%; border-collapse: collapse; }
.grid-table th {
    background: #f1f5f9; border-bottom: 2px solid var(--border-strong); padding: 10px; font-size: 18px;
    text-transform: uppercase; font-weight: 800; color: var(--text-muted); text-align: left; white-space: nowrap;
}
.grid-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field label, .label {
    display: block; font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); margin-bottom: 6px;
}
.field-card { border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 14px; background: #fff; }
.field-card .form-control { border: 0; padding: 0; height: 28px; font-size: 18px; font-weight: 700; box-shadow: none; }
.field-card .form-control[readonly] { color: var(--text-muted); }
.form-control {
    width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px;
    font: inherit; font-weight: 600; color: var(--text-title); background: #fff; outline: 0;
}
textarea.form-control { height: auto; min-height: 42px; padding: 9px 12px; resize: vertical; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-control[readonly], .form-control:disabled { background: var(--bg-subtle); color: var(--text-muted); }
.form-control-sm { height: 34px; font-size: 18px; padding: 0 9px; border-radius: 8px; }
.is-invalid, .form-control.is-invalid { border: 2px solid var(--danger) !important; background: var(--danger-bg) !important; }
.invalid-feedback { color: var(--danger); font-size: 18px; font-weight: 600; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.locked { opacity: .4; filter: grayscale(1); pointer-events: none; }

/* ---------- badges / pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 7px;
    font-size: 18px; font-weight: 800; white-space: nowrap; border: 1px solid transparent;
}
.badge-pending { background: var(--pending-bg); border-color: var(--pending-border); color: var(--pending-text); }
.badge-partial { background: var(--partial-bg); border-color: var(--partial-border); color: var(--partial-text); }
.badge-success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.badge-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.badge-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.badge-muted { background: #f1f5f9; border-color: var(--border); color: var(--text-muted); }
.badge-purple { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }

.progress { height: 6px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin-top: 6px; min-width: 120px; }
.progress > span { display: block; height: 100%; border-radius: 6px; background: var(--pending-bar); }
.progress > span.partial { background: var(--partial-bar); }
.progress > span.ok { background: var(--ok-bar); }

.circles { display: inline-flex; align-items: flex-start; gap: 0; }
.circles .c { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.circles .dot {
    width: 34px; height: 34px; border-radius: 50%; color: #fff; display: grid; place-items: center;
    font-weight: 800; font-size: 18px; box-shadow: 0 3px 8px rgba(15,23,42,.12);
}
.circles .dot.red { background: #dc2626; } .circles .dot.blue { background: #2563eb; } .circles .dot.green { background: #16a34a; }
.circles .c small { font-size: 18px; font-weight: 800; color: var(--text-muted); margin-top: 4px; letter-spacing: .3px; }
.circles .line { width: 18px; height: 2px; background: var(--border-strong); margin-top: 17px; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 12px; font-weight: 700; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: #15803d; }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: #b91c1c; }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: #1d4ed8; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.note { background: var(--info-bg); border: 1px solid var(--info-border); color: #1e40af; border-radius: 12px; padding: 10px 14px; font-size: 18px; margin-top: 12px; }

/* ---------- modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .6); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; z-index: 9999; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff; border-radius: 20px; width: 100%; max-width: 820px; max-height: 92vh; overflow: auto;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28); animation: pop .18s ease-out;
}
.modal-box.sm { max-width: 440px; }
.modal-box.lg { max-width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; }
.modal-head p { margin: 2px 0 0; font-size: 18px; color: var(--text-muted); }
.modal-close { margin-left: auto; background: #fee2e2; color: #dc2626; border: 0; border-radius: 9px; width: 34px; height: 34px; font-size: 18px; cursor: pointer; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.summary-rows > div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.summary-rows > div span { color: var(--text-muted); font-weight: 600; }
.summary-rows > div b { color: var(--text-title); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- photo viewer ---------- */
.viewer { position: fixed; inset: 0; background: #fff; z-index: 100000; display: none; flex-direction: column; }
.viewer.open { display: flex; }
.viewer .stage { flex: 1; overflow: hidden; display: grid; place-items: center; position: relative; }
.viewer .stage img { max-width: 92%; max-height: 82vh; cursor: grab; transition: transform .08s; user-select: none; }
.viewer .stage iframe, .viewer .stage video { width: 86%; height: 80vh; border: 0; }
.viewer .nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%;
    border: 1px solid var(--border); background: #fff; font-size: 28px; cursor: pointer; box-shadow: var(--shadow);
}
.viewer .nav.prev { left: 24px; } .viewer .nav.next { right: 24px; }
.viewer .bar {
    display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap;
    margin: 0 auto 22px; padding: 10px 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 999px;
}
.viewer .bar .pn { background: var(--info-bg); color: var(--primary); padding: 4px 12px; border-radius: 999px; font-weight: 800; }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; list-style: none; padding: 0; }
.pagination a, .pagination span {
    min-width: 34px; height: 34px; padding: 0 10px; display: grid; place-items: center; border-radius: 9px;
    border: 1px solid var(--border); background: #fff; font-weight: 700; color: var(--text-body);
}
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled span { opacity: .45; }

/* ---------- permission board ---------- */
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th { background: #f1f5f9; padding: 10px 12px; font-size: 18px; text-transform: uppercase; color: var(--text-muted); font-weight: 800; }
.perm-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.perm-table .group td { background: var(--info-bg); color: #1e40af; font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: .5px; }
.perm-table td.c, .perm-table th.c { text-align: center; width: 100px; }

/* ---------- login (glass card on a dark warehouse-blue backdrop) ---------- */
.login-body {
    min-height: 100vh; margin: 0; color: #e2e8f0;
    background:
        radial-gradient(900px 520px at 50% 38%, rgba(56,132,255,.35), transparent 70%),
        radial-gradient(600px 400px at 12% 100%, rgba(14,165,233,.18), transparent 70%),
        radial-gradient(600px 400px at 90% 0%, rgba(99,102,241,.18), transparent 70%),
        repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 140px),
        repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 2px, transparent 2px 70px),
        linear-gradient(180deg, #0b1730 0%, #0a1226 55%, #050a17 100%);
}
.login-stage { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.login-card {
    width: 100%; max-width: 380px; padding: 30px 28px 22px; border-radius: 26px;
    background: linear-gradient(180deg, rgba(30,58,110,.55), rgba(10,22,48,.72));
    border: 1px solid rgba(147,197,253,.35);
    box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 30px 70px rgba(0,0,0,.55), 0 0 60px rgba(59,130,246,.25);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { width: 132px; height: auto; display: block; margin: 0 auto 10px; filter: drop-shadow(0 6px 18px rgba(59,130,246,.45)); }
.login-name { font-size: 34px; font-weight: 800; letter-spacing: 2px; color: #fff; line-height: 1.1; }
.login-sub { margin-top: 4px; font-size: 14px; font-weight: 600; letter-spacing: 3px; color: #cbd5e1; }
.login-error { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(239,68,68,.15); border: 1px solid rgba(248,113,113,.5); color: #fecaca; font-size: 15px; }
.login-field {
    display: flex; align-items: center; gap: 10px; height: 50px; margin-bottom: 14px; padding: 0 14px; border-radius: 12px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(148,163,184,.35); transition: .15s;
}
.login-field:focus-within { border-color: #60a5fa; background: rgba(255,255,255,.12); box-shadow: 0 0 0 3px rgba(96,165,250,.25); }
.login-field.is-invalid { border-color: #f87171; }
.login-field svg { width: 20px; height: 20px; fill: #cbd5e1; flex-shrink: 0; }
.login-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: 17px; }
.login-field input::placeholder { color: #94a3b8; }
.login-field input:-webkit-autofill { -webkit-text-fill-color: #fff; transition: background-color 9999s; }
.login-eye { display: grid; place-items: center; padding: 4px; border: 0; background: none; cursor: pointer; opacity: .75; }
.login-eye:hover, .login-eye.on { opacity: 1; }
.login-eye.on svg { fill: #93c5fd; }
.login-remember { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 18px; font-size: 15px; color: #cbd5e1; cursor: pointer; }
.login-remember input { width: 16px; height: 16px; accent-color: #3b82f6; }
.login-btn {
    width: 100%; height: 50px; border: 0; border-radius: 12px; cursor: pointer;
    background: linear-gradient(180deg, #3b8cff, #1d5fd8); color: #fff; font: inherit; font-size: 18px; font-weight: 700;
    box-shadow: 0 10px 24px rgba(37,99,235,.45); transition: .15s;
}
.login-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.login-btn span { margin-left: 6px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: #64748b; }

/* ---------- module chooser (after login) ---------- */
.chooser-body {
    min-height: 100vh; margin: 0;
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(255,255,255,.9), transparent 70%),
        linear-gradient(180deg, #dbe7f5 0%, #eef2f7 45%, #cfd8e3 100%);
}
.chooser { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; padding: 40px 16px; }
.chooser-brand { text-align: center; }
.chooser-logo {
    width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; font-size: 40px;
    background: linear-gradient(145deg, #1e3a8a, #2563eb); box-shadow: 0 10px 24px rgba(30,58,138,.3);
}
.chooser-brand h1 { font-size: 40px; letter-spacing: 1px; color: #0f1e3d; }
.chooser-brand h1 span { color: #2563eb; }
.chooser-brand p { margin: 6px 0 0; font-size: 16px; font-weight: 600; letter-spacing: 6px; text-transform: uppercase; color: #334155; }
.chooser-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 340px)); justify-content: center; gap: 30px; width: 100%; max-width: 760px; }
.chooser-card {
    width: 100%; padding: 0; border: 3px solid #fff; border-radius: 24px; overflow: hidden; cursor: pointer; font: inherit; text-align: left;
    background: linear-gradient(180deg, #f8fbff, #e6edf6); box-shadow: 0 18px 40px rgba(15,30,61,.18); transition: transform .15s, box-shadow .15s;
}
.chooser-card:hover, .chooser-card:focus-visible { transform: translateY(-4px); box-shadow: 0 24px 50px rgba(15,30,61,.26); outline: none; }
.chooser-card .art { position: relative; display: block; height: 220px; }
.chooser-card .art span { position: absolute; line-height: 1; filter: drop-shadow(0 8px 10px rgba(15,30,61,.2)); }
.chooser-card .a1 { font-size: 96px; left: 50%; top: 36px; transform: translateX(-50%); }
.chooser-card .a2 { font-size: 64px; left: 26px; bottom: 22px; }
.chooser-card .a3 { font-size: 60px; right: 26px; bottom: 22px; }
.chooser-card .bar {
    display: flex; align-items: center; justify-content: space-between; padding: 18px 24px;
    background: linear-gradient(180deg, #1d4ed8, #1e3a8a); color: #fff; font-size: 30px; font-weight: 700;
}
.chooser-card .bar i {
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 30px; line-height: 1;
    background: #fff; color: #1e3a8a; padding-bottom: 4px;
}
.chooser-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; text-align: center; color: #475569; font-size: 16px; }
.chooser-foot button { font: inherit; font-weight: 700; color: #b91c1c; background: #fff; border: 1px solid #fecaca; border-radius: 10px; padding: 6px 14px; cursor: pointer; }
@media (max-width: 600px) {
    .chooser-brand h1 { font-size: 30px; }
    .chooser-brand p { letter-spacing: 3px; font-size: 14px; }
    .chooser-card .art { height: 170px; }
    .chooser-card .a1 { font-size: 76px; top: 26px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
    .tile-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .form-grid, .form-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .menu-toggle { display: block; }
    .topnav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 10px; flex-direction: column; margin: 0; }
    .topnav.open { display: flex; }
    .user-menu .who { display: none; }
}
@media (max-width: 640px) {
    .page { padding: 14px 12px 30px; }
    .topbar { padding: 8px 12px; }
    .tile-grid, .tile-grid.cols-3, .stat-grid { grid-template-columns: 1fr; }
    .form-grid, .form-grid.cols-2, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .panel { padding: 16px; }
    .filter-bar .pill { flex: 1 1 100%; }
}

@media print {
    .topbar, .crumbs, .no-print, .filter-bar, .pagination { display: none !important; }
    body { background: #fff; }
    .page { padding: 0; max-width: none; }
    .panel { box-shadow: none; border: 0; padding: 0; }
}

/* ---------- Select2 (themed to match .form-control) ---------- */
.select2-container { font-family: var(--font-ui); font-size: 18px; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 42px; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff;
}
.select2-container--default .select2-selection--single { height: 42px; display: flex; align-items: center; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 12px; padding-right: 30px; line-height: normal; color: var(--text-title); font-weight: 600; width: 100%;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--text-muted); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 100%; right: 6px; top: 0; }
.select2-container--default.select2-container--focus .select2-selection,
.select2-container--default.select2-container--open .select2-selection {
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); outline: 0;
}
.select2-container--default.select2-container--disabled .select2-selection { background: var(--bg-subtle); cursor: not-allowed; }
.select2-container--default.select2-container--disabled .select2-selection__rendered { color: var(--text-muted); }
.select2-dropdown {
    border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; z-index: 100001;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .14); font-size: 18px;
}
.select2-container--open .select2-dropdown--below { margin-top: 4px; border-top: 1px solid var(--border-strong); }
.select2-container--open .select2-dropdown--above { margin-top: -4px; border-bottom: 1px solid var(--border-strong); }
.select2-results__option { padding: 8px 12px; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--primary); color: #fff; }
.select2-container--default .select2-results__option[aria-selected=true] { background: var(--info-bg); color: var(--primary); font-weight: 700; }
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; outline: 0; font: inherit;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--info-bg); border-color: var(--info-border); color: var(--primary); border-radius: 6px; font-weight: 700;
}
/* small variant, e.g. line-item grids */
.form-control-sm + .select2 .select2-selection--single { height: 34px; min-height: 34px; border-radius: 8px; }
.form-control-sm + .select2 .select2-selection__rendered { padding-left: 9px; }
.grid-table .select2-container, .data-table .select2-container { min-width: 130px; }
/* validation state follows the hidden select */
select.is-invalid + .select2 .select2-selection { border: 2px solid var(--danger) !important; background: var(--danger-bg) !important; }
/* inside filter pills and big field cards the wrapper already draws the border */
.filter-bar .pill .select2-selection--single,
.field-card .select2-selection--single { border: 0 !important; box-shadow: none !important; background: transparent; }
.filter-bar .pill .select2-selection--single { height: 38px; }
.filter-bar .pill .select2-selection__rendered { padding-left: 2px; }
.field-card .select2-selection--single { height: 30px; min-height: 30px; }
.field-card .select2-selection__rendered { padding-left: 0; font-weight: 700; }

/* ---------- DataTables ---------- */
.dataTables_wrapper { position: relative; }
.dt-top, .dt-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dt-top { margin-bottom: 4px; }
.dt-bottom { margin-top: 10px; }
.dataTables_length label, .dataTables_filter label { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text-muted); margin: 0; }
.dataTables_length select {
    height: 40px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 0 8px; font: inherit; font-weight: 700; background: #fff;
}
.dataTables_filter input {
    height: 40px; min-width: 260px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0 12px; font: inherit; font-weight: 600; outline: 0;
}
.dataTables_filter input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.dataTables_info { color: var(--text-muted); font-weight: 600; }
.dataTables_paginate { display: flex; gap: 6px; flex-wrap: wrap; }
.dataTables_paginate span { display: flex; gap: 6px; }
.dataTables_paginate .paginate_button {
    min-width: 38px; height: 38px; padding: 0 10px; display: grid; place-items: center; border-radius: 9px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; font-weight: 700; color: var(--text-body); user-select: none;
}
.dataTables_paginate .paginate_button:hover { border-color: var(--primary); color: var(--primary); }
.dataTables_paginate .paginate_button.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.dataTables_paginate .paginate_button.disabled { opacity: .45; cursor: default; pointer-events: none; }
.dataTables_paginate .ellipsis { padding: 0 4px; align-self: center; }
.dataTables_processing {
    position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 5;
    background: #fff; border: 1px solid var(--info-border); color: var(--primary); font-weight: 800;
    padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow);
}
.dt-spinner {
    display: inline-block; width: 16px; height: 16px; border: 2.5px solid var(--info-border); border-top-color: var(--primary);
    border-radius: 50%; vertical-align: -3px; animation: dtspin .7s linear infinite;
}
@keyframes dtspin { to { transform: rotate(360deg); } }
table.dataTable { width: 100% !important; }
table.dataTable thead th.sorting, table.dataTable thead th.sorting_asc, table.dataTable thead th.sorting_desc { cursor: pointer; position: relative; padding-right: 22px; }
table.dataTable thead th.sorting::after, table.dataTable thead th.sorting_asc::after, table.dataTable thead th.sorting_desc::after {
    position: absolute; right: 6px; opacity: .35; content: '⇅'; font-size: 14px;
}
table.dataTable thead th.sorting_asc::after { content: '↑'; opacity: .9; color: var(--primary); }
table.dataTable thead th.sorting_desc::after { content: '↓'; opacity: .9; color: var(--primary); }
table.dataTable td.dataTables_empty { text-align: center; color: var(--text-muted); padding: 30px; font-weight: 600; }
@media (max-width: 640px) {
    .dataTables_filter, .dataTables_filter label, .dataTables_filter input { width: 100%; min-width: 0; }
    .dt-bottom { justify-content: center; }
}
.dt-actions { text-align: right !important; white-space: nowrap; }

/* ---------- SweetAlert2 ---------- */
.swal2-popup.phx-swal { font-family: var(--font-ui); border-radius: 20px; padding: 26px 24px 22px; }
.swal2-popup.phx-swal .swal2-title { font-size: 24px; font-weight: 700; color: var(--text-title); }
.swal2-popup.phx-swal .swal2-html-container { font-size: 18px; color: var(--text-body); }
.swal2-popup.phx-swal .swal2-actions { gap: 10px; }
.swal2-popup.phx-swal .swal2-actions .btn { height: 44px; padding: 0 22px; font-size: 18px; }
.swal2-popup.phx-swal.swal2-toast { padding: 10px 14px; border-radius: 12px; }
.swal2-popup.phx-swal.swal2-toast .swal2-title { font-size: 18px; }
.swal2-container { z-index: 200000; }

/* ---------- top menu dropdowns / dashboard heading ---------- */
.nav-drop { position: relative; display: inline-flex; }
.nav-drop .dropdown { left: 0; right: auto; min-width: 240px; }
.nav-drop .dropdown a { white-space: nowrap; }
.module-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 4px 14px; }
@media (max-width: 900px) {
    .nav-drop { flex-direction: column; }
    .nav-drop .dropdown { position: static; box-shadow: none; border: 0; padding-left: 14px; }
}

/* ---------- one card: breadcrumb + page header + first panel ----------
   When these blocks follow each other they are drawn as a single card,
   separated by thin dividers instead of gaps. */
.crumbs:has(+ .page-head) {
    margin-bottom: 0; border-radius: 20px 20px 0 0; border: 1px solid var(--border); border-bottom: 1px dashed var(--border);
    box-shadow: none; padding: 12px 26px;
}
.crumbs + .page-head { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.page-head:has(+ .panel) {
    margin-bottom: 0; border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: none;
}
.page-head + .panel { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
/* same joining when the panel is the first block inside a <form>, or follows the breadcrumb directly */
.crumbs:has(+ .panel), .crumbs:has(+ form > .panel:first-of-type) {
    margin-bottom: 0; border-radius: 20px 20px 0 0; border: 1px solid var(--border); border-bottom: 1px dashed var(--border);
    box-shadow: none; padding: 12px 26px;
}
.page-head:has(+ form > .panel:first-of-type) {
    margin-bottom: 0; border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: none;
}
.crumbs + .panel, .crumbs + form > .panel:first-of-type, .page-head + form > .panel:first-of-type {
    border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0;
}

/* ---------- textboxes and dropdowns: 5px corners ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=range]),
select, textarea, .form-control, .form-control-sm,
.filter-bar .pill, .field-card,
.select2-container .select2-selection, .select2-dropdown,
.select2-container--default .select2-search--dropdown .select2-search__field,
.dataTables_length select, .dataTables_filter input,
.swal2-input, .swal2-select, .swal2-textarea {
    border-radius: 5px !important;
}

/* ---------- Every Word Capitalised across the app ----------
   Form controls don't inherit text-transform, so they are listed explicitly.
   Emails, passwords, URLs and anything marked .no-caps keep their case. */
input[type=email], input[type=password], input[type=url], .no-caps, .no-caps * { text-transform: none !important; }

/* ---------- one control height: textboxes, dropdowns and 1-line textareas are all 42px ---------- */
.form-control, .form-control-sm { height: 42px; }
textarea.form-control, textarea.form-control-sm {
    height: auto; min-height: 42px !important; line-height: 1.4; padding-top: 7.5px; padding-bottom: 7.5px;
}
.form-control-sm + .select2 .select2-selection--single { height: 42px; min-height: 42px; }
.grid-table td > .btn-xs, .grid-table td > .btn-sm { height: 42px; }

/* ---------- bigger checkboxes, radios and modals ---------- */
input[type=checkbox], input[type=radio] { width: 24px !important; height: 24px !important; cursor: pointer; flex-shrink: 0; vertical-align: middle; }
.modal-box { max-width: 1100px; }
.modal-box.lg { max-width: 1400px; }
.modal-box.sm { max-width: 520px; }
.modal-head { padding: 22px 28px; }
.modal-body { padding: 24px 28px; }
.modal-foot { padding: 16px 28px; }
.modal-head h3 { font-size: 22px; }

/* ---------- filter bars: tidy grid of equal-width boxes ---------- */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-items: center; }
.filter-bar > * { min-width: 0; }
.filter-bar .pill, .filter-bar .pill.sm { width: 100%; min-width: 0 !important; flex: none !important; }
.filter-bar > .btn, .filter-bar > a.btn, .filter-bar > div > .btn { width: 100%; }
.filter-bar .pill .select2-container { min-width: 0; flex: 1; }
.filter-bar input[type=date] { text-transform: none; min-width: 0; }
.pill-lbl { font-size: 18px; font-weight: 700; text-transform: none; color: var(--text-muted); letter-spacing: .4px; white-space: nowrap; }
.req { color: var(--danger) !important; font-weight: 800; margin-left: 2px; }
/* date / time fields keep the browser's own dd/mm/yyyy format */
input[type=date], input[type=datetime-local], input[type=time], input[type=month], input[type=week] { text-transform: none !important; }

/* ---------- Tickets & Notifications (bell, popup, create + chat modals) ---------- */
.tk-bell { position: relative; margin-left: auto; }
.tk-bell + .user-menu { margin-left: 8px; }
.tk-bell-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: #475569; cursor: pointer; }
.tk-bell-btn:hover { background: var(--bg-subtle); }
.tk-badge { position: absolute; top: 3px; right: 2px; min-width: 20px; padding: 1px 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 800; line-height: 16px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tk-popup { position: absolute; right: 0; top: calc(100% + 8px); width: 420px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 24px 50px rgba(15,23,42,.22); overflow: hidden; z-index: 120; }
.tk-popup-head, .tk-box-head { display: flex; align-items: center; gap: 10px; background: #0f172a; color: #fff; padding: 12px 16px; font-weight: 700; font-size: 16px; }
.tk-popup-head > span:first-child, .tk-box-head > span:first-child { margin-right: auto; }
.tk-plus { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #4f46e5; color: #fff; font-size: 18px; font-weight: 800; cursor: pointer; }
.tk-plus:hover { background: #6366f1; }
.tk-x { border: 0; background: none; color: #94a3b8; font-size: 18px; cursor: pointer; padding: 2px 4px; }
.tk-x:hover { color: #fff; }
.tk-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #f1f5f9; border-bottom: 1px solid #e2e8f0; }
.tk-tabs button { padding: 10px 4px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-size: 15px; font-weight: 600; color: #475569; cursor: pointer; }
.tk-tabs button:hover { background: #e2e8f0; }
.tk-tabs button.active { background: #fff; color: #4f46e5; border-bottom-color: #4f46e5; font-weight: 800; }
.tk-count { margin-left: 4px; padding: 0 7px; border-radius: 999px; background: #cbd5e1; color: #334155; font-size: 12px; font-weight: 800; }
.tk-count.red { background: #ef4444; color: #fff; }
.tk-list { max-height: 340px; overflow-y: auto; }
.tk-empty { padding: 30px 16px; text-align: center; color: #94a3b8; font-size: 15px; }
.tk-item { display: flex; gap: 10px; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid #f1f5f9; background: #fff; font: inherit; text-align: left; cursor: pointer; }
.tk-item:hover { background: #f8fafc; }
.tk-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tk-item-top { display: flex; align-items: center; gap: 8px; }
.tk-ref { font-family: var(--font-num); font-weight: 700; color: #4f46e5; font-size: 14px; }
.tk-by { padding: 1px 7px; border-radius: 5px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 600; }
.tk-last { color: #64748b; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: #94a3b8; font-size: 12px; white-space: nowrap; }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; }
.tk-popup-foot { display: flex; justify-content: space-between; gap: 8px; padding: 8px 16px; background: #f8fafc; border-top: 1px solid #e2e8f0; color: #64748b; font-size: 12px; }
.tk-sync { display: inline-flex; align-items: center; gap: 5px; color: #059669; }
.tk-sync i { width: 7px; height: 7px; border-radius: 50%; background: #10b981; animation: tk-pulse 1.6s infinite; }
@keyframes tk-pulse { 50% { opacity: .35; } }

.tk-modal .tk-box { max-width: 520px; padding: 0; border-radius: 18px; overflow: hidden; }
.tk-box-body { padding: 22px 24px; display: flex; flex-direction: column; }
.tk-idrow { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 16px; }
.tk-idrow span { font-size: 14px; font-weight: 700; color: #64748b; text-transform: uppercase; }
.tk-idrow b { font-family: var(--font-num); color: #4f46e5; font-size: 16px; }
.tk-label { display: block; font-size: 15px; font-weight: 700; color: #334155; margin: 0 0 6px; }
.tk-input { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; font-size: 15px; outline: 0; }
.tk-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
textarea.tk-input { resize: vertical; margin-bottom: 16px; }
.tk-file { font-size: 14px; color: #64748b; margin-bottom: 16px; }
.tk-file::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 0; border-radius: 8px; background: #eef2ff; color: #4338ca; font: inherit; font-weight: 700; cursor: pointer; }
.tk-recipients { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 11px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.tk-recipients label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: #334155; cursor: pointer; }
.tk-recipients input { width: 17px; height: 17px; accent-color: #4f46e5; }
.tk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.tk-btn-light, .tk-btn-primary, .tk-btn-success { height: 44px; border: 0; border-radius: 10px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.tk-btn-light { background: #f1f5f9; color: #475569; }
.tk-btn-light:hover { background: #e2e8f0; }
.tk-btn-primary { background: #4f46e5; color: #fff; box-shadow: 0 2px 6px rgba(79,70,229,.3); }
.tk-btn-primary:hover { background: #4338ca; }
.tk-btn-primary:disabled { opacity: .6; cursor: wait; }

.tk-chat { display: flex; flex-direction: column; max-height: 85vh; }
.tk-chat .tk-ref { color: #a5b4fc; font-size: 16px; }
.tk-tag { margin-right: auto; padding: 2px 8px; border-radius: 5px; background: #1e293b; color: #cbd5e1; font-size: 12px; font-weight: 600; }
.tk-to { padding: 6px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; color: #64748b; font-size: 13px; }
.tk-to:empty { display: none; }
.tk-messages { flex: 1; min-height: 160px; overflow-y: auto; padding: 16px; background: #f8fafc; display: flex; flex-direction: column; gap: 12px; }
.tk-msg { display: flex; flex-direction: column; align-items: flex-start; }
.tk-msg.me { align-items: flex-end; }
.tk-meta { color: #94a3b8; font-size: 12px; margin-bottom: 3px; }
.tk-bubble { max-width: 85%; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: #fff; border: 1px solid #e2e8f0; color: #1e293b; font-size: 15px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.tk-msg.me .tk-bubble { border-radius: 14px 14px 4px 14px; background: #4f46e5; border-color: #4f46e5; color: #fff; }
.tk-text { white-space: pre-wrap; word-break: break-word; }
.tk-attach { display: inline-block; margin-top: 6px; font-weight: 700; color: inherit; text-decoration: underline; }
.tk-attach img { display: block; max-width: 220px; max-height: 180px; border-radius: 8px; }
.tk-chat-foot { padding: 12px; background: #fff; border-top: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 8px; }
.tk-reply { display: flex; align-items: center; gap: 8px; }
.tk-bell [hidden], .tk-modal [hidden] { display: none !important; }
.tk-clip { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #f1f5f9; cursor: pointer; font-size: 18px; flex-shrink: 0; }
.tk-clip:hover { background: #e0e7ff; }
.tk-send { width: 40px; height: 40px; border: 0; border-radius: 10px; background: #4f46e5; color: #fff; font-size: 17px; cursor: pointer; flex-shrink: 0; }
.tk-send:hover { background: #4338ca; }
.tk-send:disabled { opacity: .6; cursor: wait; }
.tk-file-note { color: #4f46e5; font-size: 13px; font-weight: 600; }
.tk-closed { padding: 10px; border: 1px solid #fecaca; border-radius: 10px; background: #fef2f2; color: #b91c1c; text-align: center; font-size: 14px; font-weight: 600; }
.tk-close-row { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid #f1f5f9; }
.tk-btn-success { height: 36px; padding: 0 14px; background: #059669; color: #fff; font-size: 14px; }
.tk-btn-success:hover { background: #047857; }
@media (max-width: 600px) { .tk-bell-btn { width: 38px; height: 38px; } }

/* ---------- subscription expiry reminder (settings.expiry_date) ---------- */
.expiry-banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid #f5c16c; border-radius: 12px; background: #fff7e6; color: #7a4a00; font-size: 17px; }
.expiry-banner-icon { font-size: 22px; }
.expiry-banner-text { display: flex; flex-direction: column; gap: 4px; }
.expiry-banner-title { font-size: 19px; }
.sub-expired { width: 100%; max-width: 560px; padding: 32px 28px; border-radius: 22px; background: #fff; box-shadow: 0 18px 40px rgba(15,30,61,.18); text-align: center; }
.sub-expired-icon { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; font-size: 36px; background: #fee2e2; }
.sub-expired h1 { font-size: 30px; color: #b91c1c; }
.sub-lead { margin: 10px 0 16px; font-size: 17px; color: #334155; }
.sub-amount { margin-bottom: 14px; padding: 14px 16px; border: 1px solid #fecaca; border-radius: 12px; background: #fef2f2; color: #7f1d1d; font-size: 18px; }
.sub-amount b { font-size: 22px; }
.sub-amount-sub { margin-top: 6px; font-size: 16px; }
.sub-amount-sub b { font-size: inherit; }
.sub-contact { margin: 0 0 18px; font-size: 17px; color: #1e293b; }
.sub-contact a { font-weight: 700; }
.sub-note { margin: 0 0 18px; color: #64748b; font-size: 15px; }
