:root {
    --dwkdesk-blue: #009ee0;
    --dwkdesk-blue-dark: #0088c2;
    --dwkdesk-blue-light: #e6f6fc;
    --header-bg: #ffffff;
    --sidebar-bg: #1a3352;
    --sidebar-hover: #243f63;
    --sidebar-active: #009ee0;
    --sidebar-text: #c8d6e5;
    --sidebar-width: 52px;
    --bg: #eef1f5;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #d8e0e8;
    --border-light: #e8edf2;
    --success: #27ae60;
    --warning: #e67e22;
    --danger: #e74c3c;
    --radius: 3px;
    --shadow: 0 1px 2px rgba(0,0,0,.06);
    --table-header: #f4f7fa;
    --filter-bg: #f0f3f7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
}

a { color: var(--dwkdesk-blue); text-decoration: none; }
a:hover { color: var(--dwkdesk-blue-dark); }

/* ── Shell ── */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.top-header {
    height: 48px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px 0 0;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow);
}

.header-spacer { width: var(--sidebar-width); flex-shrink: 0; }

.btn-new-issue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--dwkdesk-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn-new-issue:hover { background: var(--dwkdesk-blue-dark); color: #fff; text-decoration: none; }

.header-search {
    flex: 1;
    max-width: 320px;
    margin-left: 8px;
}
.header-search input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2395a5a6' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85z'/%3E%3C/svg%3E") 10px center no-repeat;
}
.header-search input:focus {
    outline: none;
    border-color: var(--dwkdesk-blue);
}

.page-load-indicator {
    flex: 1;
    min-width: 140px;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 2px 4px;
    transition: opacity 0.3s ease;
}

.page-load-indicator.idle {
    opacity: 0.55;
}

.page-load-indicator.idle .pli-progress-bar {
    background: var(--success);
}

.page-load-indicator.done .pli-time {
    color: var(--success);
}

.pli-progress {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
}

.pli-progress-bar {
    height: 100%;
    width: 0;
    background: var(--dwkdesk-blue);
    border-radius: 2px;
    transition: width 0.15s linear;
}

.page-load-indicator.loading .pli-progress-bar {
    background: linear-gradient(90deg, var(--dwkdesk-blue), #4db8e8);
}

.pli-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--text-muted);
    min-height: 14px;
}

.pli-item {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pli-time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--dwkdesk-blue);
    flex-shrink: 0;
}

.pli-time.slow {
    color: var(--danger);
}

.pli-total {
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    opacity: 0.85;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 16px;
}
.header-icon-btn:hover { background: #f0f3f7; color: var(--text); text-decoration: none; }

.header-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
}
.header-user-menu:hover { background: #f0f3f7; }

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--dwkdesk-blue);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name { font-size: 13px; color: var(--text); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    min-width: 160px;
    z-index: 300;
    margin-top: 4px;
}
.header-user-menu:hover .user-dropdown { display: block; }
.user-dropdown a {
    display: block;
    padding: 9px 14px;
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
}
.user-dropdown a:hover { background: #f4f7fa; color: var(--dwkdesk-blue); }

.body-wrap { display: flex; flex: 1; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 210;
    padding-top: 48px;
}

.sidebar-logo {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: 4px;
    overflow: hidden;
}

.brand-logo {
    display: block;
    object-fit: contain;
}

.brand-logo--sidebar {
    width: 40px;
    height: 40px;
    object-fit: cover;
    object-position: top center;
}

.brand-logo--login {
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto;
}

.sidebar nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.sidebar nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    color: var(--sidebar-text);
    text-decoration: none;
    position: relative;
    transition: background .15s, color .15s;
}
.sidebar nav a svg { width: 20px; height: 20px; fill: currentColor; opacity: .85; }
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; }
.sidebar nav a.active svg { opacity: 1; }

