/* ==========================================================================
   Opti OMS — application styles (no build step required)
   ========================================================================== */

:root {
    --header-h: 60px;
    --sidebar-w: 248px;

    --c-header: #f3f4f5;
    --c-sidebar: #1e2023;
    --c-sidebar-hover: #2a2d31;
    --c-sidebar-text: #b4b8bf;
    --c-sidebar-muted: #6f747c;

    --c-bg: #ffffff;
    --c-surface: #f6f7f8;
    --c-border: #e3e5e8;
    --c-text: #17191c;
    --c-muted: #626873;

    --c-accent: #0f9488;
    --c-accent-strong: #0b7a70;
    --c-accent-soft: #e5f5f3;
    --c-accent-bright: #fdd700; /* OptiCrane yellow (logo) */

    --c-danger: #c0362c;
    --c-danger-soft: #fdecea;
    --c-warn: #9a5b00;
    --c-warn-soft: #fff5e0;
    --c-success: #1d7a46;
    --c-success-soft: #e6f6ec;

    --radius: 8px;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--c-accent-strong); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
svg.icon { width: 20px; height: 20px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.sidebar :focus-visible, .login :focus-visible { outline-color: var(--c-accent-bright); }

/* ---------- Header ---------- */
.app-header {
    position: fixed; top: 0; right: 0; left: var(--sidebar-w); z-index: 40;
    height: var(--header-h);
    padding-top: env(safe-area-inset-top);
    display: flex; align-items: center; gap: 12px;
    padding-inline: 12px 16px;
    background: var(--c-header);
    color: var(--c-text);
    box-shadow: 0 1px 3px rgba(17, 18, 20, .06), 0 1px 0 rgba(17, 18, 20, .04);
}
.app-header .brand { display: none; color: var(--c-text); }
.app-header .brand span.light { color: var(--c-muted); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; object-fit: contain; flex: none; }
.brand span.light { font-weight: 400; color: #9aa0a8; }
.header-spacer { flex: 1; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 44px; height: 44px; border: 0; border-radius: var(--radius);
    background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(0,0,0,.06); }
.menu-toggle { display: none; }

/* User dropdown */
.user-menu { position: relative; }
.user-trigger {
    display: flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 4px 8px 4px 4px;
    border: 0; border-radius: 999px; background: transparent; color: var(--c-text); cursor: pointer; font: inherit;
}
.user-trigger:hover, .user-trigger[aria-expanded="true"] { background: rgba(0,0,0,.06); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; flex: none;
    background: #3a3e44; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em;
    object-fit: cover;
}
.user-name { font-size: 14px; font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-trigger .chev { width: 16px; height: 16px; color: var(--c-muted); transition: transform .15s; }
.user-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }

.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 230px; padding: 6px;
    background: #fff; color: var(--c-text);
    border: 1px solid var(--c-border); border-radius: 10px; box-shadow: var(--shadow-pop);
    display: none;
}
.dropdown.open { display: block; }
.dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 6px; }
.dropdown-head strong { display: block; font-size: 14px; }
.dropdown-head small { color: var(--c-muted); font-size: 12.5px; word-break: break-all; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 42px; padding: 8px 12px; border: 0; border-radius: 6px;
    background: none; color: var(--c-text); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; text-align: left;
}
.dropdown-item:hover { background: var(--c-surface); }
.dropdown-item svg { width: 18px; height: 18px; color: var(--c-muted); }
.dropdown-item.danger { color: var(--c-danger); }
.dropdown-item.danger svg { color: var(--c-danger); }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    width: var(--sidebar-w);
    background: var(--c-sidebar); color: var(--c-sidebar-text);
    overflow-y: auto; overscroll-behavior: contain;
    padding: 0 10px calc(20px + env(safe-area-inset-bottom));
}
.sidebar-brand {
    height: var(--header-h); display: flex; align-items: center;
    margin: 0 -10px 14px; padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-heading {
    margin: 18px 12px 6px;
    font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-sidebar-muted);
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    min-height: 44px; padding: 8px 12px; margin-bottom: 2px;
    border-radius: var(--radius);
    color: var(--c-sidebar-text); text-decoration: none; font-size: 14.5px; font-weight: 500;
    position: relative;
}
.nav-link:hover { background: var(--c-sidebar-hover); color: #fff; }
.nav-link.active { background: var(--c-sidebar-hover); color: #fff; }
.nav-link.active::before {
    content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
    background: var(--c-accent-bright);
}
.nav-link.active svg { color: var(--c-accent-bright); }
.sidebar-backdrop { display: none; }

/* Collapsible menu groups */
.nav-parent { width: 100%; border: 0; background: none; font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; text-align: left; }
.nav-parent .nav-caret { width: 16px; height: 16px; margin-left: auto; color: var(--c-sidebar-muted); transition: transform .15s; }
.nav-group.open > .nav-parent .nav-caret { transform: rotate(180deg); }
.nav-parent.has-active { color: #fff; }
.nav-parent.has-active > svg:first-child { color: var(--c-accent-bright); }
.nav-sub { display: none; position: relative; margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid #3a3e44; }
.nav-group.open > .nav-sub { display: block; }
.nav-sublink {
    display: flex; align-items: center; min-height: 40px; padding: 8px 12px; margin-bottom: 1px; border-radius: 6px;
    color: var(--c-sidebar-text); text-decoration: none; font-size: 14px; position: relative;
}
.nav-sublink:hover { background: var(--c-sidebar-hover); color: #fff; }
.nav-sublink.active { color: #fff; background: var(--c-sidebar-hover); font-weight: 600; }
.nav-sublink.active::before {
    content: ""; position: absolute; left: -13px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--c-accent-bright);
}

/* ---------- Work area ---------- */
.main {
    margin-left: var(--sidebar-w);
    padding-top: var(--header-h);
    min-height: 100vh; min-height: 100dvh;
    background: var(--c-bg);
}
.content { padding: 28px 32px 48px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.015em; }
.page-head p { margin: 4px 0 0; color: var(--c-muted); }
.breadcrumb { font-size: 13px; color: var(--c-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--c-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-text); text-decoration: underline; }

/* ---------- Cards / panels ---------- */
.card { border: 1px solid var(--c-border); border-radius: 10px; background: #fff; }
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { font-size: 15px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.stat { padding: 18px 20px; }
.stat .label { font-size: 13px; color: var(--c-muted); }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.tile {
    display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px;
    text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: #c9cdd2; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.tile-icon { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--c-accent-soft); color: var(--c-accent-strong); flex: none; }
.tile h3 { font-size: 15px; font-weight: 600; }
.tile p { margin: 2px 0 0; color: var(--c-muted); font-size: 13.5px; }
.empty {
    border: 1px dashed #cfd3d8; border-radius: 10px; padding: 40px 24px; text-align: center; color: var(--c-muted);
}
.empty h2 { font-size: 16px; color: var(--c-text); margin-bottom: 4px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border-radius: var(--radius);
    border: 1px solid transparent; font: inherit; font-size: 14.5px; font-weight: 600;
    text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-strong); }
.btn-secondary { background: #fff; color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-surface); }
.btn-danger { background: #fff; color: var(--c-danger); border-color: #efc3bf; }
.btn-danger:hover { background: var(--c-danger-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn-link { background: none; border: 0; color: var(--c-accent-strong); padding: 0 6px; min-height: 36px; font-weight: 600; }
.btn-link.danger { color: var(--c-danger); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms (mobile-first: 16px inputs prevent iOS zoom) ---------- */
.form { max-width: 720px; }
.form-section { padding: 20px; border-bottom: 1px solid var(--c-border); }
.form-section:last-of-type { border-bottom: 0; }
.form-section h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label, .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--c-muted); margin-top: 5px; }
.input, select.input, textarea.input {
    width: 100%; min-height: 46px; padding: 10px 12px;
    font: inherit; font-size: 16px; color: var(--c-text);
    background: #fff; border: 1px solid #cfd3d8; border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(15, 148, 136, .18); }
.input.is-invalid { border-color: var(--c-danger); }
.error { color: var(--c-danger); font-size: 13px; margin-top: 5px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; min-height: 32px; margin: 0; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--c-accent); flex: none; }
.check small { display: block; color: var(--c-muted); font-weight: 400; font-size: 13px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; }
.form-footer { padding: 16px 20px; background: var(--c-surface); border-top: 1px solid var(--c-border); border-radius: 0 0 10px 10px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.search { display: flex; gap: 8px; max-width: 420px; width: 100%; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 20px; border: 1px solid; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-success { background: var(--c-success-soft); color: var(--c-success); border-color: #bfe5cd; }
.alert-error { background: var(--c-danger-soft); color: var(--c-danger); border-color: #f3c4bf; }
.alert-warn { background: var(--c-warn-soft); color: var(--c-warn); border-color: #f4dba8; }

/* ---------- Tables (become cards on mobile) ---------- */
.table-wrap { border: 1px solid var(--c-border); border-radius: 10px; overflow: hidden; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); background: var(--c-surface); padding: 11px 16px; border-bottom: 1px solid var(--c-border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfb; }
.table .num { text-align: right; }
.table .row-actions { text-align: right; white-space: nowrap; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user .avatar { background: #e8eaed; color: #3f444b; }
.cell-user small { display: block; color: var(--c-muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f2; color: #3f444b; margin: 1px 2px 1px 0; white-space: nowrap; }
.badge-accent { background: var(--c-accent-soft); color: var(--c-accent-strong); }
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-muted { background: #f1f1f1; color: #8a8f96; }
.mono { font-family: var(--mono); font-size: 13px; }
.pagination { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0 10px; border: 1px solid var(--c-border); border-radius: 6px; text-decoration: none; color: var(--c-text); font-size: 14px; }
.pagination .current { background: var(--c-text); color: #fff; border-color: var(--c-text); }
.pagination .disabled { color: #b8bcc2; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .menu-toggle { display: inline-grid; }
    .app-header { left: 0; }
    .app-header .brand { display: flex; }
    .sidebar { top: var(--header-h); z-index: 30; }
    .sidebar-brand { display: none; }
    .sidebar { padding-top: 14px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; }
    body.nav-open .sidebar { transform: none; box-shadow: 12px 0 30px rgba(0,0,0,.25); }
    body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 25; background: rgba(0,0,0,.4); }
    body.nav-open { overflow: hidden; }
    .main { margin-left: 0; }
    .content { padding: 22px 18px 40px; }
}

@media (max-width: 640px) {
    .user-name, .user-trigger .chev { display: none; }
    .user-trigger { padding: 4px; }
    .brand { font-size: 16px; }
    .page-head h1 { font-size: 21px; }
    .page-head .actions, .page-head .btn { width: 100%; }
    .field-row { grid-template-columns: 1fr; }
    .form-footer .btn { flex: 1; }
    .dropdown { position: fixed; left: 10px; right: 10px; top: calc(var(--header-h) + 6px); min-width: 0; }

    /* Stack table rows as cards */
    .table-wrap { border: 0; border-radius: 0; overflow: visible; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border: 1px solid var(--c-border); border-radius: 10px; margin-bottom: 12px; padding: 6px 0; }
    .table td { border: 0; padding: 6px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
    .table td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); text-align: left; }
    .table td.cell-primary { display: block; text-align: left; padding-top: 10px; }
    .table td.row-actions { justify-content: flex-end; border-top: 1px solid var(--c-border); margin-top: 6px; padding-top: 8px; }
}

/* ==========================================================================
   Toolbar (filter bars above lists / card grids)
   ========================================================================== */
.toolbar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-bottom: 22px; }
.tb-group {
    display: flex; align-items: stretch; height: 44px;
    background: #fff; border: 1px solid #d9dce0; border-radius: 6px;
}
.tb-group > * + * { border-left: 1px solid #d9dce0; }
.tb-spacer { flex: 1; }
.tb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 3px;
    min-width: 46px; height: 100%; padding: 0 11px; border: 0; background: none; color: #3f444b; cursor: pointer;
    text-decoration: none; position: relative;
}
.tb-btn:hover { background: var(--c-surface); }
.tb-group > :first-child, .tb-group > :first-child .tb-btn { border-radius: 5px 0 0 5px; }
.tb-group > :last-child, .tb-group > :last-child .tb-btn { border-radius: 0 5px 5px 0; }
.tb-group > :only-child { border-radius: 5px; }
.tb-btn .caret { width: 13px; height: 13px; }
.tb-btn[aria-pressed="true"] { color: var(--c-accent-strong); background: var(--c-accent-soft); }
.tb-btn[aria-pressed="false"] { color: #9aa0a8; }
.tb-dot { display: none; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--c-accent); }
.tb-btn.is-filtered .tb-dot { display: block; }
.tb-menu { position: relative; display: flex; }
.tb-dropdown { left: 0; right: auto; z-index: 60; min-width: 220px; }
.tb-dropdown-title { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.tb-option { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px; margin: 0; border-radius: 6px; font-weight: 400; font-size: 14px; cursor: pointer; }
.tb-option:hover { background: var(--c-surface); }
.tb-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--c-accent); }

.tb-search { flex: 0 1 412px; min-width: 240px; }
.tb-search-icon { display: grid; place-items: center; padding-left: 12px; color: #7a8089; }
.tb-search > .tb-search-icon + input { border-left: 0; }
.tb-input {
    flex: 1; min-width: 0; border: 0; background: none; padding: 0 10px; font: inherit; font-size: 16px; color: var(--c-text);
}
.tb-input:focus { outline: none; }
.tb-input::placeholder { color: #8a9098; }
.tb-group:has(input:focus, select:focus) { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(15, 148, 136, .14); }

.tb-select { position: relative; flex: 0 1 320px; min-width: 200px; }
.tb-select-wide { flex-basis: 356px; }
.tb-native {
    -webkit-appearance: none; appearance: none; width: 100%; height: 100%;
    border: 0; background: none; padding: 0 58px 0 14px; font: inherit; font-size: 16px; color: var(--c-text); cursor: pointer;
}
.tb-native:focus { outline: none; }
.tb-native:invalid, .tb-native.is-placeholder { color: #8a9098; }
.tb-select-caret {
    position: absolute; right: 0; top: 0; bottom: 0; width: 46px; pointer-events: none;
    display: grid; place-items: center; border-left: 1px solid #d9dce0; color: #3f444b;
}
.tb-select-caret svg { width: 16px; height: 16px; }

/* ==========================================================================
   Asset type cards
   ========================================================================== */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px 24px; }
.asset-card {
    --type-color: #8f8f8f;
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 22px 16px 26px; background: #fff; color: var(--c-text); text-decoration: none;
    border: 1px solid #e6e8eb; border-bottom: 0; border-radius: 6px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(17, 18, 20, .06);
    transition: box-shadow .15s, transform .15s;
}
.asset-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: var(--type-color); }
.asset-card:hover { box-shadow: 0 6px 18px rgba(17, 18, 20, .1); transform: translateY(-1px); }
.asset-card[hidden] { display: none; }
.asset-icon {
    width: 74px; height: 74px; border-radius: 5px; display: grid; place-items: center; margin-bottom: 18px;
    background: var(--type-color); color: #fff;
}
.asset-icon svg { width: 40px; height: 40px; stroke-width: 2; }
.asset-count {
    position: absolute; top: 12px; right: 12px; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 4px;
    display: grid; place-items: center; background: #767b82; color: #fff; font-size: 15px; font-variant-numeric: tabular-nums;
}
.hide-counts .asset-count { display: none; }
.asset-line { font-size: 17px; line-height: 1.5; }
.asset-name { font-size: 17px; line-height: 1.5; font-weight: 700; margin-bottom: 6px; }
.asset-summary { margin-top: 18px; font-size: 13px; color: var(--c-muted); }

@media (max-width: 1200px) {
    .tb-spacer { display: none; }
}
@media (max-width: 640px) {
    .toolbar { gap: 8px; }
    .tb-search { flex: 1 1 100%; min-width: 0; }
    .tb-select, .tb-select-wide { flex: 1 1 100%; min-width: 0; }
    .tb-select:not(.tb-select-wide) { flex: 1 1 calc(50% - 4px); }
    .tb-select .tb-native { padding-right: 50px; }
    .tb-select-caret { width: 40px; }
    .tb-dropdown.open.is-sheet { position: fixed; left: 10px; right: 10px; min-width: 0; }
    .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .asset-card { padding: 16px 10px 20px; }
    .asset-icon { width: 56px; height: 56px; margin-bottom: 12px; }
    .asset-icon svg { width: 30px; height: 30px; }
    .asset-count { top: 8px; right: 8px; min-width: 24px; height: 24px; font-size: 13px; }
    .asset-line, .asset-name { font-size: 14.5px; }
}

/* ==========================================================================
   Data grid
   ========================================================================== */
.grid-head { align-items: flex-end; margin-bottom: 16px; }
.asset-type-label { font-size: 14px; color: var(--c-text); }
.grid-toolbar { margin-bottom: 14px; }
.tb-btn:disabled { color: #c3c7cc; cursor: not-allowed; background: none; }

.grid-panel { border: 1px solid #d9dce0; border-radius: 8px; background: #fff; overflow: hidden; }
.grid-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid #e3e5e8; }
.grid-hint { font-size: 14px; color: var(--c-muted); }
.grid-search { display: flex; align-items: center; gap: 8px; border: 1px solid #d9dce0; border-radius: 6px; padding: 0 10px; height: 40px; width: 340px; max-width: 100%; }
.grid-search svg { width: 18px; height: 18px; color: #7a8089; }
.grid-search input { border: 0; outline: none; flex: 1; min-width: 0; font: inherit; font-size: 16px; background: none; }
.grid-search:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(15, 148, 136, .14); }

.grid-scroll { overflow: auto; max-height: calc(100vh - 330px); max-height: calc(100dvh - 330px); min-height: 280px; -webkit-overflow-scrolling: touch; }
.dgrid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 14px; }
.dgrid th, .dgrid td { padding: 0 10px; height: 44px; border-bottom: 1px solid #eceef0; white-space: nowrap; text-align: left; background: #fff; }
.dgrid thead th, .dgrid thead td { position: sticky; z-index: 2; background: #fff; }
.dgrid .dgrid-head th { top: 0; height: 48px; font-weight: 600; border-bottom: 1px solid #e3e5e8; border-top: 2px solid var(--c-accent); }
.dgrid .dgrid-filters td { top: 50px; height: 46px; border-bottom: 1px solid #d9dce0; background: #fafbfb; }
.dgrid tbody tr:nth-child(4n+3) td { background: #f8f9fa; }
.dgrid tbody tr.dgrid-row:hover td { background: #f1f6f5; }
.dgrid tbody tr.is-selected td { background: var(--c-accent-soft); }
.dgrid .sort-link { display: inline-flex; align-items: center; gap: 4px; color: var(--c-text); text-decoration: none; }
.dgrid .sort-link:hover { color: var(--c-accent-strong); text-decoration: none; }
.sort-ind { width: 14px; height: 14px; color: var(--c-accent-strong); }
.dgrid th svg.icon { width: 19px; height: 19px; color: #50565e; }

/* Sticky left columns: expand, select, asset number */
.dgrid .c-sticky { position: sticky; z-index: 1; }
.dgrid thead .c-sticky { z-index: 3; }
.dgrid .c-expand { left: 0; width: 44px; min-width: 44px; text-align: center; padding: 0; }
.dgrid .c-check { left: 44px; width: 44px; min-width: 44px; text-align: center; padding: 0; }
.dgrid .c-asset { left: 88px; box-shadow: inset -1px 0 0 #e3e5e8; }
.c-check input { width: 18px; height: 18px; accent-color: var(--c-accent); cursor: pointer; vertical-align: middle; }
.row-expand { width: 36px; height: 36px; border: 0; background: none; color: #50565e; cursor: pointer; border-radius: 6px; display: inline-grid; place-items: center; }
.row-expand:hover { background: #eceef0; }
.row-expand svg { width: 18px; height: 18px; }
.row-expand span { display: grid; }
.row-expand .i-open, .row-expand.open .i-closed { display: none; }
.row-expand.open .i-open { display: grid; }
.asset-cell { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dgrid a { color: #1d6fe0; text-decoration: none; }
.dgrid a:hover { text-decoration: underline; }
.row-kebab { width: 30px; height: 34px; border: 0; background: none; cursor: pointer; color: #50565e; border-radius: 6px; display: grid; place-items: center; }
.row-kebab:hover { background: #eceef0; }
.row-kebab svg { width: 18px; height: 18px; }
.row-menu .tb-dropdown { top: 100%; }

.dgrid .c-icon { text-align: center; padding: 0 6px; }
.flag { display: inline-grid; place-items: center; color: #c5c9ce; }
.flag svg { width: 19px; height: 19px; }
.flag.on { color: #3f444b; }
.c-bool { text-align: center !important; }
.tick { color: var(--c-accent-strong); font-weight: 700; font-size: 16px; }
.mono-cell { font-family: var(--mono); font-size: 13px; }
.c-date { font-variant-numeric: tabular-nums; }
.dgrid-empty { text-align: center !important; color: var(--c-muted); height: 120px !important; }

/* Column filters */
.cf { width: 100%; height: 34px; border: 1px solid #dcdfe3; border-radius: 5px; background: #fff; font: inherit; font-size: 14px; color: var(--c-text); padding: 0 8px; }
select.cf { padding-right: 24px; }
.cf-text { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.cf-text svg { width: 15px; height: 15px; color: #8a9098; flex: none; }
.cf-text input { border: 0; outline: none; flex: 1; min-width: 0; font: inherit; font-size: 14px; background: none; }
.cf:focus, .cf-text:focus-within { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 2px rgba(15, 148, 136, .15); }

/* Expanded detail row */
.dgrid-detail td { white-space: normal; height: auto; padding: 14px 18px 16px 98px; background: #fbfcfc !important; }
.detail-list { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 24px; max-width: 1100px; }
.detail-list dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); }
.detail-list dd { margin: 2px 0 0; }
.detail-list .wide { grid-column: 1 / -1; }

/* Footer: page sizes, selection, pager */
.grid-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid #e3e5e8; font-size: 14px; }
.page-sizes { display: flex; gap: 2px; }
.page-sizes a, .pager-links a, .pager-links span { min-width: 40px; height: 40px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 6px; color: var(--c-text); text-decoration: none; }
.page-sizes a:hover, .pager-links a:hover { background: #eceef0; }
.page-sizes a.current, .pager-links .current { background: #eceef0; font-weight: 600; }
.sel-count { color: var(--c-muted); }
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager-info { color: var(--c-text); }
.pager-links { display: flex; align-items: center; gap: 2px; }
.pager-links svg { width: 18px; height: 18px; }
.pager-links .disabled { color: #c3c7cc; }
.pager-links .dots { min-width: 24px; color: var(--c-muted); }

@media (max-width: 991px) {
    .grid-scroll { max-height: calc(100dvh - 300px); }
}
@media (max-width: 640px) {
    .asset-type-label { font-size: 13px; color: var(--c-muted); }
    .grid-search { width: 100%; }
    .grid-hint { width: 100%; }
    .grid-scroll { max-height: 68vh; max-height: 68dvh; }
    .dgrid .c-asset { min-width: 140px !important; }
    .dgrid-detail td { padding-left: 16px; }
    .detail-list { grid-template-columns: 1fr 1fr; position: sticky; left: 16px; max-width: calc(100vw - 70px); }
    .grid-foot { justify-content: center; text-align: center; }
    .sel-count { width: 100%; order: 3; }
    .pager { justify-content: center; width: 100%; }
    .pager-links a, .pager-links span { min-width: 36px; }
}

/* ==========================================================================
   Record forms (wide, sectioned, mobile-first)
   ========================================================================== */
.form-wide { max-width: 900px; }
.form-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--c-muted); margin-top: 4px; }
.input-prefix { display: flex; align-items: stretch; }
.readonly-note { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px; border: 1px dashed #cfd3d8; border-radius: var(--radius); background: var(--c-surface); font-family: var(--mono); font-size: 15px; }
textarea.input { min-height: 110px; resize: vertical; }
.form-footer .spacer { flex: 1; }
@media (max-width: 640px) {
    .form-footer { position: sticky; bottom: 0; z-index: 5; border-radius: 0; margin: 0 -1px -1px; box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
    .form-footer .spacer { display: none; }
}

/* ==========================================================================
   Login
   ========================================================================== */
.login { display: grid; grid-template-columns: minmax(380px, 520px) 1fr; min-height: 100vh; min-height: 100dvh; }
.login-panel {
    background: #000; color: #f2f3f4;
    display: flex; flex-direction: column;
    padding: 40px 56px calc(28px + env(safe-area-inset-bottom));
}
.login-panel .brand { font-size: 20px; }
.login-panel .brand-mark { width: 38px; height: 38px; }
.login-form { margin: auto 0; padding: 48px 0; width: 100%; max-width: 380px; }
.login-form h1 { font-size: 30px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 6px; }
.login-form .lede { color: #8d939b; margin: 0 0 30px; }
.login label { color: #e3e5e8; }
.login .input {
    background: #121315; border-color: #34373c; color: #fff; min-height: 50px;
}
.login .input::placeholder { color: #61666e; }
.login .input:focus { border-color: var(--c-accent-bright); box-shadow: 0 0 0 3px rgba(253, 215, 0, .22); }
.login .input.is-invalid { border-color: #ef6b5f; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 3px; top: 3px; width: 44px; height: 44px; border: 0; background: none; color: #8d939b; cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.pw-toggle:hover { color: #fff; }
.login .check { color: #d4d7db; font-size: 14.5px; }
.login .check input { accent-color: var(--c-accent-bright); }
.public-warning {
    display: none; gap: 10px; margin-top: 10px; padding: 11px 13px; border-radius: var(--radius);
    background: rgba(245, 166, 35, .12); border: 1px solid rgba(245, 166, 35, .45); color: #f7c873; font-size: 13.5px; line-height: 1.45;
}
.public-warning.show { display: flex; }
.public-warning svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.login .btn-primary { width: 100%; min-height: 50px; font-size: 15.5px; background: var(--c-accent-bright); color: #17140a; margin-top: 22px; }
.login .btn-primary:hover { background: #ffe34d; }
.divider { display: flex; align-items: center; gap: 14px; margin: 26px 0 18px; color: #6c7179; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #2a2d31; }
.sso { display: grid; gap: 10px; }
.btn-sso { width: 100%; min-height: 50px; background: #fff; color: #1f1f1f; border-color: #fff; font-weight: 600; }
.btn-sso:hover { background: #ececec; }
.btn-sso svg { width: 20px; height: 20px; }
.btn-sso[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.login .alert-error { background: rgba(239, 107, 95, .12); color: #ff9d94; border-color: rgba(239, 107, 95, .4); }
.login .alert-success { background: rgba(253, 215, 0, .1); color: #ffe566; border-color: rgba(253, 215, 0, .35); }
.login-foot { color: #5c6168; font-size: 12.5px; }

.login-visual {
    position: relative; overflow: hidden;
    background: #f3f4f2;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 56px;
    background-image:
        linear-gradient(#e2e4e1 1px, transparent 1px),
        linear-gradient(90deg, #e2e4e1 1px, transparent 1px);
    background-size: 48px 48px;
}
.login-visual::after {
    content: ""; position: absolute; right: -14%; top: -18%; width: 70%; aspect-ratio: 1;
    border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe34d 0%, #fdd700 40%, rgba(253,215,0,0) 70%);
    opacity: .9;
}
.visual-copy { position: relative; z-index: 1; max-width: 560px; }
.visual-copy .kicker { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8a7400; }
.visual-copy h2 { font-size: clamp(34px, 4vw, 56px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; margin: 14px 0 16px; color: #111214; }
.visual-copy p { color: #4f555d; font-size: 16px; max-width: 440px; margin: 0; }

@media (max-width: 900px) {
    .login { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-panel { padding: 28px 22px calc(24px + env(safe-area-inset-bottom)); }
    .login-form { max-width: 440px; margin: auto; padding: 36px 0; }
    .login-form h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.mono-input { font-family: var(--mono); }
.req { color: var(--c-danger); }
.dgrid td[data-col="assigned_to"], .dgrid td[data-col="client"] { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.content:has(.grid-page) { max-width: none; }
.cf-text input { width: 0; }
.field-row { margin-bottom: 16px; }
.field-row:last-child { margin-bottom: 0; }
.field-row > .field { margin-bottom: 0; }

/* ==========================================================================
   Dialogs (native <dialog>)
   ========================================================================== */
dialog.dlg {
    padding: 0; border: 0; border-radius: 12px; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25); color: var(--c-text);
}
dialog.dlg-wide { width: min(720px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(17, 18, 20, .45); }
dialog.dlg > form, dialog.dlg { display: flex; flex-direction: column; }
dialog.dlg:not([open]) { display: none; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--c-border); }
.dlg-head h2 { font-size: 17px; }
.dlg-head .icon-btn { color: var(--c-muted); }
.dlg-head .icon-btn:hover { background: var(--c-surface); }
.dlg-body { padding: 18px 20px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--c-border); background: var(--c-surface); }
.dlg-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--c-border); }
.dlg-tabs button { border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--c-muted); padding: 11px 12px; border-bottom: 2px solid transparent; cursor: pointer; }
.dlg-tabs button.active { color: var(--c-accent-strong); border-bottom-color: var(--c-accent); }
.new-list { margin-top: 6px; border: 1px dashed #cfd3d8; border-radius: var(--radius); padding: 10px 14px; }
.new-list summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--c-accent-strong); }
.new-list[open] summary { margin-bottom: 12px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.icon-choice { height: 56px; border: 1px solid var(--c-border); border-radius: 8px; background: #fff; cursor: pointer; display: grid; place-items: center; color: #3f444b; }
.icon-choice:hover { border-color: var(--c-accent); color: var(--c-accent-strong); }
.icon-choice svg { width: 26px; height: 26px; }
form.inline { display: inline; }

/* ==========================================================================
   Asset Definition Manager
   ========================================================================== */
.content:has(.adm) { max-width: none; }
.adm { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.adm-tree { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100dvh - var(--header-h) - 32px); display: flex; flex-direction: column; overflow: hidden; }
.adm-tree-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--c-border); display: grid; gap: 10px; }
.adm-title { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.adm-title svg { width: 22px; height: 22px; }
.adm-tree-tools { height: 40px; width: max-content; }
.adm-tree-tools .tb-btn { min-width: 42px; }
.adm-search { width: 100%; }
.adm-tree-body { overflow-y: auto; padding: 8px 8px 14px; font-size: 14px; }
.tree-node > summary { list-style: none; cursor: pointer; padding: 6px 8px; border-radius: 6px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tree-node > summary::-webkit-details-marker { display: none; }
.tree-node > summary::before { content: ""; width: 0; height: 0; border-left: 5px solid #50565e; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .12s; }
.tree-node[open] > summary::before { transform: rotate(90deg); }
.tree-node > summary:hover { background: var(--c-surface); }
.tree-node .tree-node { margin-left: 14px; }
.tree-node .tree-node > summary { font-weight: 500; }
.tree-node ul { list-style: none; margin: 0 0 4px 22px; padding: 0; }
.tree-node li a, .adm-builtin a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--c-text); text-decoration: none; min-height: 36px; }
.tree-node li a:hover, .adm-builtin a:hover { background: var(--c-surface); }
.tree-node li a.current { background: var(--c-accent-soft); color: var(--c-accent-strong); font-weight: 600; }
.tree-node li a.inactive { color: #9aa0a8; }
.tree-node li a small { margin-left: auto; color: var(--c-muted); font-size: 12px; }
.tree-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.adm-builtin { padding: 0 4px; font-size: 13px; }
.adm-builtin a { color: var(--c-muted); }
.adm-empty-tree { color: var(--c-muted); text-align: center; padding: 18px 8px; line-height: 2; }
.adm-placeholder { padding: 80px 24px; }
.adm-placeholder > svg { width: 64px; height: 64px; color: #c5c9ce; }

.adm-header { margin-bottom: 18px; }
.adm-header-top { display: flex; align-items: flex-start; gap: 16px; padding: 18px 18px 6px; }
.adm-icon { width: 64px; height: 64px; border-radius: 8px; border: 0; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.adm-icon svg { width: 34px; height: 34px; stroke-width: 2; }
.adm-names { flex: 1; min-width: 0; }
.adm-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 22px; color: var(--c-muted); }
.crumb-input { font: inherit; font-size: 22px; font-weight: 600; color: var(--c-text); border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; background: transparent; min-width: 60px; field-sizing: content; max-width: 100%; }
.crumb-input:hover { border-color: var(--c-border); }
.crumb-input:focus { outline: none; border-color: var(--c-accent); background: #fff; box-shadow: 0 0 0 3px rgba(15,148,136,.14); }
.crumb-input.crumb-type { font-weight: 700; }
.crumb-input.is-invalid { border-color: var(--c-danger); }
.card-head .crumb-input, .section-name { font-size: 16px; }
.adm-desc { width: 100%; margin-top: 4px; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 14px; color: var(--c-muted); resize: vertical; background: transparent; field-sizing: content; min-height: 30px; }
.adm-desc:hover { border-color: var(--c-border); }
.adm-desc:focus { outline: none; border-color: var(--c-accent); color: var(--c-text); background: #fff; }
.adm-more { margin-left: auto; }
.adm-more > .tb-btn { border: 1px solid var(--c-border); border-radius: 6px; height: 40px; }
.adm-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 22px; padding: 14px 18px 16px; }
.adm-setting .label, .adm-setting label:not(.check) { font-size: 13px; }
.adm-flags { display: grid; gap: 4px; }
.adm-flags .check { font-size: 14px; }
.color-pick { display: flex; gap: 10px; align-items: flex-start; }
.color-pick input[type=color] { width: 46px; height: 46px; padding: 2px; border: 1px solid #cfd3d8; border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.swatches { display: grid; grid-template-columns: repeat(8, 20px); gap: 4px; }
.swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,.1); cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.15); }
.adm-header-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--c-border); background: var(--c-surface); border-radius: 0 0 10px 10px; }
.adm-header-foot .spacer { flex: 1; }
.adm-header-foot .badge { margin-left: 4px; }

.adm-tabs { display: flex; align-items: flex-end; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--c-border); margin-bottom: -1px; position: relative; z-index: 1; }
.adm-tabs a { padding: 10px 16px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; text-decoration: none; color: var(--c-muted); font-weight: 600; font-size: 14px; }
.adm-tabs a small { font-weight: 400; color: #9aa0a8; margin-left: 4px; }
.adm-tabs a:hover { color: var(--c-text); background: var(--c-surface); }
.adm-tabs a.active { background: #fff; color: var(--c-accent-strong); border-color: var(--c-border); box-shadow: inset 0 2px 0 var(--c-accent); }
.adm-tab-add { width: 34px; height: 34px; margin: 0 0 4px 6px; border-radius: 50%; border: 0; background: var(--c-accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
.adm-tab-add svg { width: 18px; height: 18px; }
.adm-section { border-top-left-radius: 0; }
.adm-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--c-border); }
.adm-section-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; flex: 1; min-width: 260px; }
.input-sm { min-height: 38px; padding: 6px 10px; font-size: 14px; flex: 1; min-width: 220px; }
.adm-el-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; }
.adm-el-toolbar .hint { margin: 0; }
.adm-el-table { margin: 0 16px 16px; overflow-x: auto; }
.adm-el-table .table td, .adm-el-table .table th { padding: 9px 12px; }
.order-cell { white-space: nowrap; }
.icon-mini { width: 32px; height: 32px; border: 1px solid var(--c-border); border-radius: 6px; background: #fff; color: #50565e; cursor: pointer; display: inline-grid; place-items: center; }
.icon-mini:disabled { opacity: .35; cursor: default; }
.icon-mini svg { width: 15px; height: 15px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: #1d6fe0; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.caption-cell { color: #c2650a; font-size: 13px; max-width: 220px; white-space: normal; }
.perm-table td, .perm-table th { padding: 8px 10px; }
.perm-table input { width: 20px; height: 20px; accent-color: var(--c-accent); }

@media (max-width: 1100px) {
    .adm { grid-template-columns: 1fr; }
    .adm-tree { position: static; max-height: 360px; }
}
@media (max-width: 640px) {
    .adm-header-top { flex-wrap: wrap; }
    .adm-icon { width: 52px; height: 52px; }
    .crumb-input, .adm-crumbs { font-size: 18px; }
    .adm-el-table { margin: 0 12px 12px; }
    .adm-el-table .table td.order-cell { justify-content: flex-start; }
    .swatches { grid-template-columns: repeat(8, 22px); }
    .swatch { width: 22px; height: 22px; }
}

/* ==========================================================================
   Dynamic asset forms
   ========================================================================== */
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.type-chip { width: 34px; height: 34px; border-radius: 6px; display: inline-grid; place-items: center; color: #fff; flex: none; }
.type-chip svg { width: 20px; height: 20px; stroke-width: 2; }
.form-collapsible > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.form-collapsible > summary::-webkit-details-marker { display: none; }
.form-collapsible > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid #7a8089; border-bottom: 2px solid #7a8089; transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; }
.form-collapsible[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.form-collapsible > summary h2 { margin: 0; }
.form-collapsible[open] > summary { margin-bottom: 14px; }
.section-desc { margin: -6px 0 14px; }
.dyn-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dyn-field { margin: 0; }
.dyn-field.wide { grid-column: 1 / -1; }
.label-mobile { display: none; }
.caption { margin-top: 5px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: #c2650a; text-transform: uppercase; }
.check-lg { min-height: 46px; align-items: center; font-weight: 600; }
.check-lg input { width: 22px; height: 22px; margin: 0; }
.input-unit { display: flex; align-items: stretch; }
.input-unit .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-unit .unit { display: grid; place-items: center; padding: 0 12px; border: 1px solid #cfd3d8; border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--c-surface); color: var(--c-muted); font-size: 14px; }
.input-unit .input:only-child { border-radius: var(--radius); }
.slider-row { display: flex; align-items: center; gap: 14px; min-height: 46px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--c-accent); height: 32px; }
.slider-out { min-width: 64px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.photo-list, .photo-preview, .thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-item { position: relative; width: 120px; margin: 0; }
.photo-item img, .photo-preview img, .thumbs img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--c-border); display: block; }
.thumbs img { width: 72px; height: 54px; }
.photo-keep { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; margin-top: 4px; }
.photo-add { position: relative; margin: 10px 0 8px; overflow: hidden; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-preview:empty { display: none; }
.pad { width: 100%; height: 170px; border: 1px dashed #b9bec5; border-radius: 8px; background: #fff; touch-action: none; display: block; cursor: crosshair; }
.pad-sketch { height: 320px; }
.pad-tools { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.pad-tools .hint { margin: 0; flex: 1; }
.pad-colors { display: flex; gap: 6px; }
.pad-colors .swatch { width: 26px; height: 26px; border-radius: 50%; }
.pad-colors .swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c-text); }
.pad-existing { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pad-existing img { max-width: 320px; width: 100%; border: 1px solid var(--c-border); border-radius: 8px; background: #fff; }
.sig-thumb { max-width: 220px; border: 1px solid var(--c-border); border-radius: 6px; background: #fff; }
.num-cell { text-align: right !important; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
    .dyn-fields { grid-template-columns: 1fr; }
    .label-mobile { display: inline; }
    .label-mobile + .req, .label-desktop { }
    .dyn-field label .label-desktop:has(+ .label-mobile) { display: none; }
    .pad-sketch { height: 260px; }
    .photo-item, .photo-item img, .photo-preview img { width: 96px; }
    .photo-item img, .photo-preview img { height: 72px; }
}
.asset-card-new { border: 2px dashed #cfd3d8; box-shadow: none; justify-content: center; color: var(--c-muted); }
.asset-card-new::after { display: none; }
.asset-card-new .asset-icon { background: var(--c-surface); color: var(--c-muted); }
.asset-card-new:hover { border-color: var(--c-accent); color: var(--c-accent-strong); }
.group-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 12px; }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.forgot-link, .login-alt a { color: var(--c-accent-bright); font-size: 14px; text-decoration: none; font-weight: 500; }
.forgot-link:hover, .login-alt a:hover { text-decoration: underline; }
.login-alt { margin-top: 22px; }
.login .input[readonly] { color: #9aa0a8; }

/* Permission Manager */
.tree-ico { width: 16px !important; height: 16px !important; color: #7a8089; flex: none; }
.tree-node > summary .tree-ico { margin-right: 2px; }
.tree-loose { list-style: none; margin: 6px 0 0; padding: 0; }
.tree-loose a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--c-text); text-decoration: none; min-height: 36px; }
.tree-loose a:hover { background: var(--c-surface); }
.tree-loose a.current { background: var(--c-accent-soft); color: var(--c-accent-strong); font-weight: 600; }
.tree-loose a small { margin-left: auto; color: var(--c-muted); font-size: 12px; }
.pm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.pm-head h2 { font-size: 20px; }
.pm-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 18px; padding: 0 18px 14px; }
.pm-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--c-border); }
.pm-tabs button { border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--c-muted); padding: 11px 12px; border-bottom: 2px solid transparent; cursor: pointer; }
.pm-tabs button.active { color: var(--c-accent-strong); border-bottom-color: var(--c-accent); }
.pm-pane { padding: 14px 18px 18px; }
.pm-section { border: 1px solid var(--c-border); border-radius: 8px; margin-bottom: 14px; overflow: hidden; }
.pm-section > summary { list-style: none; cursor: pointer; padding: 10px 14px; background: var(--c-surface); font-weight: 700; font-size: 14px; }
.pm-section > summary::-webkit-details-marker { display: none; }
.pm-list { padding: 8px 14px 12px; display: grid; gap: 2px; }
.pm-item { font-size: 14px; font-weight: 400; min-height: 34px; align-items: center; }
.pm-item strong { font-weight: 600; }
.pm-item .badge { margin-left: 6px; }
.pm-projects { margin: -6px 0 16px; padding: 12px 14px; border: 1px dashed #cfd3d8; border-radius: 8px; }
.pm-projects .hint { margin: 0 0 10px; }
.pm-section-pad { padding: 4px 0; }
.member-list { margin: 8px 0; padding-left: 18px; }
@media (max-width: 640px) {
    .pm-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .pm-tabs button { white-space: nowrap; }
}

/* ============================================================ Documents */
.docs { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.docs-tree .adm-tree-head { grid-template-columns: 1fr auto; align-items: center; }
.docs-tree .adm-title { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0; }
.docs-tree .adm-title .icon { width: 18px; height: 18px; }
.doc-tree { list-style: none; margin: 0; padding: 0 0 0 14px; }
.adm-tree-body > .doc-tree { padding-left: 0; }
.doc-tree-row { display: flex; align-items: center; gap: 2px; }
.doc-tree-row a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--c-text); text-decoration: none; min-height: 36px; }
.doc-tree-row a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.doc-tree-row a small { color: var(--c-muted); font-size: 12px; }
.doc-tree-row a:hover { background: var(--c-surface); }
.doc-tree-row a.current { background: var(--c-accent-soft); color: var(--c-accent-strong); font-weight: 600; }
.doc-tree-row .tree-ico { width: 16px; height: 16px; flex: none; color: #b38f00; }
.doc-tree-row.root .tree-ico { color: var(--c-muted); }
.doc-tree-toggle, .doc-tree-toggle-space { width: 22px; height: 28px; flex: none; }
.doc-tree-toggle { border: 0; background: none; cursor: pointer; border-radius: 4px; position: relative; }
.doc-tree-toggle::before { content: ""; position: absolute; left: 8px; top: 10px; border: 4px solid transparent; border-left: 6px solid var(--c-muted); transition: transform .15s; transform-origin: 3px 4px; }
.doc-tree-toggle.open::before { transform: rotate(90deg); }
.doc-tree-toggle:hover { background: var(--c-surface); }

.docs-main { position: relative; min-width: 0; }
.docs-head { margin-bottom: 12px; }
.docs-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.docs-search { flex: 1 1 260px; min-width: 200px; }
.docs-search .tb-input { width: 100%; }
.docs-dates { display: flex; gap: 0; }
.docs-dates .tb-input { width: 150px; }
.docs-all { align-items: center; min-height: 40px; padding: 0 4px; font-size: 14px; }
.docs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.docs-bar .tb-btn[disabled] { opacity: .4; cursor: not-allowed; }
.docs-count { color: var(--c-muted); font-size: 14px; }
.view-switch .tb-btn[aria-pressed="true"] { background: var(--c-accent-soft); color: var(--c-accent-strong); }

.docs-view[data-view="list"] .docs-grid, .docs-view[data-view="grid"] .docs-list { display: none; }
.docs-list tr.selected td { background: var(--c-accent-soft); }
.docs-list tr[data-doc-row] { cursor: pointer; }
.docs-list .sort-link { color: inherit; text-decoration: none; }
.docs-list .sort-link:hover { text-decoration: underline; }
.doc-name { display: inline-flex; align-items: center; gap: 10px; color: var(--c-text); text-decoration: none; font-weight: 600; }
.doc-name:hover span { text-decoration: underline; }
.doc-desc { display: block; color: var(--c-muted); font-weight: 400; margin: 2px 0 0 38px; }
.folder-row .folder-ico { width: 22px; height: 22px; color: #b38f00; margin: 0 3px; }
.doc-check, .doc-check-mirror { width: 18px; height: 18px; accent-color: var(--c-accent); cursor: pointer; }

.doc-icon { --doc-colour: #767b82; position: relative; display: inline-flex; flex: none; width: 28px; height: 32px; color: var(--doc-colour); }
.doc-icon .icon { width: 100%; height: 100%; stroke-width: 1.4; }
.doc-icon b { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); background: var(--doc-colour); color: #fff; font-size: 7.5px; line-height: 1; padding: 2px 3px; border-radius: 2px; letter-spacing: .02em; }
.doc-icon.lg { width: 56px; height: 64px; }
.doc-icon.lg b { font-size: 12px; padding: 3px 5px; bottom: 8px; }
.doc-icon.xl { width: 84px; height: 96px; }
.doc-icon.xl b { font-size: 16px; padding: 4px 7px; bottom: 12px; }

.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.doc-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--c-border); border-radius: 10px; background: #fff; overflow: hidden; transition: box-shadow .15s, border-color .15s; color: var(--c-text); text-decoration: none; }
.doc-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.doc-card.selected { border-color: var(--c-accent); box-shadow: 0 0 0 2px var(--c-accent-soft); }
.doc-card-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; flex: 1; }
.doc-thumb { height: 120px; background: var(--c-surface); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb .folder-big { width: 64px; height: 64px; color: #b38f00; stroke-width: 1.3; }
.doc-card-name { padding: 10px 12px 2px; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card-meta { padding: 0 12px 10px; font-size: 12px; color: var(--c-muted); }
.folder-card .doc-card-name { padding-bottom: 12px; }
.doc-card-check { position: absolute; top: 8px; left: 8px; z-index: 1; background: rgba(255,255,255,.92); border-radius: 5px; padding: 4px; display: flex; line-height: 0; }

.docs-empty { padding: 56px 20px; }
.docs-empty .icon { width: 40px; height: 40px; color: var(--c-muted); margin-bottom: 10px; }

.drop-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15,148,136,.12); border: 3px dashed var(--c-accent); display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 1; }
.drop-overlay > div { background: #fff; border-radius: 12px; padding: 26px 34px; text-align: center; display: grid; gap: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.drop-overlay .icon { width: 36px; height: 36px; color: var(--c-accent); margin: 0 auto; }
.drop-overlay span { color: var(--c-muted); font-size: 14px; }
.drop-overlay.uploading { pointer-events: all; background: rgba(255,255,255,.6); border: 0; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--c-accent-soft); border-top-color: var(--c-accent); border-radius: 50%; margin: 0 auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Detail page */
.doc-title { display: flex; align-items: center; gap: 10px; word-break: break-word; }
.doc-detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.doc-preview-card { padding: 0; overflow: hidden; }
.doc-preview { background: #f0f1f3; min-height: 420px; display: flex; align-items: center; justify-content: center; }
.doc-preview img { max-width: 100%; max-height: 78vh; display: block; }
.doc-preview video { max-width: 100%; max-height: 78vh; }
.doc-preview iframe { width: 100%; height: 78vh; border: 0; background: #fff; }
.doc-preview-none { text-align: center; padding: 40px; color: var(--c-muted); }
.doc-preview-none p { margin-top: 12px; }
.doc-side { display: grid; gap: 16px; }
.doc-panel { padding: 16px 18px; }
.doc-panel h2 { font-size: 15px; margin: 0 0 12px; }
.doc-meta { display: grid; grid-template-columns: 104px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.doc-meta dt { color: var(--c-muted); }
.doc-meta dd { margin: 0; word-break: break-word; }
.share-new { background: var(--c-accent-soft); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.share-new label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; color: var(--c-accent-strong); }
.copy-row { display: flex; gap: 6px; }
.copy-row .input { flex: 1; font-size: 12.5px; min-width: 0; }
.share-item { border-top: 1px solid var(--c-border); padding: 10px 0; font-size: 14px; }
.share-item:first-of-type { border-top: 0; }
.share-item small { color: var(--c-muted); display: block; margin-top: 4px; line-height: 1.45; }
.share-item.inactive { opacity: .7; }
.share-line { display: flex; align-items: center; gap: 6px; }
.share-actions { display: flex; gap: 4px; margin-top: 4px; margin-left: -6px; }
.danger-text { color: var(--c-danger) !important; }
.doc-history { list-style: none; margin: 0; padding: 0; position: relative; max-height: 520px; overflow-y: auto; }
.doc-history .ev { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 0 0 14px; position: relative; font-size: 14px; }
.doc-history .ev:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 2px; width: 2px; background: var(--c-border); }
.ev-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--c-surface); display: flex; align-items: center; justify-content: center; color: var(--c-muted); }
.ev-dot .icon { width: 15px; height: 15px; }
.ev-uploaded .ev-dot { background: var(--c-success-soft); color: var(--c-success); }
.ev-shared .ev-dot, .ev-share_viewed .ev-dot, .ev-share_downloaded .ev-dot { background: var(--c-accent-soft); color: var(--c-accent-strong); }
.ev-share_revoked .ev-dot, .ev-deleted .ev-dot { background: var(--c-danger-soft); color: var(--c-danger); }
.doc-history strong { display: block; }
.ev-who, .ev-detail { display: block; color: var(--c-text); }
.ev-detail { color: var(--c-muted); font-size: 13px; }
.doc-history time { display: block; color: var(--c-muted); font-size: 12.5px; margin-top: 2px; }

/* Public share page */
.share-page { background: #f0f1f3; min-height: 100dvh; display: flex; flex-direction: column; margin: 0; }
.share-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.share-logo { width: 34px; height: 34px; object-fit: contain; }
.share-title { flex: 1; min-width: 0; }
.share-title h1 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-title small { color: var(--c-muted); }
.share-body { flex: 1; padding: 20px; display: flex; }
.share-body .doc-preview { flex: 1; border-radius: 10px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.share-body .doc-preview iframe { height: calc(100dvh - 150px); }
.share-foot { text-align: center; color: var(--c-muted); font-size: 12.5px; padding: 0 20px 16px; }
.share-gone { margin: auto; max-width: 440px; text-align: center; padding: 40px 24px; background: #fff; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.share-gone .icon { width: 40px; height: 40px; color: var(--c-muted); }
.share-gone h1 { font-size: 20px; margin: 12px 0 8px; }
.share-gone p { color: var(--c-muted); margin: 0; }

@media (max-width: 1100px) {
    .doc-detail { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .docs { grid-template-columns: 1fr; }
    .docs-tree { position: static; max-height: 260px; }
    .docs-dates .tb-input { width: 140px; }
}
@media (max-width: 640px) {
    .docs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .doc-thumb { height: 96px; }
    .docs-search { flex-basis: 100%; }
    .share-head { flex-wrap: wrap; padding: 10px 14px; }
    .share-body { padding: 10px; }
    .doc-preview { min-height: 280px; }
}
.muted { color: var(--c-muted); } .small { font-size: 12.5px; }
.docs-filters .docs-search { flex: 1 1 calc(100% - 200px); order: 0; }
.docs-filters > .btn { order: 1; }
.docs-filters .tb-select, .docs-filters .docs-dates, .docs-filters .docs-all { order: 2; }
.docs-filters .tb-select { flex: 0 1 200px; min-width: 150px; }
.docs-list td.num, .docs-list td[data-label="Uploaded"] { white-space: nowrap; }
.adm-tree-head .tb-group, .adm-tree-head .tb-search { max-width: 100%; min-width: 0; box-sizing: border-box; } .adm-tree-head .tb-input { min-width: 0; }

/* ============================================================ Tasks */
.alert-info { background: #eef6ff; border-color: #cfe3fb; color: #1d4f8f; }
.alert-info .icon { width: 18px; height: 18px; flex: none; }
.tb-btn.on { background: var(--c-accent-soft); color: var(--c-accent-strong); }
.task-chip { background: var(--c-accent-bright); color: #1e2023; }

/* Date range bar */
.task-range { flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.task-range .tb-label { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--c-muted); font-size: 14px; white-space: nowrap; }
.task-range .tb-label .icon { width: 16px; height: 16px; }
.task-range .tb-input { width: 150px; }
.task-range .tb-select { min-width: 190px; }
.range-note { color: var(--c-muted); font-size: 13px; }

/* View Tasks */
.task-types { padding: 0; overflow: hidden; }
.task-types-head { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--c-border); color: var(--c-muted); font-size: 14px; flex-wrap: wrap; }
.task-types-head .spacer { flex: 1; }
.task-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 16px; background: #f1f2f4; border-bottom: 1px solid var(--c-border); font-weight: 600; }
.task-group > summary::-webkit-details-marker { display: none; }
.task-group > summary::before { content: ""; width: 0; height: 0; border: 5px solid transparent; border-left: 7px solid #6b7079; transition: transform .15s; transform-origin: 3px 5px; }
.task-group[open] > summary::before { transform: rotate(90deg); }
.task-group .table-wrap { border: 0; border-radius: 0; }
.task-type-table td.num { text-align: right; }
.count-pill { display: inline-block; min-width: 36px; padding: 2px 8px; border-radius: 999px; background: var(--c-accent-soft); color: var(--c-accent-strong); font-weight: 700; text-align: center; text-decoration: none; }
.inactive-row td { color: var(--c-muted); }

/* Task grid */
.c-icons { width: 64px; min-width: 64px; white-space: nowrap; }
.c-icons a, .c-icons .loc-dot { display: inline-flex; color: #9aa0a6; padding: 2px 4px; }
.c-icons a { color: var(--c-text); }
.c-icons .icon { width: 16px; height: 16px; }
.loc-dot.on { color: var(--c-accent); }
.person-link { color: #1d6fe0; }
.c-asset-task { white-space: nowrap; }

/* Record task */
.record-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.record-main { display: grid; gap: 16px; min-width: 0; }
.record-side { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 16px); }
.record-card { padding: 16px 18px; border-top: 4px solid var(--c-accent-bright); }
.record-card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
summary.record-card-head { list-style: none; cursor: pointer; margin-bottom: 0; }
summary.record-card-head::-webkit-details-marker { display: none; }
details[open] > summary.record-card-head { margin-bottom: 12px; }
.record-card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0; }
.record-card-head h2 .icon { width: 20px; height: 20px; }
.record-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.record-empty { padding: 34px 16px 18px; border: 0; }
.record-sections { display: grid; gap: 16px; }
.record-section { margin: 0; }
.record-submit { display: grid; gap: 8px; }
.btn-block { width: 100%; justify-content: center; }
.loc-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.asset-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.asset-chips:empty { display: none; }
.asset-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-surface); font-size: 14px; }
.asset-chip small { color: var(--c-muted); }
.asset-chip .dot, .asset-results .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip-x { border: 0; background: none; font-size: 18px; line-height: 1; padding: 0 6px; cursor: pointer; color: var(--c-muted); border-radius: 50%; }
.chip-x:hover { background: #e6e8eb; color: var(--c-text); }
.asset-search { position: relative; }
.asset-search .grid-search { width: 100%; }
.asset-search .grid-search input { width: 100%; }
.asset-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 4px; background: #fff; border: 1px solid var(--c-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.asset-results li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.asset-results li small { display: block; color: var(--c-muted); font-size: 12.5px; }
.asset-results li.active, .asset-results li:hover { background: var(--c-accent-soft); }
.asset-results li.none { color: var(--c-muted); cursor: default; }

/* Task summary */
.task-head { margin-bottom: 14px; }
.task-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.task-col { display: grid; gap: 24px; min-width: 0; }
.ts-card { padding: 20px 24px; }
.ts-accent { border-top: 6px solid var(--c-accent-bright); }
.ts-asset { border-top: 6px solid var(--ts-color, #c62828); }
.ts-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ts-title { font-size: 26px; font-weight: 400; margin: 0; letter-spacing: -.01em; }
.ts-h2 { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 400; margin: 0; }
.ts-h2 .icon { width: 24px; height: 24px; }
.ts-rule { border-bottom: 1px solid var(--c-border); padding-bottom: 12px; margin-bottom: 16px; }
.ts-tools { display: flex; align-items: center; gap: 4px; }
.ts-tools .icon-btn .icon { width: 20px; height: 20px; }
.ts-info { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; }
.ts-date { font-size: 20px; margin-bottom: 10px; }
.ts-facts { margin: 0; display: grid; gap: 4px; font-size: 15px; }
.ts-facts > div { display: flex; gap: 6px; flex-wrap: wrap; }
.ts-facts dt { font-weight: 700; }
.ts-facts dd { margin: 0; }
.ts-facts a { display: inline-flex; align-items: center; gap: 4px; }
.ts-facts .icon { width: 16px; height: 16px; }
.ts-watermark { color: #eceef0; flex: none; }
.ts-watermark .icon { width: 150px; height: 150px; stroke-width: 1.2; }
.ts-asset-row { display: flex; align-items: center; gap: 16px; }
.ts-asset-icon { width: 56px; height: 56px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; opacity: .85; }
.ts-asset-icon .icon { width: 28px; height: 28px; }
.ts-asset-text { flex: 1; min-width: 0; }
.ts-asset-number { font-size: 22px; }
.ts-asset-sub { color: var(--c-muted); font-size: 14px; margin-top: 4px; letter-spacing: .02em; }
.ts-map { display: block; width: 100%; height: 340px; border: 0; border-radius: 10px; margin-top: 14px; background: #e9ebee; }
.ts-nomap { margin-top: 14px; border-radius: 10px; background: #e7e8ea; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #8a8f96; text-align: center; padding: 20px; }
.ts-nomap .icon { width: 64px; height: 64px; color: #b9bcc1; }
.ts-nomap strong { font-size: 22px; font-weight: 400; color: #8a8f96; }
.ts-comment-form { display: flex; gap: 12px; align-items: flex-start; }
.ts-comment-form textarea { flex: 1; }
.ts-send { width: 52px; height: 52px; padding: 0; justify-content: center; }
.ts-send .icon { width: 22px; height: 22px; }
.ts-comments { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.ts-comments li { display: flex; gap: 10px; }
.ts-comments time { color: var(--c-muted); font-size: 13px; margin-left: 6px; }
.ts-comments p { margin: 4px 0 0; white-space: normal; }
.ts-none { text-align: center; padding: 12px; }
.ts-section { margin: 0; }
.ts-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 21px; padding: 14px 4px 18px; }
.ts-section > summary::-webkit-details-marker { display: none; }
.ts-section > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid #3a3d42; border-bottom: 2px solid #3a3d42; transform: rotate(45deg); margin: -6px 8px 0 0; transition: transform .15s; }
.ts-section:not([open]) > summary::after { transform: rotate(-45deg); margin-top: 0; }
.ts-desc { color: var(--c-muted); margin: -8px 4px 12px; font-size: 14px; }
.ts-values { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 15px; }
.ts-values tr { border-top: 1px solid var(--c-border); }
.ts-values tr:last-child { border-bottom: 1px solid var(--c-border); }
.ts-values tr:nth-child(odd) { background: #f6f6f7; }
.ts-values th { text-align: left; font-weight: 700; padding: 12px 14px; width: 45%; vertical-align: top; }
.ts-values td { text-align: right; padding: 12px 14px; word-break: break-word; }
.ts-caption { display: block; font-weight: 400; color: var(--c-muted); font-size: 12.5px; margin-top: 2px; }
.ts-values .thumbs { justify-content: flex-end; }
.ts-values .sig-thumb { max-height: 80px; }
[data-task-elements].hide-empty tr.is-empty { display: none; }
[data-task-elements].hide-captions .ts-caption { display: none; }
[data-task-elements].hide-desc .ts-desc { display: none; }
[data-task-elements]:not(.show-hidden) .is-hidden-el { display: none; }
.is-hidden-el th { font-style: italic; }
.ts-feed-title { font-size: 26px; font-weight: 400; margin: 6px 0 16px; }
.ts-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.ts-feed-item { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: start; }
.ts-feed-mark { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ts-feed-icon { width: 64px; height: 64px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.ts-feed-icon .icon { width: 24px; height: 24px; }
.ev-orange { background: #f0a030; } .ev-green { background: #3aa856; } .ev-blue { background: #3d85c6; } .ev-grey { background: #9aa0a6; }
.ts-feed-date { font-size: 13px; color: var(--c-muted); background: #eceef0; border-radius: 6px; padding: 2px 10px; }
.ts-feed-body { background: #fff; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); position: relative; font-size: 16px; }
.ts-feed-body::before { content: ""; position: absolute; left: -8px; top: 22px; border: 8px solid transparent; border-left: 0; border-right-color: #fff; }
.ts-feed-body time { display: block; color: var(--c-muted); font-size: 14px; margin-top: 2px; }
.ts-feed-detail { color: var(--c-muted); font-size: 13.5px; }

/* Print */
.print-page { background: #f0f1f3; }
.print-bar { display: flex; gap: 8px; justify-content: center; padding: 14px; }
.print-sheet { max-width: 860px; margin: 0 auto 30px; background: #fff; padding: 36px 44px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.print-head { display: flex; align-items: center; gap: 16px; border-bottom: 4px solid var(--c-accent-bright); padding-bottom: 14px; margin-bottom: 16px; }
.print-logo { width: 54px; height: 54px; object-fit: contain; }
.print-op { color: var(--c-muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.print-head h1 { margin: 2px 0 0; font-size: 24px; }
.print-facts { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 18px; }
.print-facts th { text-align: left; padding: 5px 10px 5px 0; white-space: nowrap; color: var(--c-muted); font-weight: 600; }
.print-facts td { padding: 5px 14px 5px 0; }
.print-section { break-inside: avoid-page; margin-top: 16px; }
.print-section h2 { font-size: 17px; border-bottom: 1px solid var(--c-border); padding-bottom: 6px; margin: 0 0 6px; }
.print-values { width: 100%; border-collapse: collapse; font-size: 14px; }
.print-values th { text-align: left; width: 40%; padding: 6px 10px 6px 0; vertical-align: top; }
.print-values td { padding: 6px 0; }
.print-values tr + tr { border-top: 1px solid #eef0f2; }
.print-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.print-photos img { width: 150px; height: 110px; object-fit: cover; border-radius: 4px; }
.print-sig { max-height: 90px; }
.print-foot { margin-top: 24px; color: var(--c-muted); font-size: 12px; border-top: 1px solid var(--c-border); padding-top: 8px; }
@media print {
    .no-print { display: none !important; }
    .print-page { background: #fff; }
    .print-sheet { box-shadow: none; padding: 0; max-width: none; margin: 0; }
}

/* ============================================================ Dashboard widgets */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; }
.widget { padding: 0; overflow: hidden; display: flex; flex-direction: column; border-top: 4px solid var(--c-accent-bright); }
.widget.size-third { grid-column: span 4; }
.widget.size-half { grid-column: span 6; }
.widget.size-full { grid-column: span 12; }
.widget-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--c-border); }
.widget-head h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0; flex: 1; min-width: 0; }
.widget-head h2 .icon { width: 19px; height: 19px; }
.widget-tools { display: flex; align-items: center; gap: 2px; }
.widget-tools form { display: inline; margin: 0; }
.widget-tools .icon-btn[disabled] { opacity: .35; }
.widget-grip { color: #a3a7ad; cursor: grab; display: inline-flex; }
.widget-grip .icon { width: 18px; height: 18px; }
.widget-body { padding: 14px 18px 16px; }
.is-editing .widget { outline: 2px dashed #c9ccd1; outline-offset: 3px; }
.is-editing .widget.dragging { opacity: .45; }
.dash-edit-note { align-items: center; }
.dash-empty { grid-column: 1 / -1; }
.widget-catalog { display: grid; gap: 10px; }
.widget-catalog form { margin: 0; }
.widget-choice { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; text-align: left; border: 1px solid var(--c-border); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.widget-choice:hover { border-color: var(--c-accent); background: var(--c-accent-soft); }
.widget-choice strong { display: block; }
.widget-choice small { display: block; color: var(--c-muted); margin-top: 2px; }
.widget-choice-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--c-accent-bright); display: flex; align-items: center; justify-content: center; flex: none; }
.widget-choice-icon .icon { width: 22px; height: 22px; }
.widget-choice > span:nth-child(2) { flex: 1; }
.widget-choice-add { width: 20px; height: 20px; color: var(--c-accent); }
.check-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--c-border); border-radius: 8px; padding: 6px 10px; }
.check-list .check { min-height: 30px; font-size: 14px; }
.check-list-group { font-size: 12px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 2px; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset.plain legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; padding: 0; }
.wct-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.wct-total { color: var(--c-muted); font-size: 14px; }
.wct-total strong { color: var(--c-text); font-size: 20px; margin-right: 2px; }
.wct-types { display: flex; flex-wrap: wrap; gap: 4px; }
.wct-table tbody tr { cursor: pointer; }
.wct-table tbody tr:hover td { background: #fafbfb; }
.wct-table a { color: inherit; text-decoration: none; }
.wct-table .cell-primary a { font-weight: 600; }
.wct-op { display: block; color: var(--c-muted); font-size: 12.5px; font-weight: 400; }
.wct-empty { text-align: center; color: var(--c-muted); padding: 22px 10px; }
.wct-empty .icon { width: 40px; height: 40px; color: #c3c6cb; }
.wct-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 14px; }
.wct-foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; }
.wct-foot .icon { width: 15px; height: 15px; }

@media (max-width: 1200px) {
    .task-summary { grid-template-columns: 1fr; }
    .widget.size-third { grid-column: span 6; }
}
@media (max-width: 991px) {
    .record-layout { grid-template-columns: 1fr; }
    .record-side { position: static; }
    .widget.size-third, .widget.size-half { grid-column: span 12; }
}
@media (max-width: 640px) {
    .record-pickers { grid-template-columns: 1fr; }
    .ts-card { padding: 16px; }
    .ts-title { font-size: 22px; }
    .ts-watermark { display: none; }
    .ts-values th, .ts-values td { padding: 10px; }
    .ts-feed-item { grid-template-columns: 64px 1fr; gap: 12px; }
    .ts-feed-icon { width: 48px; height: 48px; }
    .task-range .tb-input { width: 135px; }
    .print-sheet { padding: 18px; }
    .dash-grid { gap: 14px; }
}
.photo-remote { display: flex; align-items: center; justify-content: center; width: 110px; height: 82px; border-radius: 6px; background: var(--c-surface); border: 1px dashed var(--c-border); color: var(--c-muted); font-size: 12px; text-align: center; padding: 6px; }
.adm-search { max-width: 100%; box-sizing: border-box; min-width: 0; } .adm-search input { min-width: 0; width: 100%; }

/* ============================================================ HR */
.badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-info { background: #e8f0fe; color: #1a56c4; }
.badge .icon { width: 12px; height: 12px; margin-right: 3px; }
.d-block { display: block; }
.pre { white-space: pre-wrap; }
.hr-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.hr-stat { padding: 14px 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--c-accent-bright); }
.hr-stat .v { font-size: 26px; font-weight: 700; }
.hr-stat .l { color: var(--c-muted); font-size: 13.5px; }
.hr-stat.warn .v { color: var(--c-warn); }
.hr-stat:hover { box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.hr-filters .docs-search { flex: 1 1 260px; order: 0; }
.hr-filters > .btn, .hr-filters .tb-select, .hr-filters .docs-all, .hr-filters .view-switch, .hr-filters .tb-spacer { order: 1; }

.emp-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: #2f3237; color: #fff; font-weight: 700; overflow: hidden; letter-spacing: .02em; }
.emp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.emp-avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.emp-avatar.md { width: 44px; height: 44px; font-size: 15px; }
.emp-avatar.lg { width: 84px; height: 84px; font-size: 26px; }
.emp-avatar.xl { width: 112px; height: 112px; font-size: 34px; }
.emp-avatar .icon { width: 34px; height: 34px; }
.emp-link { display: inline-flex; align-items: center; gap: 10px; color: var(--c-text); text-decoration: none; font-weight: 600; }
.emp-link small { display: block; color: var(--c-muted); font-weight: 400; font-size: 12.5px; }
.emp-link:hover > span { text-decoration: underline; }

.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.emp-card { position: relative; padding: 0; overflow: hidden; transition: box-shadow .15s; }
.emp-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.emp-card-check { position: absolute; top: 10px; left: 10px; }
.emp-card-check input { width: 18px; height: 18px; accent-color: var(--c-accent); }
.emp-card-link { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 16px 16px; color: inherit; text-decoration: none; border-top: 4px solid var(--c-accent-bright); }
.emp-card-name { font-weight: 700; font-size: 16px; margin-top: 6px; }
.emp-card-title { color: var(--c-muted); font-size: 14px; }
.emp-card-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 22px; }
.emp-card-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; color: var(--c-muted); font-size: 12.5px; }
.emp-card-meta .icon { width: 12px; height: 12px; }

.emp-head { display: flex; gap: 22px; align-items: center; padding: 22px 24px; border-top: 6px solid var(--c-accent-bright); margin-bottom: 16px; }
.emp-head-main { flex: 1; min-width: 0; }
.emp-head h1 { margin: 0; font-size: 26px; }
.emp-head h1 small, .emp-head h1 .muted { font-weight: 400; font-size: 18px; }
.emp-head-title { color: var(--c-muted); font-size: 16px; margin: 2px 0 8px; }
.emp-head-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.emp-head-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--c-muted); }
.emp-head-facts span { display: inline-flex; align-items: center; gap: 6px; }
.emp-head-facts .icon { width: 15px; height: 15px; }
.emp-head-actions { display: flex; gap: 8px; align-self: flex-start; }
.emp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.emp-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--c-muted); text-decoration: none; font-weight: 600; font-size: 14.5px; border-bottom: 3px solid transparent; white-space: nowrap; position: relative; }
.emp-tabs a:hover { color: var(--c-text); }
.emp-tabs a.active { color: var(--c-text); border-bottom-color: var(--c-accent-bright); }
.emp-tabs .icon { width: 15px; height: 15px; }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-danger); }
.emp-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.emp-col { display: grid; gap: 16px; min-width: 0; }
.emp-tab-body > .card + .card, .emp-tab-body > section + section { margin-top: 16px; }
.emp-panel { padding: 18px 20px; }
.emp-panel h2 { font-size: 17px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.emp-panel h2 .icon { width: 18px; height: 18px; }
.emp-panel-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.emp-panel-head h2 { margin: 0; }
.emp-dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
.emp-dl > div { display: contents; }
.emp-dl dt { color: var(--c-muted); }
.emp-dl dd { margin: 0; word-break: break-word; }
.emp-dl .wide dt, .emp-dl .wide dd { grid-column: 1 / -1; }
.emp-contact { padding: 8px 0; border-top: 1px solid var(--c-border); font-size: 14.5px; }
.emp-contact:first-of-type { border-top: 0; padding-top: 0; }
.emp-reports { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 18px; }
.emp-reports a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--c-text); }
.cert-expired td { background: #fff7f6; }
.cert-expiring td { background: #fffbf1; }
.secure-panel { border-color: #ecd9a0; background: #fffdf6; }
.secure-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: #7a5b00; background: #fff6d9; border-radius: 6px; padding: 10px 12px; margin: 0 0 12px; }
.secure-note .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.doc-cat { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); margin: 14px 0 6px; }
.emp-docs { list-style: none; margin: 0; padding: 0; }
.emp-docs li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--c-border); }
.emp-docs li:first-child { border-top: 0; }
.emp-doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.emp-doc-main a { font-weight: 600; text-decoration: none; color: var(--c-text); }
.emp-doc-main a:hover { text-decoration: underline; }
.emp-doc-main small { color: var(--c-muted); font-size: 12.5px; }
.emp-history .ev-secure .ev-dot { background: #fff1c7; color: #8a6400; }

/* Timesheet */
.ts-week-head .tb-group { align-items: center; }
.ts-week-label { font-weight: 600; min-width: 170px; justify-content: center; color: var(--c-text); }
.ts-totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ts-totals > div { background: var(--c-surface); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.ts-totals .v { font-size: 22px; font-weight: 700; }
.ts-totals .l { font-size: 12.5px; color: var(--c-muted); }
.ts-totals .ot .v, td .ot, td.ot { color: #b06000; }
.ts-totals .ot2 .v, td .ot2, td.ot2 { color: var(--c-danger); }
.ts-table td { vertical-align: top; }
.ts-day { white-space: nowrap; }
.ts-empty td { color: var(--c-muted); }
.ts-table tr.is-today td { background: #fffbe6; }
.ts-addrow td { padding-top: 0; padding-bottom: 4px; }
.ts-desc { max-width: 280px; }
.ts-table tr[class*="ts-type-"]:not(.ts-type-work) td { color: #1a56c4; }
.ts-detail summary { cursor: pointer; color: var(--c-accent-strong); font-weight: 600; font-size: 13.5px; }
.table-compact td { padding: 5px 8px; font-size: 13px; }

/* HR form */
.hr-photo-row { display: flex; gap: 22px; align-items: flex-start; }
.hr-photo-fields { flex: 1; min-width: 0; }
.hr-photo-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.hr-photo-pick img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; }
.hr-photo-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hr-photo-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--c-accent-strong); }
.hr-photo-btn .icon { width: 15px; height: 15px; }
.hr-photo-pick:focus-within .hr-photo-btn { text-decoration: underline; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hr-contact-row { grid-template-columns: 1.3fr 1fr 1fr 1fr; }
.hr-ended { background: var(--c-surface); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }

/* Policies */
.progress { height: 8px; border-radius: 999px; background: #eceef0; overflow: hidden; width: 140px; }
.progress span { display: block; height: 100%; background: var(--c-accent); }
.policy-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.policy-body { font-size: 14.5px; line-height: 1.6; border: 1px solid var(--c-border); border-radius: 8px; padding: 14px 16px; max-height: 60vh; overflow-y: auto; background: #fff; }
.policy-sign { max-width: 900px; }
.policy-sign .lead { font-size: 16px; }
.policy-frame { width: 100%; height: 70vh; border: 1px solid var(--c-border); border-radius: 8px; margin-bottom: 8px; }
.policy-sign-form { margin-top: 18px; border-top: 1px solid var(--c-border); padding-top: 16px; }

/* Name tags */
.tags-sheet { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 10px; }
.name-tag { background: #fff; border: 1px solid #c9ccd1; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; break-inside: avoid; page-break-inside: avoid; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.tags-badge .name-tag { width: 3.375in; height: 2.125in; }
.tags-tag .name-tag { width: 3.5in; height: 2.25in; }
.nt-band { background: #1e2023; color: #fff; display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-bottom: 4px solid #fdd700; }
.nt-band img { width: 20px; height: 20px; object-fit: contain; }
.nt-body { flex: 1; display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.nt-photo { width: 1.05in; height: 1.3in; border-radius: 6px; overflow: hidden; background: #2f3237; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; flex: none; }
.nt-photo img { width: 100%; height: 100%; object-fit: cover; }
.nt-text { min-width: 0; }
.nt-first { font-size: 26px; font-weight: 800; line-height: 1.05; }
.nt-last { font-size: 16px; font-weight: 600; }
.nt-title { font-size: 12px; color: #4b5058; margin-top: 4px; }
.nt-number { font-family: var(--mono); font-size: 11px; color: #4b5058; margin-top: 6px; }
.tags-tag .nt-body { justify-content: center; text-align: center; }
.tags-tag .nt-first { font-size: 34px; }
.tags-tag .nt-last { font-size: 18px; }
@media print {
    .tags-page { background: #fff; }
    .tags-sheet { gap: 0.15in; padding: 0.25in; justify-content: flex-start; }
    .name-tag { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    @page { margin: 0.25in; }
}

@media (max-width: 1100px) {
    .emp-overview, .policy-layout { grid-template-columns: 1fr; }
    .hr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .emp-head { flex-direction: column; align-items: flex-start; }
    .emp-head-actions { align-self: stretch; }
    .ts-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hr-contact-row, .field-row.three { grid-template-columns: 1fr 1fr; }
    .hr-photo-row { flex-direction: column; align-items: center; }
    .hr-photo-fields { width: 100%; }
}
.wtk-list { list-style: none; margin: 0; padding: 0; }
.wtk-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--c-border); font-size: 14px; }
.wtk-list li:first-child { border-top: 0; }
.wmy { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wmy-hours { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.wmy-hours .v { font-size: 28px; font-weight: 800; }
.wmy-hours .l { color: var(--c-muted); font-size: 13.5px; }
.wmy-hours .ot { color: #b06000; }
.policy-sign-form .form-footer { position: static; box-shadow: none; margin: 16px 0 0; padding: 0; background: none; }
.wct-empty .btn .icon { width: 16px; height: 16px; color: inherit; }
.dash-grid.is-masonry { grid-auto-rows: 2px; row-gap: 0; grid-auto-flow: row dense; }
.dash-grid.is-masonry > .widget { align-self: start; }
.wvd-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--c-surface); border: 1px solid var(--c-border); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.wvd-icon .icon { width: 17px; height: 17px; }
.wvd-list { list-style: none; margin: 0; padding: 0; }
.wvd-list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--c-border); font-size: 14px; }
.wvd-list li:first-child { border-top: 0; }
.wvd-main { flex: 1; min-width: 0; }
.wvd-name { font-weight: 600; color: var(--c-text); text-decoration: none; }
.wvd-name:hover { text-decoration: underline; }
.wvd-main > small { display: block; color: var(--c-muted); font-size: 12.5px; }
.wvd-due { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; color: var(--c-muted); font-size: 13px; }
.ts-map-note { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 13.5px; font-weight: 600; }
.ts-map-note .icon { width: 15px; height: 15px; flex: none; }
.ts-map-note span { color: var(--c-muted); font-weight: 400; }
.widget-bare { background: none; border: 0; box-shadow: none; overflow: visible; }
.widget-bare:not(.is-editing *) .widget-head { display: none; }
.widget-bare .widget-body { padding: 0; }
.is-editing .widget-bare { background: #fff; border: 1px solid var(--c-border); border-top: 4px solid var(--c-accent-bright); }
.is-editing .widget-bare .widget-body { padding: 14px 18px 16px; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.quick-link { --ql: #3d85c6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 130px; padding: 18px; border-radius: 12px; background: var(--ql); color: #fff; text-decoration: none; font-size: 18px; font-weight: 600; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.08); transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; }
.quick-link .icon { width: 40px; height: 40px; stroke-width: 1.6; }
.quick-link.is-light { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.quick-link:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.12); color: #fff; }
.quick-link:focus-visible { outline: 3px solid var(--c-accent-bright); outline-offset: 3px; }
.ql-rows { display: grid; gap: 8px; }
.ql-row { display: grid; grid-template-columns: 1.2fr 1.6fr .9fr .9fr; gap: 8px; }
@media (max-width: 640px) { .ql-row { grid-template-columns: 1fr 1fr; } .quick-link { min-height: 96px; font-size: 16px; } .quick-links { gap: 12px; } }
.quick-link.is-light, .quick-link.is-light:hover { color: #0b2f55; text-shadow: none; }
.ql-row { grid-template-columns: 1fr 1.5fr; padding: 10px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); }
.ql-rows { gap: 10px; }
@media (max-width: 640px) { .ql-row { grid-template-columns: 1fr; } }
.sidebar { display: flex; flex-direction: column; }
.sidebar-footer { margin-top: auto; padding: 24px 12px 4px; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,.45); }
/* Very faint version of the login panel's grid + yellow sun behind the dashboard */
.dash-backdrop {
    position: fixed; top: var(--header-h); right: 0; bottom: 0; left: var(--sidebar-w); z-index: 0; pointer-events: none; overflow: hidden;
    background-image: linear-gradient(rgba(17,18,20,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(17,18,20,.035) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: linear-gradient(160deg, #000 0%, rgba(0,0,0,.6) 45%, rgba(0,0,0,.15) 100%);
            mask-image: linear-gradient(160deg, #000 0%, rgba(0,0,0,.6) 45%, rgba(0,0,0,.15) 100%);
}
.dash-backdrop::after {
    content: ""; position: absolute; right: -12%; top: -22%; width: min(60vw, 760px); aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffe34d 0%, #fdd700 40%, rgba(253,215,0,0) 70%); opacity: .14;
}
.dash-backdrop ~ * { position: relative; z-index: 1; }
@media (max-width: 991px) { .dash-backdrop { left: 0; } }

/* ---------- Work Orders ---------- */
.wo-card { padding: 20px 22px; margin-bottom: 18px; }
.wo-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.wo-card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0; }
.wo-card-head h2 small { font-weight: 500; font-size: 13px; }
.wo-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wo-accent { border-top: 4px solid var(--c-accent-bright); }
.wo-accent-purple { border-top: 4px solid #6b5aa6; }
.wo-accent-yellow { border-top: 4px solid #f5c400; }
.wo-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.wo-fieldset[disabled] .wo-li-tools, .wo-fieldset[disabled] [data-li-add], .wo-fieldset[disabled] .wo-li-addtask { display: none; }
.wo-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.wo-form-foot { display: flex; justify-content: flex-end; gap: 10px; margin: 6px 0 30px; }
.wo-danger-zone { margin: -4px 0 30px; text-align: right; }
.wo-facts { margin: 0 0 14px; display: grid; gap: 8px; }
.wo-facts > div { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 12px; }
.wo-facts dt { font-weight: 600; font-size: 14px; }
.wo-facts dd { margin: 0; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--c-surface); border-radius: 8px; font-size: 14px; }
.wo-facts-grid dd .input { height: 34px; padding: 4px 10px; background: #fff; }
.wo-status-form, .wo-li-form dd { display: flex; align-items: center; gap: 8px; width: 100%; }
.wo-status-form select, .wo-li-form select { flex: 1; }
.wo-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.wo-status { --st: #9aa0a6; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.wo-status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--st); }
.wo-title { display: flex; align-items: center; gap: 12px; }
.wo-title small { display: block; color: var(--c-muted); font-size: 13px; }
.wo-title .ts-title { margin: 0; font-variant-numeric: tabular-nums; }
.wo-title-icon { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--c-text); display: grid; place-items: center; flex: none; }
.wo-title-icon .icon { width: 24px; height: 24px; }
.wo-desc { border-top: 1px solid var(--c-border); padding-top: 12px; }
.wo-desc h3 { font-size: 14px; margin: 0 0 6px; }
.wo-desc div { font-size: 14px; line-height: 1.55; }
/* line item editor */
.wo-li-list { display: grid; gap: 12px; }
.wo-li { border: 1px solid var(--c-border); border-radius: 10px; background: #fff; }
.wo-li-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); background: var(--c-surface); border-radius: 10px 10px 0 0; }
.wo-li-head .input { flex: 1; font-weight: 600; }
.wo-li-num { width: 26px; height: 26px; border-radius: 50%; background: #6b5aa6; color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; }
.wo-li-tools { display: flex; gap: 2px; }
.wo-li-body { padding: 12px; display: grid; gap: 10px; }
.wo-li-row { display: flex; gap: 12px; flex-wrap: wrap; }
.wo-mini { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--c-muted); min-width: 160px; }
.wo-li-tasks { display: grid; gap: 6px; }
.wo-li-task { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 8px; background: #fff8d6; border: 1px solid #f1e2a0; font-size: 14px; }
.wo-li-task > .icon { width: 17px; height: 17px; }
.wo-li-task-name { flex: 1; min-width: 160px; font-weight: 600; }
.wo-li-task .check { font-weight: 400; color: var(--c-muted); }
.wo-li-empty { margin: 0; }
/* users */
.wo-user-filter { position: relative; margin-bottom: 8px; }
.wo-user-filter .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--c-muted); }
.wo-user-filter .input { padding-left: 34px; }
.wo-users { max-height: 320px; overflow: auto; border: 1px solid var(--c-border); border-radius: 10px; }
.wo-user-head, .wo-user { display: grid; grid-template-columns: 1fr 84px 84px; align-items: center; gap: 8px; padding: 8px 12px; }
.wo-user-head { position: sticky; top: 0; background: var(--c-surface); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); z-index: 1; }
.wo-user-head span:not(:first-child) { text-align: center; }
.wo-user { border-top: 1px solid var(--c-border); font-size: 14px; }
.wo-user > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wo-user > span small { display: block; color: var(--c-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.wo-tick { display: grid; place-items: center; }
.wo-tick input { width: 18px; height: 18px; }
/* asset search */
.wo-asset-chosen { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--c-border); border-radius: 8px; background: var(--c-surface); margin-bottom: 8px; }
.wo-asset-chosen > span { flex: 1; }
.wo-asset-chosen small { display: block; color: var(--c-muted); }
.wo-asset-results { display: grid; margin-top: 4px; border-radius: 8px; overflow: hidden; }
.wo-asset-results:not(:empty) { border: 1px solid var(--c-border); }
.wo-asset-opt { display: block; text-align: left; padding: 8px 12px; border: 0; border-top: 1px solid var(--c-border); background: #fff; cursor: pointer; font: inherit; }
.wo-asset-opt:first-child { border-top: 0; }
.wo-asset-opt:hover { background: var(--c-accent-soft); }
.wo-asset-opt small { display: block; color: var(--c-muted); }
/* manager + grid */
.wo-filters { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.wo-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--c-border); background: #fff; color: var(--c-text); text-decoration: none; font-size: 13.5px; }
.chip i { width: 9px; height: 9px; border-radius: 50%; }
.chip b { font-weight: 700; color: var(--c-muted); }
.chip.is-active { background: var(--c-text); color: #fff; border-color: var(--c-text); }
.chip.is-active b { color: #fff; }
.wo-sort { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--c-muted); }
.wo-sort .input { width: auto; }
.wo-list-card { padding: 18px 20px; margin-bottom: 18px; }
.wo-table tbody tr[data-href], .wo-grid tbody tr[data-href] { cursor: pointer; }
.wo-table tbody tr:hover, .wo-grid tbody tr:hover { background: var(--c-surface); }
.wo-link { font-weight: 600; color: var(--c-text); text-decoration: none; }
.wo-link .mono { color: var(--c-accent-strong); margin-right: 4px; }
.wo-sub { display: block; color: var(--c-muted); font-size: 12.5px; }
.wo-person { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e7e9ec; font-size: 11px; font-weight: 700; margin-right: -4px; border: 2px solid #fff; }
.wo-person.accepted { background: #d3f2ea; color: #0c7a63; }
.wo-person.declined { background: #fbe0de; color: #b3261e; }
.wo-progress { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: #e7e9ec; overflow: hidden; vertical-align: middle; }
.wo-progress span { display: block; height: 100%; background: #19b698; }
.wo-grid-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; margin-bottom: 16px; }
.wo-grid-filters .field { margin: 0; min-width: 150px; }
.wo-grid-btns { display: flex; gap: 6px; align-items: center; }
.wo-grid { font-size: 13.5px; white-space: nowrap; }
.wo-grid td:nth-child(2) { white-space: normal; min-width: 180px; }
/* summary */
.wo-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.wo-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 16px 18px 0; text-align: left; border: 1px solid var(--c-border); cursor: pointer; font: inherit; color: inherit; overflow: hidden; }
.wo-tile .v { font-size: 34px; font-weight: 300; line-height: 1; }
.wo-tile .l { font-size: 14px; color: var(--c-muted); margin: 4px 0 14px; }
.wo-tile > .icon { position: absolute; right: 14px; top: 12px; width: 44px; height: 44px; color: #d4d7db; }
.wo-tile .bar { align-self: stretch; margin: 0 -18px; padding: 8px 18px; color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.wo-tile-ref .bar { background: #f39a1e; }
.wo-tile-files .bar { background: #6b5aa6; }
.wo-tile:hover { box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.wo-assignee { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--c-border); }
.wo-assignee:first-of-type { border-top: 0; }
.wo-assignee-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.wo-accept { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--c-muted); }
.wo-accept .icon { width: 15px; height: 15px; }
.wo-accept.accepted { color: #0c7a63; }
.wo-accept.declined { color: #b3261e; }
.wo-line { --li: #9aa0a6; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 12px 14px; margin-top: 8px; border-radius: 8px; border-left: 4px solid var(--li);
    background: color-mix(in srgb, var(--li) 16%, #fff); color: var(--c-text); text-decoration: none; }
.wo-line:hover { background: color-mix(in srgb, var(--li) 26%, #fff); }
.wo-line-title { font-weight: 600; }
.wo-line-meta { grid-column: 1; font-size: 13px; color: var(--c-muted); }
.wo-line > .icon { grid-row: 1 / span 2; grid-column: 2; width: 18px; height: 18px; color: var(--c-muted); }
.wo-respond { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); margin: 10px -32px -48px; background: #fff; border-top: 1px solid var(--c-border); box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
.wo-respond form { display: flex; gap: 8px; }
.btn-success { background: #19b698; color: #fff; border-color: #19b698; }
.btn-success:hover { background: #14a085; }
.btn-success[disabled], .wo-respond .btn-danger[disabled] { opacity: .5; }
.wo-ref { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--c-border); }
.wo-ref a:first-child { font-weight: 600; }
.wo-ref small { flex: 1; color: var(--c-muted); }
.wo-ref form { margin: 0; }
.wo-ref-add { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-border); }
.wo-ref-add h3 { font-size: 14px; margin: 0 0 8px; }
.wo-ref-pick { display: grid; gap: 4px; max-height: 220px; overflow: auto; margin-bottom: 12px; }
.wo-comment-form { display: grid; gap: 8px; justify-items: end; margin-bottom: 14px; }
.wo-comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--c-border); font-size: 14px; }
.wo-comment p { margin: 4px 0 0; }
.wo-event { display: flex; gap: 10px; padding: 7px 0; font-size: 13.5px; }
.wo-event small { display: block; }
.wo-event-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--c-accent); flex: none; }
.wo-task { border: 1px solid var(--c-border); border-radius: 8px; margin-top: 8px; background: var(--c-surface); }
.wo-task summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.wo-task summary::-webkit-details-marker { display: none; }
.wo-task-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff3b30; flex: none; }
.wo-task-dot.done { background: #19b698; }
.wo-task-name { flex: 1; font-weight: 600; }
.wo-task-name small { display: block; font-weight: 400; color: var(--c-muted); font-size: 12.5px; }
.wo-task-count { font-size: 12.5px; color: var(--c-muted); }
.wo-task-body { display: grid; gap: 8px; justify-items: start; padding: 4px 12px 12px; }
.wo-recorded { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.wo-recorded .icon { width: 15px; height: 15px; color: #19b698; }
/* template manager */
.wot-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.wot-tree { padding: 10px; position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; }
.wot-tree-search { position: relative; margin-bottom: 8px; }
.wot-tree-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--c-muted); }
.wot-tree-search .input { padding-left: 32px; }
.wot-folder summary { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 14px; }
.wot-folder summary:hover { background: var(--c-surface); }
.wot-folder summary > span { flex: 1; min-width: 0; }
.wot-folder summary small { color: var(--c-muted); font-weight: 500; }
.wot-folder summary .icon { width: 17px; height: 17px; color: #e8a317; flex: none; }
.wot-folder-tools .icon-btn { width: 26px; height: 26px; }
.wot-folder-tools .icon { color: var(--c-muted) !important; }
.wot-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px 6px 28px; border-radius: 6px; font-size: 13.5px; color: var(--c-text); text-decoration: none; line-height: 1.35; }
[data-tree-loose] .wot-item { padding-left: 8px; }
.wot-item .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--c-muted); flex: none; }
.wot-item:hover { background: var(--c-surface); }
.wot-item.is-active { background: var(--c-accent-soft); color: var(--c-accent-strong); font-weight: 600; }
.wot-sub { padding: 6px 8px 4px 28px; font-size: 13px; font-weight: 600; color: var(--c-muted); }
.wot-none { padding: 4px 8px 6px 28px; margin: 0; }
@media (max-width: 1100px) { .wo-form-grid { grid-template-columns: 1fr; } }
@media (max-width: 991px) {
    .wot-layout { grid-template-columns: 1fr; }
    .wot-tree { position: static; max-height: 360px; }
    .wo-respond { margin: 10px -16px -32px; }
}
@media (max-width: 640px) {
    .wo-facts > div { grid-template-columns: 1fr; gap: 4px; }
    .wo-tiles { gap: 10px; }
    .hide-sm { display: none; }
    .wo-card { padding: 16px; }
}
@media print { .wo-respond, .ts-tools { display: none !important; } }
.wo-card .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wo-card .field-row .input { min-width: 0; width: 100%; }
@media (max-width: 640px) { .wo-card .field-row { grid-template-columns: 1fr; } }
.ts-assign-done { margin: 12px 0 0; }
.badge-success { background: #d3f2ea; color: #0c7a63; }
.record-assign { border-top: 4px solid var(--c-accent-bright); }

.wmt-list { list-style: none; margin: 0; padding: 0; }
.wmt-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--c-border); }
.wmt-list li:first-child { border-top: 0; }
.wmt-main { flex: 1; min-width: 0; color: var(--c-text); text-decoration: none; }
.wmt-main strong { display: block; }
.wmt-main small { display: block; color: var(--c-muted); font-size: 12.5px; }
.wmt-note { display: block; margin-top: 4px; font-size: 13px; color: #6b5a00; background: #fff8d6; border-radius: 6px; padding: 4px 8px; }
.wmt-main:hover strong { text-decoration: underline; }
.hr-stat .v.warn { color: var(--c-warn); }

/* ---------- Communications ---------- */
.crm-avatar { width: 76px; height: 76px; border-radius: 50%; background: #1e2023; color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; flex: none; }
.emp-head-facts a { display: inline-flex; align-items: center; gap: 6px; color: var(--c-text); }
.crm-log { display: grid; gap: 10px; }
.crm-log-types { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-radio { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--c-border); border-radius: 999px; font-size: 13.5px; cursor: pointer; }
.chip-radio:has(input:checked) { background: var(--c-text); color: #fff; border-color: var(--c-text); }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; z-index: 1; }
.crm-act { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--c-border); }
.crm-act:first-of-type { border-top: 0; }
.crm-act-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface); flex: none; }
.crm-act-icon .icon { width: 17px; height: 17px; }
.crm-call .crm-act-icon { background: #e2effb; color: #1c5391; }
.crm-email .crm-act-icon, .crm-campaign .crm-act-icon { background: #e1f5f1; color: #0c7a63; }
.crm-meeting .crm-act-icon { background: #efe9f8; color: #6b5aa6; }
.crm-unsubscribe .crm-act-icon { background: #fbe0de; color: #b3261e; }
.crm-act-main { flex: 1; min-width: 0; font-size: 14px; }
.crm-act-main p { margin: 4px 0; }
.crm-others { font-size: 14px; margin: 14px 0 6px; }
/* template library */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tpl-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; text-decoration: none; color: inherit; }
.tpl-thumb { position: relative; height: 200px; overflow: hidden; background: #f2f3f5; border-bottom: 1px solid var(--c-border); }
.tpl-thumb iframe { width: 640px; height: 800px; border: 0; transform: scale(.4); transform-origin: 0 0; pointer-events: none; position: absolute; left: 50%; margin-left: -128px; }
.tpl-meta { padding: 12px 14px; display: grid; gap: 2px; }
.tpl-meta strong { font-size: 15px; }
.tpl-meta small { color: var(--c-muted); }
.tpl-actions { display: flex; gap: 6px; padding: 0 14px 12px; }
.tpl-starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 26px; }
.tpl-starter { padding: 14px; text-decoration: none; color: inherit; border: 1px dashed #cfd3d8; box-shadow: none; }
.tpl-starter:hover { border-color: var(--c-accent); background: var(--c-accent-soft); }
.tpl-starter strong { display: block; }
.tpl-starter small { color: var(--c-muted); }
.section-title { font-size: 16px; margin: 0 0 12px; }
/* editor */
.ed-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ed-meta { padding: 18px 20px; margin-bottom: 16px; }
.ed-meta .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ed-box { padding: 0; overflow: hidden; }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--c-border); background: var(--c-surface); }
.ed-toolbar button, .ed-toolbar select, .ed-toolbar label.ed-color { height: 32px; min-width: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; font: inherit; font-size: 13px; color: var(--c-text); display: inline-flex; align-items: center; gap: 4px; }
.ed-toolbar button:hover, .ed-toolbar label.ed-color:hover { background: #fff; border-color: var(--c-border); }
.ed-toolbar button.is-on { background: #fff; border-color: var(--c-text); }
.ed-toolbar .icon { width: 16px; height: 16px; }
.ed-toolbar select { border-color: var(--c-border); background: #fff; }
.ed-toolbar .sep { width: 1px; background: var(--c-border); margin: 4px 4px; }
.ed-color input { width: 22px; height: 22px; padding: 0; border: 0; background: none; }
.ed-area { min-height: 460px; padding: 26px 30px; outline: none; font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 1.6; color: #2b2e33; }
.ed-area h1 { font-size: 26px; margin: 0 0 14px; } .ed-area h2 { font-size: 20px; margin: 22px 0 10px; } .ed-area h3 { font-size: 16px; }
.ed-area p { margin: 0 0 14px; } .ed-area img { max-width: 100%; height: auto; }
.ed-area img.is-selected { outline: 3px solid var(--c-accent); }
.ed-area blockquote { margin: 0 0 14px; padding: 10px 16px; border-left: 4px solid var(--ed-accent, #fdd700); background: #fafafa; }
.ed-area [data-block] { outline: 1px dashed transparent; }
.ed-area [data-block]:hover { outline-color: #c3c6cb; }
.ed-source { width: 100%; min-height: 460px; border: 0; padding: 16px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; resize: vertical; }
.ed-preview { position: sticky; top: calc(var(--header-h) + 12px); padding: 0; overflow: hidden; }
.ed-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); background: var(--c-surface); flex-wrap: wrap; }
.ed-seg { display: inline-flex; border: 1px solid var(--c-border); border-radius: 8px; overflow: hidden; }
.ed-seg button { padding: 6px 12px; border: 0; background: #fff; cursor: pointer; font: inherit; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.ed-seg button.is-on { background: var(--c-text); color: #fff; }
.ed-seg .icon { width: 15px; height: 15px; }
.ed-frame-wrap { background: #e9ebee; padding: 16px; display: flex; justify-content: center; height: calc(100vh - var(--header-h) - 150px); min-height: 520px; overflow: auto; }
.ed-frame { width: 100%; max-width: 680px; height: 100%; border: 0; background: #fff; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.08); transition: max-width .2s ease; }
.ed-frame-wrap.is-mobile .ed-frame { max-width: 375px; border-radius: 26px; border: 10px solid #1e2023; }
.ed-inbox { padding: 10px 14px; border-bottom: 1px solid var(--c-border); font-size: 13px; }
.ed-inbox strong { display: block; font-size: 14px; }
.ed-inbox span { color: var(--c-muted); }
.ed-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ed-tags button { font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--c-border); background: #fff; cursor: pointer; }
.ed-tags button:hover { border-color: var(--c-accent); }
.ed-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; }
.ed-images button { border: 1px solid var(--c-border); border-radius: 8px; background: #fff; padding: 4px; cursor: pointer; height: 90px; }
.ed-images img { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 1200px) { .ed-layout { grid-template-columns: 1fr; } .ed-preview { position: static; } }
/* campaigns */
.cmp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.cmp-progress { height: 8px; border-radius: 4px; background: #e7e9ec; overflow: hidden; margin: 8px 0 4px; }
.cmp-progress span { display: block; height: 100%; background: #19b698; }
.cmp-pick { max-height: 420px; overflow: auto; border: 1px solid var(--c-border); border-radius: 10px; }
.cmp-pick table { margin: 0; }
.cmp-pick tr.is-blocked td { color: var(--c-muted); }
.unsub-page { min-height: 100vh; display: grid; place-items: center; background: #f2f3f5; padding: 20px; font-family: Inter, system-ui, sans-serif; }
.unsub-card { background: #fff; border-radius: 12px; padding: 32px; max-width: 460px; width: 100%; border-top: 5px solid #fdd700; box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.unsub-card h1 { font-size: 22px; margin: 0 0 10px; }
.unsub-card p { color: #4f555d; }
@media (max-width: 640px) { .cmp-stats { grid-template-columns: repeat(2, 1fr); } }

.folder-menu-cell { width: 44px; text-align: right; }
.folder-card { position: relative; }
.folder-card-menu { position: absolute; top: 6px; right: 6px; }
.doc-tree-row a small { color: var(--c-muted); }
.docs-list .table-wrap, .docs-list.table-wrap { overflow: visible; }
.acc-everyone { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--c-border); border-radius: 10px; cursor: pointer; margin-bottom: 12px; }
.acc-everyone input { margin-top: 3px; width: 18px; height: 18px; }
.acc-everyone small { display: block; color: var(--c-muted); }
.acc-groups.is-off { opacity: .45; }
.acc-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.acc-quick .chip { cursor: pointer; font: inherit; font-size: 13px; }
.acc-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; max-height: 240px; overflow: auto; padding: 4px 2px; }
.doc-lock { display: inline-flex; margin-left: 6px; color: #b3261e; }
.doc-lock .icon { width: 15px; height: 15px; }
@media (max-width: 640px) { .acc-list { grid-template-columns: 1fr; } }

/* Inline folder rename */
.folder-rename { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.folder-rename .input { width: 100%; max-width: 360px; height: 34px; padding: 4px 10px; font: inherit; font-weight: 600; border: 1px solid var(--accent, #2563eb); border-radius: 8px; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.folder-card .folder-rename { padding: 12px 10px 10px; }
.folder-card .folder-rename .input { max-width: none; }

/* Email template layout cards */
.tpl-layouts { margin-bottom: 28px; }
.tpl-layout { border: 1px solid var(--c-border); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tpl-layout:hover, .tpl-layout:focus-visible { border-color: var(--c-accent); box-shadow: 0 6px 20px rgba(15,23,42,.10); transform: translateY(-2px); }
.tpl-layout .tpl-meta .badge { justify-self: start; margin: 2px 0; }
.tpl-blank { position: absolute; inset: 14px; display: grid; place-content: center; justify-items: center; gap: 6px; border: 2px dashed #c9ced5; border-radius: 10px; color: var(--c-muted); background: #fff; }
.tpl-blank svg { width: 30px; height: 30px; }
.tpl-use { position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 6px); opacity: 0; padding: 6px 14px; border-radius: 999px; background: var(--c-accent); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; transition: opacity .15s, transform .15s; pointer-events: none; z-index: 1; }
.tpl-layout:hover .tpl-use, .tpl-layout:focus-visible .tpl-use { opacity: 1; transform: translate(-50%, 0); }
.tpl-thumb::after { content: ""; position: absolute; inset: auto 0 0; height: 36px; background: linear-gradient(transparent, rgba(242,243,245,.95)); pointer-events: none; z-index: 1; }
.ed-ph-note { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: #fff8db; color: #6b5300; font-size: 13px; }
.ed-ph-note svg { width: 16px; height: 16px; flex: none; }
.ed-area img[src*="images/email/placeholder-"] { cursor: pointer; outline: 2px dashed transparent; outline-offset: 2px; }
.ed-area img[src*="images/email/placeholder-"]:hover { outline-color: var(--c-accent); }

/* Policy review & sign */
.sign-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 14px; padding: 0; font-size: 13.5px; color: var(--c-muted); }
.sign-steps li { display: flex; align-items: center; gap: 8px; }
.sign-steps span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #eef0f3; font-weight: 700; font-size: 12px; }
.sign-steps .is-active { color: var(--c-text, #111827); font-weight: 600; }
.sign-steps .is-active span { background: var(--c-accent); color: #fff; }
.policy-viewer { background: #525659; border-radius: 10px; padding: 6px; }
.policy-viewer .policy-frame { height: 78vh; min-height: 520px; margin: 0; border: 0; border-radius: 6px; background: #fff; display: block; }
.policy-viewer-links { display: flex; gap: 18px; margin: 8px 0 0; font-size: 14px; }
.policy-viewer-links a { display: inline-flex; align-items: center; gap: 6px; }
.policy-viewer-links svg { width: 16px; height: 16px; }
.sign-below { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--c-border); font-size: 18px; }
.sign-below + .alert, .sign-below + .policy-sign-form { margin-top: 10px; border-top: 0; padding-top: 0; }
.verify-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.verify-form .input { flex: 1 1 220px; }
.ack-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--c-border); }
.ack-card:last-child { border-bottom: 0; }
@media (max-width: 700px) { .policy-viewer .policy-frame { height: 70vh; min-height: 420px; } .ack-card { flex-direction: column; align-items: flex-start; } }
.history-layout { grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); }
.history-layout td[data-label="When"], .history-layout td[data-label="IP address"] { white-space: nowrap; }
@media (max-width: 1100px) { .history-layout { grid-template-columns: 1fr; } }
.dropdown-sep { border: 0; border-top: 1px solid var(--c-border); margin: 4px 0; }
