:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1b2433;
    --muted: #657086;
    --line: #dce2ec;
    --primary: #2457d6;
    --primary-dark: #1944b0;
    --danger: #a3212c;
    --danger-bg: #fff1f2;
    --success: #11643a;
    --success-bg: #ebf9f1;
    --radius: 14px;
    --shadow: 0 12px 34px rgba(20, 36, 72, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--primary);
}

.skip-link { position:fixed; z-index:10000; top:8px; left:8px; padding:10px 14px; border-radius:8px; background:#fff; color:var(--primary-dark); font-weight:800; transform:translateY(-150%); box-shadow:var(--shadow); }
.skip-link:focus { transform:translateY(0); }
:where(a,button,input,select,textarea,summary,[role="tab"]):focus-visible { outline:3px solid #ffbf47; outline-offset:3px; }
.required-mark { color:var(--danger); font-weight:850; }

.topbar {
    min-height: 64px;
    padding: 0 32px;
    background: #142347;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    color: white;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.topbar-actions,
.languages,
.main-nav,
.heading-actions,
.page-actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.main-nav a {
    color: #dce4f7;
    font-weight: 650;
    text-decoration: none;
}

.tenant-name {
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.languages {
    gap: 6px;
}

.languages a {
    padding: 4px 7px;
    border-radius: 6px;
    color: #cbd6f2;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.languages a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

.user-name {
    color: #dce4f7;
}

.topbar form {
    margin: 0;
}

.link-button {
    min-height: 24px;
    padding: 2px 4px;
    border: 0;
    background: transparent;
    color: white;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.danger-link {
    color: var(--danger);
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 48px auto;
}
.page-shell:focus { outline:none; }
.page-breadcrumbs { margin:0 0 18px; }
.page-breadcrumbs ol { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem; margin:0; padding:0; list-style:none; }
.page-breadcrumbs li { display:flex; align-items:center; min-width:0; color:var(--muted); font-size:.88rem; }
.page-breadcrumbs li + li::before { content:''; width:.42rem; height:.42rem; margin:0 .55rem 0 .25rem; border-top:1.5px solid #8b98ac; border-right:1.5px solid #8b98ac; transform:rotate(45deg); }
.page-breadcrumbs a { color:#47617f; font-weight:650; text-decoration:none; }
.page-breadcrumbs a:hover,.page-breadcrumbs a:focus-visible { color:var(--primary); text-decoration:underline; text-underline-offset:3px; }
.page-breadcrumbs [aria-current="page"] { display:block; max-width:34rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); font-weight:750; }
.has-breadcrumbs .page-heading .back-link { display:none; }

.page-heading {
    margin-bottom: 24px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.15;
}

h2 {
    font-size: 21px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.muted,
.fieldset-hint {
    color: var(--muted);
}

.auth-card,
.form-card,
.table-card,
.empty-state {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(440px, 100%);
    margin: 10vh auto 0;
    padding: 36px;
}

.form-stack,
.form-card {
    display: grid;
    gap: 20px;
}

.form-card {
    padding: 30px;
}
.page-shell > form.form-card { width:min(1100px,100%); }
.form-card.is-submitting { cursor:progress; }
.form-card.is-submitting :where(input,select,textarea,button) { pointer-events:none; }
.form-actions-sticky { position:sticky; z-index:20; bottom:0; margin:8px -10px -10px; padding:14px 10px 10px; border-top:1px solid var(--line); background:linear-gradient(to bottom,rgba(255,255,255,.92),#fff 35%); box-shadow:0 -8px 20px rgba(20,36,72,.07); }
.tab-error-mark { min-width:20px; margin-left:7px; padding:1px 6px; border-radius:999px; background:var(--danger); color:#fff; font-size:11px; line-height:18px; text-align:center; }
.message-dismiss { float:right; min-width:28px; min-height:28px; margin:-4px -4px -4px 12px; border:0; border-radius:7px; background:transparent; color:inherit; font:700 20px/1 system-ui; cursor:pointer; }
.message-dismiss:hover { background:rgba(0,0,0,.07); }

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0 0 28px;
    border: 0;
    border-bottom: 1px solid var(--line);
}

fieldset:last-of-type {
    padding-bottom: 8px;
    border-bottom: 0;
}

legend {
    margin-bottom: 16px;
    padding: 0;
    font-size: 20px;
    font-weight: 750;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.full-width {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid #bec8d8;
    border-radius: 8px;
    background: white;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(36, 87, 214, 0.13);
}

.field-error {
    color: var(--danger);
    font-weight: 500;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.heading-actions {
    flex-wrap: wrap;
}

.button {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

.button-primary {
    background: var(--primary);
    color: white;
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    border-color: var(--line);
    background: white;
    color: var(--text);
}

.button-danger {
    background: var(--danger);
    color: white;
}

.import-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(18rem,.8fr); gap:1.25rem; align-items:start; }
.import-grid .form-card { margin:0; max-width:none; }
.import-grid ul { margin:.25rem 0 0; padding-left:1.25rem; display:grid; gap:.75rem; color:var(--muted); }
.danger-zone { margin-top:1rem; padding:1rem 1.25rem; border:1px solid #fecaca; border-radius:14px; background:#fff7f7; }
.danger-zone h2 { margin-top:0; }
.danger-zone .form-grid { max-width:28rem; }
@media(max-width:760px){.import-grid{grid-template-columns:1fr;}}

.entity-picker { position: relative; width: 100%; }
.entity-picker-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.entity-picker-results { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 18rem; overflow: auto; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; box-shadow: 0 16px 36px rgba(15, 23, 42, .16); }
.entity-picker-result { display: block; width: 100%; padding: .7rem .85rem; border: 0; border-bottom: 1px solid #eef2f7; background: #fff; color: #0f172a; text-align: left; cursor: pointer; }
.entity-picker-result:hover, .entity-picker-result:focus { background: #eef4ff; outline: none; }
.entity-picker-empty { padding: .8rem; color: #64748b; }
.entity-picker { display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; }
.entity-picker-input { flex:1; min-width:0; }
.entity-picker-open { width:2.65rem; height:2.65rem; border:1px solid #cbd5e1; border-radius:9px; background:#fff; color:#2357d9; font-size:1.45rem; line-height:1; cursor:pointer; }
.entity-picker-open:hover,.entity-picker-open:focus { background:#eef4ff; outline:2px solid #b8cbff; }
.entity-picker-selected { flex:1 0 100%; min-width:0; padding:.55rem .7rem; display:flex; align-items:center; justify-content:space-between; gap:.75rem; border:1px solid #dce5f3; border-radius:9px; background:#f7faff; }
.entity-picker-selected[hidden] { display:none; }
.entity-picker-selected span,.entity-picker-selected strong,.entity-picker-selected small { display:block; min-width:0; }
.entity-picker-selected small { margin-top:.15rem; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.entity-picker-clear { flex:0 0 28px; width:28px; height:28px; border:0; border-radius:7px; background:transparent; color:#52627a; font-size:1.2rem; cursor:pointer; }
.entity-picker-clear:hover { background:#e5ecf8; color:var(--danger); }
.entity-search-modal { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:1rem; background:rgba(15,23,42,.48); }
.entity-search-modal[hidden] { display:none; }
.entity-search-dialog { width:min(64rem,100%); max-height:min(90vh,54rem); display:flex; flex-direction:column; border-radius:14px; background:#fff; box-shadow:0 24px 80px rgba(15,23,42,.3); overflow:hidden; }
.filter-bar { display:grid; grid-template-columns:minmax(16rem,2fr) repeat(3,minmax(10rem,1fr)); gap:1rem; align-items:end; margin:1.25rem 0; padding:1rem; border:1px solid var(--border); border-radius:14px; background:#fff; }
.filter-bar label { margin:0; }
.filter-bar .form-actions { margin:0; grid-column:1/-1; justify-content:flex-end; }
.line-editor-dialog { width:min(58rem,calc(100% - 2rem)); max-height:90vh; padding:0; border:0; border-radius:14px; box-shadow:0 24px 80px rgba(15,23,42,.3); }
.line-editor-dialog::backdrop { background:rgba(15,23,42,.55); }
.line-editor-body { padding:1.25rem; overflow:auto; }
.line-editor-actions { padding:1rem 1.25rem; border-top:1px solid var(--border); background:#fff; }
.document-editor > .form-card { max-width:none; }
.section-tabs { display:flex; gap:.5rem; margin:1rem 0 1.25rem; border-bottom:1px solid var(--border); }
.section-tabs a { display:inline-flex; padding:.75rem 1rem; color:var(--muted); text-decoration:none; border-bottom:3px solid transparent; }
.section-tabs a.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:700; }
.record-summary { display:flex; flex-wrap:wrap; align-items:center; gap:.55rem; margin-top:.7rem; }
.record-summary .status { white-space:nowrap; }
.record-tabs { margin-top:1rem; }
.record-tab-list { position:sticky; top:0; z-index:20; display:flex; gap:.25rem; overflow-x:auto; margin:0 0 1.25rem; padding:.35rem; border:1px solid var(--line); border-radius:12px; background:#f8fafc; box-shadow:0 5px 18px rgba(15,35,71,.06); }
.record-tab,.record-tab-list [data-tab-target] { flex:0 0 auto; min-height:42px; padding:.65rem 1rem; border:0; border-radius:9px; background:transparent; color:var(--muted); font:inherit; font-weight:750; cursor:pointer; }
.record-tab:hover,.record-tab:focus-visible,.record-tab-list [data-tab-target]:hover,.record-tab-list [data-tab-target]:focus-visible { background:#e9efff; color:var(--primary); outline:none; }
.record-tab.active,.record-tab-list [data-tab-target].active { background:var(--primary); color:#fff; box-shadow:0 4px 12px rgba(35,87,217,.2); }
.tab-count { display:inline-flex; min-width:1.4rem; justify-content:center; margin-left:.35rem; padding:.08rem .38rem; border-radius:999px; background:rgba(15,35,71,.1); font-size:.78rem; }
.active > .tab-count { background:rgba(255,255,255,.22); }
.page-heading-actions,.table-row-form { display:flex; flex-wrap:wrap; align-items:center; gap:.55rem; }
.table-row-form select,.table-row-form input { min-width:8rem; }
.compact-permission-grid { max-height:58vh; overflow:auto; margin-top:1rem; }
.record-tabs-enhanced > [data-tab-panel][hidden] { display:none; }
.record-panel { display:grid; gap:1.1rem; }
.record-panel > .section-heading:first-child { margin-top:0; }
.record-panel .section-heading { margin-top:1.4rem; }
.record-panel .form-card { max-width:none; }
.record-form-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.record-form-group { min-width:0; padding:1rem; border:1px solid var(--line); border-radius:12px; background:#fbfcff; }
.record-form-group h2,.record-form-group h3 { margin:0 0 1rem; font-size:1.05rem; }
.record-form-group .form-grid { gap:.85rem 1rem; }
.record-form-group-wide { grid-column:1/-1; }
.record-add-panel { border:1px dashed #b9c7dd; border-radius:12px; background:#fbfcff; }
.record-add-panel > summary { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem 1rem; color:var(--primary); font-weight:800; cursor:pointer; list-style:none; }
.record-add-panel > summary::-webkit-details-marker { display:none; }
.record-add-panel > summary::after { content:'＋'; font-size:1.25rem; }
.record-add-panel[open] > summary { border-bottom:1px solid var(--line); }
.record-add-panel[open] > summary::after { content:'−'; }
.record-add-panel > .form-card,.record-add-panel > form.form-card { margin:0; border:0; border-radius:0 0 12px 12px; box-shadow:none; }
.catalog-item-form { max-width:1000px; }
.catalog-item-form [hidden],.catalog-item-form [data-product-only][hidden] { display:none !important; }
.catalog-item-form .compact-form-grid { gap:.75rem 1rem; }
.catalog-item-form textarea { min-height:64px; }
.catalog-identifiers { margin:1rem 0; }
.catalog-details-body { padding:1rem; }
.catalog-details-body > h3 { margin:1rem 0 .6rem; font-size:1rem; }
.supplier-code-grid { display:grid; grid-template-columns:minmax(12rem,1fr) minmax(12rem,1fr); gap:.65rem 1rem; }
.catalog-language-tabs { margin-top:1rem; padding-top:.15rem; border-top:1px solid var(--line); }
.catalog-language-tabs .record-tab-list { position:static; margin-bottom:.8rem; box-shadow:none; }
.catalog-language-tabs .record-panel { padding:.25rem .15rem; }
@media (max-width:700px){.supplier-code-grid{grid-template-columns:1fr}.catalog-item-form{padding:1rem}}
.record-stats { display:flex; flex-wrap:wrap; gap:.55rem; }
.record-stat { display:inline-flex; align-items:center; gap:.4rem; padding:.45rem .7rem; border:1px solid var(--line); border-radius:999px; background:#fff; color:var(--muted); font-size:.86rem; }
.record-stat strong { color:var(--text); }
#incoming-lines-table td:last-child { white-space:nowrap; }
@media(max-width:900px){.filter-bar{grid-template-columns:1fr 1fr;}.filter-bar label:first-child{grid-column:1/-1;}}
@media(max-width:620px){.filter-bar{grid-template-columns:1fr;}.filter-bar label:first-child{grid-column:auto;}}
@media(max-width:760px){.record-form-groups{grid-template-columns:1fr}.record-form-group-wide{grid-column:auto}.record-tab-list{position:static}.record-tab{padding:.6rem .75rem}}
.entity-search-header { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.25rem; border-bottom:1px solid #e2e8f0; }
.entity-search-header h2 { margin:0; font-size:1.1rem; color:#102347; }
.entity-search-close { border:0; background:transparent; font-size:1.6rem; color:#64748b; cursor:pointer; }
.entity-search-toolbar { display:flex; gap:.6rem; padding:.85rem 1.25rem; background:#f8fafc; border-bottom:1px solid #e2e8f0; }
.entity-search-query { flex:1; min-width:0; }
.entity-search-filter { min-width:11rem; }
.entity-search-sort { width:7rem; }
.entity-search-count { padding:.55rem 1.25rem; color:#64748b; font-size:.86rem; border-bottom:1px solid #eef2f7; }
.entity-search-list { overflow:auto; padding:.35rem; }
.entity-search-item { display:block; width:100%; padding:.75rem .9rem; border:0; border-bottom:1px solid #eef2f7; background:#fff; text-align:left; color:#0f172a; cursor:pointer; }
.entity-search-item strong,.entity-search-item small { display:block; }
.entity-search-item small { margin-top:.25rem; color:#64748b; }
.entity-search-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(12rem,1fr)); gap:.65rem; padding:.85rem 1.25rem; border-bottom:1px solid #e2e8f0; background:#fff; }
.entity-search-fields:empty { display:none; }
.entity-search-fields label span { display:block; margin-bottom:.25rem; font-size:.78rem; color:#475569; }
.entity-search-fields input { width:100%; }
.entity-search-pagination { display:flex; align-items:center; justify-content:center; gap:.75rem; padding:.75rem 1.25rem; border-top:1px solid #e2e8f0; background:#f8fafc; }
.lookup-settings-form { display:grid; gap:1rem; }
.lookup-settings-group h2 { margin:.2rem 0 .6rem; }
.lookup-settings-group td:not(:first-child),.lookup-settings-group th:not(:first-child) { width:9rem; text-align:center; }
.entity-search-item:hover,.entity-search-item:focus { background:#eef4ff; outline:none; }
@media (max-width: 650px) { .entity-search-toolbar { flex-wrap:wrap; } .entity-search-query { flex-basis:100%; } .entity-search-filter { flex:1; min-width:0; } }
.line-card { margin:1rem 0; padding:1rem; border:1px solid #d9e2f0; border-radius:12px; background:#f8fafc; }
.line-card legend { padding:0 .45rem; color:#102347; font-weight:700; }

.alert {
    margin-bottom: 20px;
    padding: 12px 15px;
    border: 1px solid;
    border-radius: 9px;
}

.alert-error {
    border-color: #efb4ba;
    background: var(--danger-bg);
    color: var(--danger);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.alert-success {
    border-color: #a9dfbf;
    background: var(--success-bg);
    color: var(--success);
}

.table-card {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f9fafc;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td small {
    margin-top: 4px;
    color: var(--muted);
    display: block;
}

.status {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.status-active,
.status-approved,
.status-issued,
.status-signed {
    background: var(--success-bg);
    color: var(--success);
}

.status-inactive {
    background: #eef0f4;
    color: #596275;
}

.status-draft,
.status-paused {
    background: #fff7df;
    color: #765400;
}

.status-ended {
    background: #eef0f4;
    color: #596275;
}

.bank-direction-credit {
    background: var(--success-bg);
    color: var(--success);
}

.bank-direction-debit {
    background: #fff0e8;
    color: #9a3412;
}

.section-heading {
    margin: 36px 0 16px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.section-heading h2,
.section-heading p {
    margin-bottom: 0;
}

.compact-card {
    margin-top: 20px;
}

.checkbox-label {
    min-height: 44px;
    align-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label input {
    width: 18px;
    min-height: 18px;
}

.narrow-card {
    width: min(650px, 100%);
}

.single-column {
    grid-template-columns: 1fr;
}

.info-note {
    padding: 14px 16px;
    border: 1px solid #c9d5ef;
    border-radius: 9px;
    background: #f3f6fd;
    color: #33466f;
}

.number-cell {
    text-align: right;
    white-space: nowrap;
}

.invoice-totals {
    margin: 22px 0 0 auto;
    width: min(420px, 100%);
}

.invoice-totals dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px 24px;
}

.invoice-totals dd {
    margin: 0;
    text-align: right;
}

.grand-total {
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 18px;
    font-weight: 800;
}

.row-actions {
    gap: 12px;
    white-space: nowrap;
}

.row-actions .link-button,
.table-card .link-button {
    color: var(--primary);
}

.credential-card,
.info-card,
.confirm-card,
.module-card {
    margin-bottom: 22px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.credential-card {
    border-color: #e4c56c;
    background: #fffbeb;
}

.credential-card dl,
.detail-list {
    margin: 14px 0 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
}

.credential-card dd,
.detail-list dd {
    margin: 0;
}

.credential-card code {
    user-select: all;
}

.confirm-card {
    width: min(650px, 100%);
    margin: 8vh auto 0;
}

.wide-card {
    width: min(560px, 100%);
}

.dashboard-grid {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-sections {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-section {
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.dashboard-section h2 { margin: 0 0 12px; font-size: 18px; }
.dashboard-menu-list { display: grid; }
.dashboard-menu-list a {
    padding: 11px 0;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}
.dashboard-menu-list a:hover { color: var(--primary); }
.dashboard-menu-list span { color: var(--muted); }

.dashboard-heading { margin-bottom: 18px; }
.dashboard-notification-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}
.dashboard-notification-link > span { color: #f59e0b; font-size: 10px; }
.dashboard-notification-link strong { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--primary); color: #fff; text-align: center; }
.dashboard-start {
    margin-bottom: 24px;
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(0, 2.2fr);
    gap: 24px;
    align-items: center;
    border: 1px solid #cfdaef;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8faff 0%, #eef4ff 100%);
}
.dashboard-start-copy h2 { margin: 5px 0 7px; font-size: 21px; }
.dashboard-start-copy p { margin: 0; color: var(--muted); }
.dashboard-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dashboard-quick-actions a {
    min-height: 72px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #d8e1f0;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.dashboard-quick-actions a:hover { border-color: #9bb3eb; box-shadow: 0 8px 24px rgba(35,87,217,.10); transform: translateY(-1px); }
.dashboard-quick-actions a > span:last-child { min-width: 0; display: grid; gap: 2px; }
.dashboard-quick-actions small { color: var(--muted); font-weight: 500; }
.quick-action-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; background: #e9efff; color: var(--primary); font-size: 23px; line-height: 1; }
.dashboard-attention,
.dashboard-workspaces { margin-bottom: 24px; }
.dashboard-section-title { margin-bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.dashboard-section-title h2 { margin: 4px 0 0; font-size: 22px; }
.dashboard-section-title p { margin: 5px 0 0; }
.attention-total,
.dashboard-count { min-width: 30px; padding: 4px 9px; border-radius: 999px; background: #fff3cd; color: #7a5200; font-weight: 800; text-align: center; }
.dashboard-alert,
.dashboard-accordion details { border: 1px solid var(--line); background: var(--surface); }
.dashboard-alert:first-of-type,
.dashboard-accordion details:first-child { border-radius: 14px 14px 0 0; }
.dashboard-alert:last-child,
.dashboard-accordion details:last-child { border-radius: 0 0 14px 14px; }
.dashboard-alert + .dashboard-alert,
.dashboard-accordion details + details { border-top: 0; }
.dashboard-alert summary,
.dashboard-accordion summary { cursor: pointer; list-style: none; }
.dashboard-alert summary::-webkit-details-marker,
.dashboard-accordion summary::-webkit-details-marker { display: none; }
.dashboard-alert summary { padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dashboard-alert summary > span:first-child { display: grid; gap: 3px; }
.dashboard-alert summary small { color: var(--muted); }
.dashboard-alert-body { padding: 0 14px 14px; }
.dashboard-alert-body .table-card { box-shadow: none; }
.dashboard-accordion { box-shadow: var(--shadow); border-radius: 14px; }
.dashboard-accordion summary { min-height: 70px; padding: 14px 18px; display: grid; grid-template-columns: 42px 1fr auto; gap: 14px; align-items: center; }
.dashboard-accordion summary:hover { background: #f8faff; }
.dashboard-accordion summary > span:nth-child(2) { display: grid; gap: 3px; }
.dashboard-accordion summary strong { font-size: 16px; }
.dashboard-accordion summary small { color: var(--muted); font-weight: 500; }
.workspace-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #eef3ff; color: var(--primary); font-size: 11px; font-weight: 850; letter-spacing: .5px; }
.workspace-chevron { width:10px; height:10px; margin-right:5px; border-right:2px solid #718198; border-bottom:2px solid #718198; font-size:0; transform:rotate(45deg); transition:transform 140ms ease; }
.dashboard-accordion details[open] .workspace-chevron { transform:rotate(225deg); }
.dashboard-workspace-links { padding: 0 18px 16px 74px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 18px; }
.dashboard-workspace-links a { padding: 10px 11px; display: flex; justify-content:space-between; gap: 12px; border:1px solid transparent; border-radius: 8px; color: var(--text); font-weight: 700; text-decoration: none; }
.dashboard-workspace-links a:hover { background: #eef4ff; color: var(--primary); }
.dashboard-workspace-links a:focus-visible { border-color:#9bb3eb; outline:none; background:#eef4ff; color:var(--primary); }
.dashboard-workspace-links a span { display:none; }

.module-card {
    margin: 0;
    color: var(--text);
    text-decoration: none;
    transition: transform 120ms ease, border-color 120ms ease;
}

.module-card:hover {
    border-color: #aebde2;
    transform: translateY(-2px);
}

.module-card p {
    margin-bottom: 0;
    color: var(--muted);
}

.module-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #eaf0ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.role-badge {
    padding: 7px 11px;
    border-radius: 999px;
    background: #eaf0ff;
    color: var(--primary-dark);
    font-weight: 750;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.empty-state {
    padding: 48px 28px;
    text-align: center;
}

.error-state {
    width: min(600px, 100%);
    margin: 10vh auto 0;
}

.back-link {
    margin-bottom: 14px;
    display: inline-block;
    text-decoration: none;
}

.scroll-to-top {
    position: fixed;
    z-index: 80;
    left: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #163f9f;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 28px rgba(15, 35, 71, .28);
    font-size: 25px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
    transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

.scroll-to-top[hidden] { display: none; }
.scroll-to-top:hover { background: var(--primary-dark); transform: translateY(-2px); }
.scroll-to-top:active { transform: translateY(0); }

@media (max-width: 720px) {
    .topbar {
        padding: 12px 20px;
        align-items: flex-start;
    }

    .topbar-actions,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-actions { width:100%; justify-content:flex-start; }

    .topbar-actions {
        gap: 8px;
    }

    .page-shell {
        width: min(100% - 24px, 1180px);
        margin-top: 28px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .dashboard-start { grid-template-columns: 1fr; }
    .dashboard-quick-actions { grid-template-columns: 1fr; }
    .dashboard-workspace-links { padding-left: 18px; grid-template-columns: 1fr; }

    .full-width {
        grid-column: auto;
    }

    .auth-card,
    .form-card {
        padding: 22px;
    }

    .scroll-to-top { left: 14px; bottom: 14px; width: 44px; height: 44px; }
}
.notification-unread{border-left:4px solid var(--color-primary,#2357d9)}

.table-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.table-tools input,.table-tools select { width: auto; min-width: 150px; margin: 0; }
.table-tools-search { flex: 1 1 240px; }
.table-tools-count { margin-left: auto; color: var(--muted); font-size: .9rem; white-space: nowrap; }
@media (max-width:720px){.table-tools input,.table-tools select{width:100%}.table-tools-count{margin-left:0}}

.table-card { overflow:auto; scrollbar-gutter:stable; }
.table-card thead th { position:sticky; z-index:2; top:0; background:#f8faff; }
.table-card tbody tr { transition:background-color 100ms ease; }
.table-card tbody tr:hover,.table-card tbody tr:focus-within { background:#f7faff; }
.table-card td :where(a,button) { min-height:24px; display:inline-flex; align-items:center; }
input[readonly],textarea[readonly] { background:#f3f5f9; color:#4f5c70; }

@media (prefers-reduced-motion:reduce) {
    *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }
}

@media (max-width:720px) {
    .section-tabs { overflow-x:auto; scrollbar-width:thin; }
    .section-tabs a { flex:0 0 auto; }
    .table-card.is-scrollable::before { content:attr(data-scroll-hint); position:sticky; left:8px; z-index:4; display:inline-block; margin:8px; padding:5px 8px; border-radius:7px; background:#142347; color:#fff; font-size:12px; font-weight:700; box-shadow:0 4px 12px rgba(15,35,71,.18); }
}