.sidebar nav a[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1a3352;
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    white-space: nowrap;
    z-index: 400;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.page-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.page-header h1 { font-size: 20px; font-weight: 600; }
.page-content { padding: 16px 20px; flex: 1; }
.page-content.flush { padding: 0; }

/* ── Issues page (DwkDesk style) ── */
.issues-page { background: #fff; min-height: calc(100vh - 48px); }
.active-filter-banner {
    padding: 8px 16px;
    background: #fff8e6;
    border-bottom: 1px solid #f0e0b0;
    font-size: 13px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.saved-filter-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    background: #fff;
    padding: 0 12px;
    scrollbar-width: thin;
}
.saved-filter-tabs::-webkit-scrollbar { height: 4px; }

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
}
.filter-tab:hover { color: var(--dwkdesk-blue); text-decoration: none; background: #f8fafc; }
.filter-tab.active { color: var(--dwkdesk-blue); border-bottom-color: var(--dwkdesk-blue); font-weight: 600; }
.filter-tab .tab-count { color: var(--text-muted); font-weight: 400; }
.filter-tab.active .tab-count { color: var(--dwkdesk-blue); }
.filter-tab .tab-edit { opacity: 0; font-size: 11px; margin-left: 2px; }
.filter-tab:hover .tab-edit { opacity: .6; }

.issues-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
    flex-wrap: wrap;
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
}
.filter-toggle-btn:hover, .filter-toggle-btn.active { border-color: var(--dwkdesk-blue); color: var(--dwkdesk-blue); }

.toolbar-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff;
    color: var(--text);
}

.toolbar-search {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    position: relative;
}
.toolbar-search input {
    width: 100%;
    padding: 6px 10px 6px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
}
.toolbar-search svg {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    fill: #95a5a6;
}

.view-switcher {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-left: auto;
}
.view-switcher a, .view-switcher span {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-right: 1px solid var(--border);
    background: #fff;
}
.view-switcher a:last-child, .view-switcher span:last-child { border-right: none; }
.view-switcher a:hover { background: #f4f7fa; color: var(--dwkdesk-blue); text-decoration: none; }
.view-switcher .active { background: var(--dwkdesk-blue-light); color: var(--dwkdesk-blue); font-weight: 500; }

/* Filter panel */
.filter-panel {
    display: none;
    background: var(--filter-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}
.filter-panel.open { display: block; }

.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.filter-panel-header h3 { font-size: 14px; font-weight: 600; }
.filter-panel-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 20px;
}
.filter-field label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.filter-field select, .filter-field input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff;
}

.filter-multiselect { position: relative; }
.filter-multiselect .ms-control {
    width: 100%;
    padding: 7px 32px 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%238898a8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
    cursor: pointer;
    min-height: 32px;
    display: flex;
    align-items: center;
}
.filter-multiselect .ms-display {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}
.filter-multiselect .ms-display.has-value { color: var(--text); }
.filter-multiselect .ms-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 120;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 280px;
    overflow: hidden;
}
.filter-multiselect.open .ms-dropdown { display: block; }
.filter-multiselect .ms-dropdown[hidden] { display: none !important; }
.filter-multiselect .ms-search {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    padding: 8px 10px;
    font-size: 12px;
}
.filter-multiselect .ms-options {
    max-height: 230px;
    overflow-y: auto;
    padding: 4px 0;
}
.filter-multiselect .ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
}
.filter-multiselect .ms-option:hover { background: #f4f7fa; }
.filter-multiselect .ms-option[hidden] { display: none !important; }
.filter-multiselect .ms-option input { width: auto; margin: 0; flex-shrink: 0; }
.filter-multiselect .ms-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-multiselect .ms-empty {
    padding: 10px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.filter-multiselect .ms-hint {
    padding: 8px 10px;
    font-size: 11px;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light);
}

.filter-multiselect.ms-loading .ms-control {
    opacity: 0.7;
    pointer-events: none;
}

.filter-panel-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-fields-toolbar {
    margin-bottom: 12px;
}

.filter-field-add-select {
    width: 100%;
    max-width: 360px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff;
    color: var(--text);
}

.filter-fields-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
}

.filter-row {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.filter-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-row-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.filter-row-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.filter-row-remove:hover {
    color: var(--danger, #c0392b);
}

.filter-row-body .filter-field {
    margin: 0;
}

.filter-bool-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.filter-text-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.filter-row .filter-multiselect > label {
    display: none;
}

.filter-date-range {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-date-part {
    flex: 1;
    min-width: 0;
}

.filter-date-part label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.filter-date-part input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff;
}

.filter-panel-footer .footer-controls {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.filter-checkboxes { display: flex; gap: 16px; align-items: center; }
.filter-checkboxes label { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; }

/* Issues table */
.issues-table-wrap { overflow-x: auto; }

.issues-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.issues-table th {
    text-align: left;
    padding: 8px 10px;
    background: var(--table-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.issues-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    max-width: 280px;
}
.issues-table tbody tr { position: relative; }
.issues-table tbody tr:hover td { background: #f8fbfd; }

.col-indicator { width: 4px; padding: 0 !important; }
.row-indicator {
    display: block;
    width: 3px;
    height: 100%;
    min-height: 36px;
    background: transparent;
}
.issue-row.row-overdue .row-indicator { background: var(--danger); }
.issue-row.row-critical .row-indicator { background: #c0392b; }

.col-num { width: 80px; white-space: nowrap; }
.col-num a { font-weight: 600; color: var(--text); }
.col-num a:hover { color: var(--dwkdesk-blue); }

.col-object { width: 100px; }
.object-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text);
    font-size: 12px;
}
.object-link .edit-icon { opacity: 0; font-size: 10px; color: var(--text-muted); }
.issue-row:hover .object-link .edit-icon { opacity: .7; }

.col-subject a { color: var(--text); line-height: 1.35; }
.col-subject a:hover { color: var(--dwkdesk-blue); }
.col-subject .subject-bold { font-weight: 600; }

.col-date { width: 130px; white-space: nowrap; color: var(--text-muted); font-size: 11px; }

.col-assignee { width: 160px; font-size: 12px; }

.col-contract { width: 180px; }
.contract-link { font-size: 11px; }
.contract-green { color: #27ae60; }
.contract-orange { color: #e67e22; }
.contract-red { color: #e74c3c; }

.col-type { width: 130px; font-size: 11px; color: var(--text-muted); }

.col-status { width: 130px; }
.col-actions { width: 60px; text-align: center; white-space: nowrap; }

.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}
.action-icon:hover { background: #eef2f6; color: var(--dwkdesk-blue); text-decoration: none; }

.table-footer {
    padding: 0;
    border-top: 1px solid var(--border-light);
    background: #fff;
}

/* ── List pager (OkDesk style) ── */
.list-pager {
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border-light);
    background: #fff;
}
.list-pager-top {
    border-top: none;
    border-bottom: 1px solid var(--border-light);
}
.list-pager-total {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.list-pager-row {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 32px;
    padding: 0 140px;
}
.list-pager-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.pager-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
}
.pager-num:hover {
    color: var(--dwkdesk-blue);
    text-decoration: none;
}
.pager-num.active {
    background: var(--dwkdesk-blue);
    color: #fff;
    font-weight: 600;
}
.pager-ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 13px;
}
.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #eef2f6;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}
.pager-btn:hover {
    background: #dde4ea;
    color: var(--dwkdesk-blue);
    text-decoration: none;
}
.list-pager-size {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.pager-per-page-select {
    appearance: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23999' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.pager-per-page-select:focus {
    outline: none;
    border-color: var(--dwkdesk-blue);
}

body.pager-loading {
    cursor: progress;
}

body.pager-loading .list-pager-nav a,
body.pager-loading .pager-per-page-select {
    pointer-events: none;
    opacity: 0.6;
}

.pagination { display: flex; gap: 6px; align-items: center; }

/* ── Status badges (DwkDesk) ── */
.status-badge, .priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.3;
}
.status-badge .status-edit { opacity: 0; font-size: 9px; margin-left: 2px; }
.issue-row:hover .status-badge .status-edit { opacity: .7; }

.status-created { background: #fdebd0; color: #d35400; border: 1px solid #f5cba7; }
.status-progress { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.status-paused { background: #fadbd8; color: #c0392b; border: 1px solid #f1948a; }
.status-done { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.status-closed { background: #eaecee; color: #566573; border: 1px solid #d5d8dc; }
.status-default { background: #ebf5fb; color: #2471a3; border: 1px solid #aed6f1; }
.status-open, .status-new { background: #fdebd0; color: #d35400; border: 1px solid #f5cba7; }
.status-delayed { background: #fadbd8; color: #c0392b; border: 1px solid #f1948a; }

.priority-critical { background: #fadbd8; color: #c0392b; }
.priority-high { background: #fdebd0; color: #d35400; }
.priority-normal { background: #ebf5fb; color: #2471a3; }
.priority-low { background: #f4f6f7; color: #7f8c8d; }

/* ── Cards & stats ── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--dwkdesk-blue); line-height: 1.1; }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .3px; }

/* ── Generic tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left;
    padding: 9px 12px;
    background: var(--table-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tbody tr:hover td { background: #f8fbfd; }
.data-table .col-id { width: 70px; }
.data-table .col-num a { font-weight: 600; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary { background: var(--dwkdesk-blue); color: #fff; }
.btn-primary:hover { background: var(--dwkdesk-blue-dark); color: #fff; text-decoration: none; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f4f7fa; text-decoration: none; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-dark { background: #2c3e50; color: #fff; }
.btn-dark:hover { background: #1a252f; color: #fff; text-decoration: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.search-wrap { position: relative; }
.search-wrap input {
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    min-width: 240px;
}
.search-wrap .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: .5; }

.filter-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-tabs a {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    background: var(--card-bg);
    border: 1px solid var(--border);
    text-decoration: none;
}
.filter-tabs a:hover { border-color: var(--dwkdesk-blue); color: var(--dwkdesk-blue); text-decoration: none; }
.filter-tabs a.active { background: var(--dwkdesk-blue); color: #fff; border-color: var(--dwkdesk-blue); }

.toolbar select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: #fff;
}

.pagination { display: flex; gap: 6px; align-items: center; }
.pagination a, .pagination span {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text);
    text-decoration: none;
    background: #fff;
}
.pagination a:hover { border-color: var(--dwkdesk-blue); color: var(--dwkdesk-blue); }
.pagination .current { background: var(--dwkdesk-blue); color: #fff; border-color: var(--dwkdesk-blue); }

/* ── Detail pages ── */
.detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.issue-title-block { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.issue-title-block h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.issue-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); }

.detail-field {
    display: flex;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.detail-field-label { width: 130px; flex-shrink: 0; color: var(--text-muted); }
.detail-field-value { flex: 1; word-break: break-word; }

.timeline { list-style: none; }
.timeline li {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    display: flex;
    gap: 12px;
}
.timeline .tl-date { color: var(--text-muted); white-space: nowrap; min-width: 110px; font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.bar-chart { padding: 8px 0; }
.bar-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.bar-item .bar-label { width: 120px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-item .bar-track { flex: 1; height: 16px; background: #eef2f6; border-radius: 2px; overflow: hidden; }
.bar-item .bar-fill { height: 100%; background: var(--dwkdesk-blue); }
.bar-item .bar-value { width: 40px; text-align: right; color: var(--text-muted); font-size: 11px; }

.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 16px; }
.tabs a {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs a:hover { color: var(--dwkdesk-blue); }
.tabs a.active { color: var(--dwkdesk-blue); border-bottom-color: var(--dwkdesk-blue); font-weight: 600; }

.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--text-muted); }
.overdue { color: var(--danger); font-weight: 500; }
.empty-state { text-align: center; padding: 32px; color: var(--text-muted); }

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #009ee0 0%, #1a3352 100%);
}
.login-box {
    background: #fff;
    border-radius: 6px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.login-box .brand { text-align: center; margin-bottom: 24px; }
.login-box .brand p { color: var(--text-muted); font-size: 13px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 5px; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--dwkdesk-blue);
    box-shadow: 0 0 0 2px rgba(0,158,224,.12);
}

.error-msg {
    background: #fadbd8;
    color: #922b21;
    padding: 9px 12px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
}

.sla-ok { color: var(--success); }
.sla-late { color: var(--danger); }

@media (max-width: 1200px) {
    .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .detail-layout { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-area { margin-left: 0; }
    .header-spacer { display: none; }
    .header-search { display: none; }
    .view-switcher { display: none; }
}

/* ── List pages ── */
.list-page { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
}
.list-toolbar select, .list-toolbar label {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: #fff;
}
.list-toolbar label { display: inline-flex; align-items: center; gap: 6px; border: none; padding: 0; }

.page-header.compact { padding: 12px 20px; }
.page-header.compact h1 { font-size: 18px; }

.page-back { margin-top: 14px; }

.success-msg {
    background: #d5f5e3;
    color: #1e8449;
    padding: 9px 12px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
}

/* ── Issue detail (DwkDesk) ── */
.issue-detail-page { background: #fff; }

.issue-detail-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.issue-detail-header .issue-num {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.issue-detail-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.35;
}
.issue-detail-header .issue-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.issue-detail-header .issue-dates {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.issue-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ── Entity detail (objects, agreements) ── */
.entity-detail-page { background: #fff; }
.entity-detail-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.entity-detail-header .entity-num {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.entity-detail-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.35;
}
.entity-detail-header .entity-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.entity-detail-header .entity-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.entity-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0;
    padding: 0 16px 12px;
}
.params-grid .detail-field {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.param-values-cell { max-width: 320px; word-break: break-word; font-size: 12px; }
.address-line { padding: 6px 0; font-size: 13px; }
.address-list .map-link { margin-left: 8px; font-size: 12px; }
.param-empty { color: var(--text-muted); }
.param-field-empty .detail-field-label { color: var(--text-muted); }
.param-required { color: #e74c3c; margin-left: 2px; }
.param-type-hint { display: block; font-size: 10px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.tab-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: #fafbfc;
}
.entity-detail-layout { padding: 16px 20px; gap: 14px; }
.sidebar-card-action { padding: 8px 16px 12px; }
.text-muted { color: var(--text-muted); }

.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    padding: 0 16px;
    overflow-x: auto;
}
.detail-tabs a, .detail-tabs button {
    padding: 11px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.detail-tabs a:hover, .detail-tabs button:hover { color: var(--dwkdesk-blue); }
.detail-tabs a.active, .detail-tabs button.active {
    color: var(--dwkdesk-blue);
    border-bottom-color: var(--dwkdesk-blue);
    font-weight: 600;
}

.detail-tab-panel { display: none; padding: 0; }
.detail-tab-panel.active { display: block; }

.comment-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
}
.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--dwkdesk-blue-light);
    color: var(--dwkdesk-blue);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-date { font-size: 11px; color: var(--text-muted); margin-left: 8px; font-weight: 400; }
.comment-text { margin-top: 6px; white-space: pre-wrap; font-size: 13px; line-height: 1.5; }

.sidebar-card .card-header { font-size: 13px; }
.sidebar-card .detail-field { padding: 8px 16px; font-size: 12px; }
.sidebar-card .detail-field-label { width: 110px; }

.form-card { max-width: 760px; }
.form-card .card-body { padding: 20px 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }

.entity-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.entity-detail-grid .card { margin-bottom: 0; }

.dashboard-page .stats-grid { margin-bottom: 16px; }
.dashboard-page .stat-card { transition: box-shadow .15s; }
.dashboard-page .stat-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.reports-page .card { margin-bottom: 14px; }

.kb-content { white-space: pre-wrap; line-height: 1.7; font-size: 14px; padding: 20px 24px; }
.kb-meta {
    padding: 12px 24px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
}

.attach-list { padding: 12px 20px; }
.attach-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.attach-item:last-child { border-bottom: none; }

.upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1024px) {
    .entity-detail-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* ── DwkDesk polish ── */
.user-caret { font-size: 10px; color: var(--text-muted); }
.sidebar-logo { text-decoration: none; display: flex; align-items: center; justify-content: center; }
.sidebar-settings { display: flex; align-items: center; justify-content: center; height: 44px; color: var(--sidebar-text); border-top: 1px solid rgba(255,255,255,.08); margin-top: auto; text-decoration: none; }
.sidebar-settings svg { width: 20px; height: 20px; fill: currentColor; opacity: .85; }
.sidebar-settings:hover { background: var(--sidebar-hover); color: #fff; }
.filter-tab-add { font-size: 16px; font-weight: 600; color: var(--text-muted); min-width: 32px; justify-content: center; cursor: pointer; }
.filter-tab-add { background: inherit; font-family: inherit; }
.filter-tab[draggable="true"] { cursor: grab; user-select: none; }
.filter-tab.dragging { opacity: 0.45; cursor: grabbing; }
.filter-tab.drag-over { box-shadow: inset 0 -2px 0 var(--dwkdesk-blue); }

.filter-tabs-bar {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    background: #f4f7fa;
    border-bottom: 1px solid var(--border);
    padding: 6px 4px 0;
}
.filter-tabs-viewport {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
}
.filter-tabs-viewport::-webkit-scrollbar { display: none; }
.filter-tabs-viewport .saved-filter-tabs {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    background: transparent;
    border-bottom: none;
    padding: 0;
}
.filter-tabs-nav {
    flex-shrink: 0;
    width: 28px;
    height: 32px;
    margin-bottom: 1px;
    border: 1px solid var(--border);
    border-radius: 4px 4px 0 0;
    background: #e8edf2;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.filter-tabs-nav:hover:not([hidden]) {
    background: #dde4ea;
    color: var(--dwkdesk-blue);
}
.filter-tabs-nav[hidden] { display: none; }
.filter-tab-menu {
    position: fixed;
    z-index: 500;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 4px 0;
}
.filter-tab-menu button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}
.filter-tab-menu button:hover { background: #f4f7fa; }
.filter-tab-menu button.danger { color: var(--danger); }
.filter-save-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: 12px;
}
.filter-grid-4 { grid-template-columns: repeat(4, 1fr); }
.filter-name-input { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; width: 160px; }
.view-switcher .disabled { opacity: .45; cursor: not-allowed; }

/* Calendar view */
.issues-calendar-wrap { padding: 12px 16px; background: #fff; }
.calendar-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.calendar-title { font-size: 18px; font-weight: 600; margin: 0; min-width: 180px; text-align: center; }
.issues-calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.issues-calendar th { background: #f4f7fa; padding: 8px; font-size: 11px; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--border); }
.issues-calendar td { vertical-align: top; height: 100px; border: 1px solid var(--border); padding: 4px 6px; background: #fff; }
.issues-calendar td.cal-empty { background: #fafbfc; }
.issues-calendar td.cal-today { background: #eef6ff; }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.cal-today .cal-day-num { color: var(--dwkdesk-blue); }
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event { display: block; font-size: 10px; line-height: 1.3; padding: 2px 4px; background: var(--dwkdesk-blue-light); color: var(--dwkdesk-blue); border-radius: 3px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event:hover { background: var(--dwkdesk-blue); color: #fff; }
.cal-event.cal-overdue { background: #fdecea; color: #c0392b; }
.cal-more { font-size: 10px; color: var(--text-muted); padding-left: 4px; }

/* Map view */
.issues-map-wrap { padding: 0; background: #fff; }
.issues-map { height: calc(100vh - 220px); min-height: 400px; width: 100%; z-index: 1; }

/* Inline status */
.status-inline-wrap { display: inline-block; position: relative; }
.status-inline-wrap .status-display { cursor: pointer; }
.status-inline-wrap .status-display:hover .status-edit { opacity: 1; }
.status-inline-select { font-size: 11px; padding: 2px 4px; border: 1px solid var(--dwkdesk-blue); border-radius: var(--radius); max-width: 160px; }

/* Favorites */
.action-star { cursor: pointer; opacity: .45; background: none; border: none; font-size: 14px; padding: 0 2px; line-height: 1; }
.action-star:hover, .action-star.active { opacity: 1; color: #f39c12; }
.filter-tab-favorites.active { color: #e67e22; }
.col-check { width: 28px; text-align: center; }
.issue-id-link { font-weight: 600; color: var(--text); font-family: ui-monospace, monospace; font-size: 12px; }
.issue-id-link:hover { color: var(--dwkdesk-blue); }
.btn-login { width: 100%; padding: 11px; margin-top: 8px; }
.saved-filter-tabs { background: #f4f7fa; padding: 6px 8px 0; border-bottom: 1px solid var(--border); }
.filter-tabs-bar .filter-tab-add { margin-bottom: 0; flex-shrink: 0; }
.filter-tab { background: #e8edf2; border: 1px solid var(--border); border-bottom: none; border-radius: 4px 4px 0 0; margin-right: 2px; padding: 8px 12px; text-transform: uppercase; font-size: 11px; letter-spacing: .3px; }
.filter-tab.active { background: #fff; border-bottom: 1px solid #fff; margin-bottom: -1px; z-index: 1; position: relative; }
.issues-table { font-size: 12px; }
.issues-table td { padding: 5px 8px; }
.issues-table th { padding: 7px 8px; font-size: 10px; }
@media (max-width: 1200px) { .filter-grid-4 { grid-template-columns: repeat(2, 1fr); } }

/* ── Settings admin (DwkDesk-style) ── */
.settings-page .page-content { padding: 0; background: #eef1f5; }
.settings-page-header { padding: 16px 20px 0; background: #fff; border-bottom: 1px solid var(--border); }
.settings-page-header h1 { font-size: 22px; font-weight: 600; margin: 8px 0 12px; }
.settings-page-header .breadcrumb { font-size: 12px; color: var(--text-muted); }
.settings-page-header .breadcrumb a { color: var(--text-muted); }

.settings-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 120px);
    align-items: start;
}

.settings-nav {
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 12px 0 24px;
    position: sticky;
    top: 48px;
    min-height: calc(100vh - 48px);
}
.settings-nav-group { margin-bottom: 14px; }
.settings-nav-title {
    padding: 8px 16px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-muted);
    font-weight: 600;
}
.settings-nav-link {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    font-size: 13px;
    border-left: 3px solid transparent;
    text-decoration: none;
}
.settings-nav-link:hover { background: #f4f7fa; color: var(--dwkdesk-blue); text-decoration: none; }
.settings-nav-link.active {
    background: var(--dwkdesk-blue-light);
    color: var(--dwkdesk-blue);
    border-left-color: var(--dwkdesk-blue);
    font-weight: 500;
}
.settings-nav-footer { padding: 16px; border-top: 1px solid var(--border-light); margin-top: 8px; }
.settings-back-link { font-size: 12px; color: var(--text-muted); }

.settings-content { padding: 20px 24px 40px; max-width: 980px; }
.settings-section { margin-bottom: 16px; }
.settings-fields .form-group { margin-bottom: 14px; }
.settings-fields label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 12px; }
.settings-fields input[type=text],
.settings-fields input[type=email],
.settings-fields select {
    width: 100%;
    max-width: 420px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 860px; }
.field-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.settings-check-grid { display: grid; grid-template-columns: repeat(2, minmax(200px, 1fr)); gap: 10px 20px; }
.settings-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.settings-form-footer { margin-top: 8px; padding-top: 4px; }
.settings-note { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.settings-table { width: 100%; font-size: 12px; }
.settings-table th { background: var(--table-header); text-align: left; padding: 8px 10px; font-size: 11px; }
.settings-table td { padding: 8px 10px; border-top: 1px solid var(--border-light); vertical-align: middle; }
.settings-table code { font-size: 11px; background: #f4f7fa; padding: 2px 5px; border-radius: 2px; }
.settings-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stat-chip {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.stat-chip .stat-num { font-size: 18px; font-weight: 700; color: var(--dwkdesk-blue); margin-right: 4px; }
.roles-matrix .perm-cell { text-align: center; width: 120px; }
.perm-yes { color: var(--success); font-weight: 700; }
.perm-no { color: var(--text-muted); }
.inline-form { display: inline; }
.settings-inline-form { display: flex; gap: 8px; align-items: center; max-width: 480px; }
.settings-inline-form input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.api-token-display { display: inline-block; margin-top: 6px; padding: 8px 12px; background: #f4f7fa; word-break: break-all; }
.profile-admin-link { margin-bottom: 12px; font-size: 13px; }

/* Portal users table filters & modals */
.table-filter-row th { padding: 4px 6px; background: #f8fafc; border-top: none; }
.table-filter-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 11px;
    box-sizing: border-box;
}
.portal-user-status { cursor: context-menu; user-select: none; }
.portal-user-menu { z-index: 600; }
.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-modal[hidden] { display: none !important; }
.portal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}
.portal-modal-dialog {
    position: relative;
    width: min(640px, 94vw);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.portal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}
.portal-modal-header h3 { font-size: 16px; margin: 0; }
.portal-modal-close {
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.portal-modal-body { padding: 16px 18px; }
.portal-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.form-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.form-field input,
.form-field select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    box-sizing: border-box;
}
.readonly-field { background: #f4f7fa; color: var(--text-muted); }
.password-fieldset {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.password-fieldset legend { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.btn-danger {
    background: var(--danger, #c0392b);
    color: #fff;
    border: 1px solid transparent;
}
.btn-danger:hover { filter: brightness(0.92); }
.employee-search-wrap { position: relative; margin-top: 8px; }
.search-results-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 10;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}
.search-result-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}
.search-result-item:hover { background: #f4f7fa; }
.search-selected-label { font-size: 12px; color: var(--dwkdesk-blue); margin-top: 6px; }
.delete-issue-count { font-size: 13px; font-weight: 600; margin: 8px 0 14px; }
.radio-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

@media (max-width: 900px) {
    .settings-shell { grid-template-columns: 1fr; }
    .settings-nav { position: static; min-height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .form-row { grid-template-columns: 1fr; }
    .settings-check-grid { grid-template-columns: 1fr; }
}
