@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* Dark palette */
    --bg: #121212;
    --surface: #1A1A1A;
    --card: #202124;
    --elevated: #252526;
    --hover: #2A2D2E;
    --border: #323232;
    --divider: rgba(255, 255, 255, 0.08);

    --text: #F5F5F5;
    --text-secondary: #C7C7C7;
    --text-muted: #999999;
    --text-disabled: #6E6E6E;

    --accent: #4F8CFF;
    --link: #7AB8FF;

    --success: #34C759;
    --warning: #FFB020;
    --danger: #FF5F57;
    --info: #4F8CFF;

    /* Legacy aliases (existing components) */
    --color-bg: var(--bg);
    --color-surface: var(--card);
    --color-primary: var(--text);
    --color-primary-light: var(--elevated);
    --color-accent: var(--accent);
    --color-success: var(--success);
    --color-warning: var(--warning);
    --color-danger: var(--danger);
    --color-text: var(--text);
    --color-text-muted: var(--text-muted);
    --color-border: var(--border);

    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.36);

    --transition: 180ms ease;
    --focus-ring: 0 0 0 3px rgba(79, 140, 255, 0.35);

    --accent-bg: rgba(79, 140, 255, 0.1);
    --success-bg: rgba(52, 199, 89, 0.12);
    --warning-bg: rgba(255, 176, 32, 0.12);
    --danger-bg: rgba(255, 95, 87, 0.12);
    --info-bg: rgba(79, 140, 255, 0.12);

    --chart-blue: #4F8CFF;
    --chart-green: #34C759;
    --chart-orange: #FFB020;
    --chart-purple: #8B7CFF;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    color-scheme: dark;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Navbar */
.navbar {
    background: var(--surface);
    color: var(--text);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.nav-isms-client {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0.25rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--divider);
}

.nav-brand a,
.nav-brand-app,
.nav-brand-link {
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
}

.nav-role-switcher-toggle {
    font-weight: 600;
}

.nav-role-switcher-menu .nav-role-switcher-form {
    margin: 0;
}

.nav-role-switcher-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--color-text);
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.nav-role-switcher-item:hover,
.nav-role-switcher-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}

.nav-brand a {
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-links a {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--hover);
    color: var(--text);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--accent);
    background: var(--accent-bg);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.35rem;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.nav-dropdown-caret {
    font-size: 0.75rem;
    line-height: 1;
}

.nav-dropdown:hover > .nav-dropdown-toggle,
.nav-dropdown:focus-within > .nav-dropdown-toggle,
.nav-dropdown.active > .nav-dropdown-toggle,
.nav-dropdown.is-open > .nav-dropdown-toggle {
    background: var(--hover);
    color: var(--text);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 190px;
    padding: 0.35rem 0;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    color: var(--color-text);
    padding: 0.55rem 1rem;
    border-radius: 0;
    font-size: 0.9rem;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
    background: var(--accent-bg);
    color: var(--accent);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.user-name {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
    width: 100%;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    min-height: 36px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
    gap: 0.25rem;
}

.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d7aef; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--hover); color: var(--text); border-color: var(--border); }
.btn-secondary { background: var(--elevated); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e54e47; color: #fff; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Highlight the "Add item" action */
.btn-add-item {
    background: transparent;
    border: 1px dashed var(--color-accent);
    color: var(--color-accent);
}

.btn-add-item:hover {
    background: var(--accent-bg);
    color: var(--color-accent);
}

.btn-primary.btn-add-item,
.btn-outline.btn-add-item {
    background: transparent;
    color: var(--color-accent);
    border: 1px dashed var(--color-accent);
}

.btn-primary.btn-add-item:hover,
.btn-outline.btn-add-item:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--elevated);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.searchable-select-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

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

.searchable-select {
    position: relative;
}

.searchable-select-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--elevated);
    color: var(--text);
}

.searchable-select-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.searchable-select-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
    background: var(--hover);
}

.searchable-select-option.is-selected {
    font-weight: 600;
    color: var(--color-accent);
}

.form-hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.25rem; display: block; }

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 150px; }
.form-row .flex-grow { flex: 2; }
.form-actions { flex: 0 0 auto !important; min-width: auto !important; }
.form-actions .btn { margin-left: 0.25rem; }

.form-actions-bottom {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.form-actions-bottom .report-delete-form {
    margin-right: auto;
}

.report-delete-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.filter-form {
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.date-period-filter {
    margin-bottom: 1rem;
}

.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.period-btn {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.period-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.period-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.date-range-fields {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.chart-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.chart-card-header {
    margin-bottom: 1.25rem;
}

.chart-card-header h2 {
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.chart-card-subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.hours-chart {
    overflow-x: auto;
}

.hours-chart-plot {
    display: flex;
    gap: 0.75rem;
    min-width: min(100%, 640px);
}

.hours-chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 0 0 3.5rem;
    height: 280px;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-align: right;
    padding-bottom: 2.5rem;
}

.hours-chart-y-tick {
    line-height: 1;
}

.hours-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 280px;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.hours-chart-bars::before {
    content: '';
    position: absolute;
    inset: 0 0 2.5rem 0;
    background-image: linear-gradient(to top, transparent calc(100% - 1px), var(--color-border) calc(100% - 1px));
    background-size: 100% 25%;
    pointer-events: none;
    opacity: 0.45;
}

.hours-chart-bar-col {
    flex: 1 1 0;
    min-width: 3.5rem;
    max-width: 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hours-chart-bar-wrap {
    width: 100%;
    height: 240px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hours-chart-bar {
    width: 72%;
    min-height: 0;
    display: flex;
    flex-direction: column-reverse;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    background: var(--elevated);
    transition: height 0.2s ease;
}

.hours-chart-segment {
    width: 100%;
    min-height: 2px;
}

.hours-chart-value {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.hours-chart-label {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hours-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.hours-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.hours-chart-legend-swatch {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 2px;
    flex-shrink: 0;
}

.leave-work-days-count {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.15rem 0 0.35rem;
}

.hidden {
    display: none !important;
}

.form-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(52, 199, 89, 0.25); }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255, 95, 87, 0.25); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255, 176, 32, 0.25); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(79, 140, 255, 0.25); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.table th, .table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--divider);
    font-size: 0.875rem;
}

.table th {
    background: var(--elevated);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--hover); }
.table tbody tr.selected td,
.clickable-row.selected td {
    background: var(--accent-bg);
}
.row-muted td { opacity: 0.45; }

.result-count {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.status-completed { background: var(--success-bg); color: var(--success); border-color: rgba(52, 199, 89, 0.25); }
.status-progress { background: var(--warning-bg); color: var(--warning); border-color: rgba(255, 176, 32, 0.25); }
.status-leave { background: rgba(139, 124, 255, 0.12); color: var(--chart-purple); border-color: rgba(139, 124, 255, 0.25); }

/* Report cards */
.report-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.report-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.report-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.report-card-link:hover,
.report-card-link:focus-visible {
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.clickable-row {
    cursor: pointer;
    transition: background var(--transition);
}

.clickable-row:hover,
.clickable-row:focus-visible {
    background: var(--hover);
    outline: none;
}

.clickable-row:focus-visible {
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

.report-card-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.report-object { font-weight: 600; font-size: 0.95rem; }
.report-date { font-size: 0.8rem; color: var(--color-text-muted); }
.report-card-body { padding: 0.75rem 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.report-card-started {
    border-left: 4px solid var(--color-warning);
}
.report-card-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--color-border); }

/* Report detail */
.report-detail {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.report-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.meta-label { display: block; font-size: 0.8rem; color: var(--color-text-muted); }
.meta-value { font-weight: 600; font-size: 0.95rem; }

.report-section { margin-bottom: 1.5rem; }
.report-section h3 { font-size: 1.25rem; font-weight: 600; color: var(--text); margin-bottom: 0.75rem; }

.work-detail-item {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.work-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.work-number { font-weight: 600; color: var(--accent); }
.work-desc { flex: 1; }
.work-detail-comment {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.work-time {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    white-space: nowrap;
}

.work-updated {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.work-time-total {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.95rem;
}

.time-spent-group {
    min-width: 11rem;
    flex: 0 0 auto !important;
}

.time-spent-input {
    width: 100%;
    max-width: 11rem;
}

.time-spent-preview {
    display: none;
}

/* Work items form */
.work-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.mt-4 { margin-top: 1.5rem; }

/* Attachments */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.attachment-card {
    text-align: center;
}

.attachment-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    cursor: pointer;
}

.image-lightbox-trigger {
    display: block;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: inherit;
    font: inherit;
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 120px;
    background: var(--color-bg);
    border-radius: var(--radius);
    font-size: 2.5rem;
    text-decoration: none;
}

.attachment-name {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    word-break: break-all;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attachment-item {
    padding: 0.3rem 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.attachment-upload {
    position: relative;
}

.attachment-upload .field-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.attachment-upload .file-input-offscreen {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

.attachment-upload .attachment-trigger {
    cursor: pointer;
    margin: 0;
}

.attachment-upload .attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.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;
}

.new-attachments-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.new-attachment-item {
    position: relative;
    text-align: center;
}

.new-attachment-item img,
.new-attachment-file {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.new-attachment-file {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    font-size: 2rem;
}

.new-attachment-name {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    word-break: break-all;
}

.new-attachment-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
}

.existing-attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.existing-attachment-item {
    position: relative;
    width: 110px;
    text-align: center;
}

.existing-attachment-item img,
.existing-attachment-item .new-attachment-file {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.existing-attachment-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.existing-attachment-item.marked-for-removal {
    opacity: 0.45;
}

.existing-attachment-item.marked-for-removal img,
.existing-attachment-item.marked-for-removal .new-attachment-file {
    border-color: var(--color-danger);
    outline: 2px solid var(--color-danger);
}

.existing-attachment-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    background: var(--color-surface);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.login-form .form-group { margin-bottom: 1.25rem; }

.login-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.login-hint {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.4;
}

.btn-microsoft {
    background: #2f2f2f;
    color: #fff;
    gap: 0.6rem;
}

.btn-microsoft:hover {
    background: #1f1f1f;
    color: #fff;
}

.btn-microsoft-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #f25022 0 50%, transparent 50% 100%),
                linear-gradient(225deg, #7fba00 0 50%, transparent 50% 100%),
                linear-gradient(45deg, #00a4ef 0 50%, transparent 50% 100%),
                linear-gradient(315deg, #ffb900 0 50%, transparent 50% 100%);
    background-size: 50% 50%;
    background-position: top left, top right, bottom left, bottom right;
    background-repeat: no-repeat;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    cursor: pointer;
}

.checkbox-label input {
    margin-top: 0.2rem;
}

/* Sections */
.section { margin-bottom: 2rem; }
.section h2 { font-size: 1.25rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* Two column layout */
.two-column {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.two-column .column { min-width: 280px; }
.two-column .flex-grow { flex: 1; }

.inline-form { display: inline; }

.inline-form[hidden] {
    display: none !important;
}

.actions-cell {
    white-space: nowrap;
}

.attachment-indicator-cell {
    text-align: center;
    white-space: nowrap;
    font-size: 1rem;
}

.actions-cell .inline-form + .inline-form,
.actions-cell .btn + .inline-form,
.actions-cell .inline-form + .btn,
.actions-cell .btn + .btn {
    margin-left: 0.35rem;
}

.form-actions-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.row-editing td {
    background: var(--accent-bg);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

/* Calendar */
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0 0.75rem;
    flex-wrap: wrap;
}

.calendar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    flex: 1;
}

.calendar-summary {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.calendar-grid {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.calendar-weekdays,
.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekday {
    padding: 0.65rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--elevated);
    border-bottom: 1px solid var(--divider);
}

.calendar-day {
    min-height: 120px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: var(--color-surface);
}

.calendar-week .calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-week:last-child .calendar-day {
    border-bottom: none;
}

.calendar-day-outside {
    background: var(--bg);
    opacity: 0.55;
}

.calendar-day-weekend {
    background: var(--surface);
}

.calendar-day-outside.calendar-day-weekend {
    background: var(--bg);
}

.calendar-day-today .calendar-day-number {
    background: var(--color-accent);
    color: white;
}

.calendar-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
}

.calendar-day-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--elevated);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
}

.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: visible;
}

.calendar-event-has-tooltip:hover,
.calendar-event-has-tooltip:focus-visible {
    z-index: 25;
}

.calendar-event {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 3px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.35rem;
    font-size: 0.72rem;
    line-height: 1.3;
    cursor: pointer;
    background: var(--elevated);
    color: var(--text);
    transition: background var(--transition);
}

.calendar-event:hover {
    background: var(--hover);
}

.calendar-event.status-completed {
    border-left-color: var(--success);
    background: var(--success-bg);
}

.calendar-event.status-progress {
    border-left-color: var(--warning);
    background: var(--warning-bg);
}

.calendar-event.status-postponed {
    border-left-color: var(--danger);
    background: var(--danger-bg);
}

.calendar-event-open {
    border-style: dashed;
    opacity: 0.92;
}

.calendar-event-leave {
    background: rgba(139, 124, 255, 0.12);
    border-left-color: var(--chart-purple);
}

.calendar-event-leave:hover {
    background: rgba(139, 124, 255, 0.18);
}

.calendar-event-employee {
    font-weight: 500;
    font-size: 0.68rem;
    color: var(--accent);
}

.calendar-event-client {
    font-size: 0.68rem;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.calendar-event-desc {
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.calendar-event-tooltip {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 30;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    background: var(--elevated);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.calendar-event-has-tooltip:hover .calendar-event-tooltip,
.calendar-event-has-tooltip:focus-visible .calendar-event-tooltip {
    display: block;
}

.calendar-event-tooltip-line {
    display: block;
}

.calendar-event-tooltip-line + .calendar-event-tooltip-line {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Modal */
body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.modal-dialog {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.modal-dialog-form {
    max-width: 640px;
}

.modal-dialog-wide {
    max-width: 720px;
}

.table-clients .client-row td:not(.actions-cell),
.table-users .user-row td:not(.actions-cell),
.table-work-titles .work-title-row td:not(.actions-cell),
.table-recurring-tasks .recurring-task-row td:not(.actions-cell),
.table-recurring-claimable .recurring-claim-row td:not(.actions-cell) {
    user-select: none;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.25rem 0.5rem;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

.modal-loading {
    color: var(--color-text-muted);
    text-align: center;
    padding: 2rem;
}

.modal-report-detail .report-meta {
    margin-bottom: 1rem;
}

/* Image lightbox */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.image-lightbox-dialog {
    position: relative;
    z-index: 1;
    max-width: min(96vw, 1200px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-lightbox-dialog img {
    max-width: 100%;
    max-height: calc(92vh - 3rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.image-lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.image-lightbox-caption {
    margin: 0.75rem 0 0;
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

.existing-attachment-item img,
.new-attachment-item img {
    cursor: pointer;
}

/* Logo */
.nav-logo {
    height: 32px;
    width: auto;
    display: block;
    object-fit: contain;
}

.nav-brand-link {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.nav-brand-link:hover {
    text-decoration: none;
}

.login-logo {
    display: block;
    max-height: 44px;
    max-width: min(220px, 80vw);
    width: auto;
    margin: 0 auto 1rem;
    object-fit: contain;
}

/* ISMS navbar client filter */
.navbar .client-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.navbar .client-selector-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.navbar .client-selector select {
    background: var(--elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    max-width: 220px;
}

.navbar .client-selector select option {
    color: var(--text);
    background: var(--card);
}

/* ISMS module (standard design tokens) */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.stat-label {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.stat-warn .stat-num {
    color: var(--color-warning);
}

.actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

table.data th,
table.data td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--divider);
    font-size: 0.875rem;
    vertical-align: top;
}

table.data th {
    background: var(--elevated);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 1;
}

table.data tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

table.data tr:last-child td {
    border-bottom: none;
}

table.data tbody tr:hover td {
    background: var(--hover);
}

.empty {
    color: var(--color-text-muted);
    padding: 2rem;
    text-align: center;
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.field {
    margin-bottom: 1rem;
}

.label-hint {
    display: block;
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.dl-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.5rem 1rem;
}

.dl-grid dt {
    font-weight: 600;
    color: var(--color-text-muted);
}

.dl-grid dd {
    margin: 0;
}

.filter-bar .field {
    margin-bottom: 0.75rem;
}

.table-scroll {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.row-actions {
    white-space: nowrap;
    font-size: 0.9rem;
}

.row-actions a {
    margin-right: 0.75rem;
}

tr.row-overdue td {
    background: var(--danger-bg);
}

tr.row-overdue td:first-child {
    border-left: 3px solid var(--danger);
}

tr.row-at-risk td {
    background: var(--warning-bg);
}

tr.row-at-risk td:first-child {
    border-left: 3px solid var(--warning);
}

tr.row-off-track td {
    background: var(--danger-bg);
}

tr.row-off-track td:first-child {
    border-left: 3px solid var(--color-danger);
}

.required::after {
    content: ' *';
    color: var(--color-danger);
}

.error-list {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 95, 87, 0.25);
    margin-bottom: 1rem;
}

.error-list ul {
    margin: 0.25rem 0 0 1.2rem;
}

/* ISMS forms */
.isms-page-toolbar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.card.isms-form {
    padding: 1.5rem;
    background: var(--color-surface);
}

.isms-form-section {
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
}

.isms-form-section:last-of-type {
    margin-bottom: 0;
}

.isms-form h2,
.isms-form-section > h2,
.card.isms-form h2 {
    margin: 0 0 1rem;
    padding: 0.55rem 0.75rem;
    border: none;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--elevated);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

.isms-form .field {
    margin-bottom: 0;
    padding: 0.65rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
}

.isms-form > .field,
.isms-form > .grid-2,
.isms-form > .grid-3,
.isms-form-section > .field,
.isms-form-section > .grid-2,
.isms-form-section > .grid-3 {
    margin-bottom: 0.85rem;
}

.isms-form-section > .field:last-child,
.isms-form-section > .grid-2:last-child,
.isms-form-section > .grid-3:last-child,
.isms-form-section > .catalog-picker:last-child {
    margin-bottom: 0;
}

.isms-form .grid-2,
.isms-form .grid-3 {
    display: grid;
    gap: 0.85rem 1rem;
    align-items: start;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.isms-form .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.isms-form .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.isms-form .field > label,
.isms-form .catalog-picker > label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.35;
}

.isms-form .field input[type="text"],
.isms-form .field input[type="url"],
.isms-form .field input[type="time"],
.isms-form .field input.date-input,
.isms-form .field input.datetime-input,
.isms-form .field input.time-input,
.isms-form .field select,
.isms-form .field textarea,
.isms-form .catalog-picker input[type="text"],
.isms-form .catalog-picker select {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--elevated);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.isms-form .field textarea {
    min-height: 5.5rem;
    resize: vertical;
    line-height: 1.5;
}

.isms-form .field input:focus,
.isms-form .field select:focus,
.isms-form .field textarea:focus,
.isms-form .catalog-picker input:focus,
.isms-form .catalog-picker select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.isms-form .field input::placeholder,
.isms-form .field textarea::placeholder {
    color: var(--text-disabled);
}

.isms-form .date-input,
.isms-form .datetime-input {
    font-variant-numeric: tabular-nums;
}

.isms-form .datetime-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.isms-form .datetime-input-row .date-input {
    flex: 1 1 auto;
    min-width: 0;
}

.isms-form .datetime-input-row .time-input {
    flex: 0 0 7.5rem;
    width: 7.5rem;
    min-width: 7.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.isms-form .label-hint {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

.isms-form .catalog-picker {
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
}

.isms-form .form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.card > h2 {
    margin: 0 0 1rem;
    padding: 0.55rem 0.75rem;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--elevated);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.catalog-picker-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.catalog-picker-add select {
    flex: 1;
    min-width: 200px;
}

.catalog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.catalog-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.85rem;
    line-height: 1.3;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.catalog-chip--known {
    border-color: rgba(79, 140, 255, 0.35);
    background: var(--accent-bg);
    color: var(--link);
    cursor: help;
}

.catalog-chip--unknown {
    color: var(--color-text-muted);
}

.catalog-chip-remove {
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0 0.15rem;
    font-size: 1rem;
    line-height: 1;
}

.catalog-chip-remove:hover {
    opacity: 1;
}

.evidence-drop {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    background: var(--color-bg);
    transition: border-color 0.15s, background 0.15s;
}

.evidence-drop:hover,
.evidence-drop.dragover {
    border-color: var(--color-accent);
    background: var(--accent-bg);
}

.evidence-drop strong {
    display: block;
    margin-bottom: 0.25rem;
}

.evidence-drop input[type="file"] {
    display: none;
}

.evidence-preview {
    margin-top: 0.75rem;
}

.evidence-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--color-surface);
}

.evidence-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.evidence-thumb {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
}

.evidence-thumb a,
.evidence-thumb .image-lightbox-trigger {
    display: block;
    line-height: 0;
}

.evidence-thumb .image-lightbox-trigger {
    width: 100%;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    text-align: inherit;
}

.evidence-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.evidence-thumb a.file-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 1rem 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    background: var(--color-bg);
    line-height: 1.4;
}

.evidence-gallery .caption,
.evidence-thumb .caption {
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    word-break: break-word;
    line-height: 1.35;
}

.evidence-delete-form {
    margin-top: 0.35rem;
}

.btn-delete {
    border: none;
    background: var(--danger-bg);
    color: var(--danger);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    width: 100%;
}

.btn-delete:hover {
    background: rgba(255, 95, 87, 0.2);
}

@media (max-width: 900px) {
    .isms-form .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .isms-form .datetime-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .isms-form .datetime-input-row .time-input {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }

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

    .nav-isms-client {
        order: 4;
        width: 100%;
    }

    .navbar .client-selector {
        width: 100%;
    }

    .navbar .client-selector select {
        flex: 1;
        max-width: none;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .nav-brand {
        order: 1;
        flex: 1;
        min-width: 140px;
    }

    .nav-user {
        order: 2;
        width: 100%;
        justify-content: flex-start;
        gap: 0.5rem;
        opacity: 0.85;
    }

    .nav-date,
    .user-name {
        font-size: 0.78rem;
        color: var(--text-muted);
    }

    .nav-user .btn {
        padding: 0.25rem 0.55rem;
        font-size: 0.78rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-top: 0.25rem;
    }

    .nav-links a,
    .nav-dropdown-toggle {
        padding: 0.45rem 0.7rem;
        font-size: 0.88rem;
        white-space: nowrap;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .calendar-day {
        min-height: 90px;
    }

    .calendar-event-desc {
        display: none;
    }

    .modal-dialog {
        max-height: 95vh;
    }
}

/* ISMS record forms — aligned with employee report form */
.report-form.isms-record-form {
    margin-bottom: 1.5rem;
}

.isms-record-meta {
    margin-bottom: 1rem;
}

.isms-record-form.isms-form,
form.report-form.isms-record-form {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.isms-record-form .isms-form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.isms-record-form .isms-form-section:last-of-type {
    margin-bottom: 0;
}

.isms-record-form .isms-form-section > h2,
.isms-record-form.isms-form h2,
.isms-record-panel.card > h2 {
    margin: 0 0 1rem;
    padding: 0;
    border: none;
    border-left: none;
    border-radius: 0;
    background: transparent;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.isms-record-panel.card {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.isms-record-form .field,
.isms-record-form .catalog-picker {
    margin-bottom: 1rem;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.isms-record-form .isms-form-section > .field:last-child,
.isms-record-form .isms-form-section > .grid-2:last-child,
.isms-record-form .isms-form-section > .grid-3:last-child,
.isms-record-form .isms-form-section > .catalog-picker:last-child {
    margin-bottom: 0;
}

.isms-record-form .field > label,
.isms-record-form .catalog-picker > label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.35;
}

.isms-record-form .field input[type="text"],
.isms-record-form .field input[type="url"],
.isms-record-form .field input[type="time"],
.isms-record-form .field input.date-input,
.isms-record-form .field input.datetime-input,
.isms-record-form .field input.time-input,
.isms-record-form .field select,
.isms-record-form .field textarea,
.isms-record-form .catalog-picker input[type="text"],
.isms-record-form .catalog-picker select {
    width: 100%;
    max-width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--elevated);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.isms-record-form .field input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.isms-record-form .field textarea {
    min-height: 5.5rem;
    resize: vertical;
    line-height: 1.5;
}

.isms-record-form .field input:focus,
.isms-record-form .field select:focus,
.isms-record-form .field textarea:focus,
.isms-record-form .catalog-picker input:focus,
.isms-record-form .catalog-picker select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.isms-record-form .field input::placeholder,
.isms-record-form .field textarea::placeholder {
    color: var(--text-disabled);
}

.isms-record-form .grid-2,
.isms-record-form .grid-3 {
    display: grid;
    gap: 1rem;
    align-items: start;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.isms-record-form .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.isms-record-form .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.isms-record-form .datetime-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.isms-record-form .datetime-input-row .date-input {
    flex: 1 1 auto;
    min-width: 0;
}

.isms-record-form .datetime-input-row .time-input {
    flex: 0 0 7.5rem;
    width: 7.5rem;
    min-width: 7.5rem;
    font-variant-numeric: tabular-nums;
}

.isms-record-form .form-actions-bottom {
    margin-top: 1.5rem;
}

.isms-record-form .form-actions-bottom--start {
    justify-content: flex-start;
}

.isms-record-form .checkbox-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.isms-record-form .checkbox-label input {
    width: auto;
    margin-top: 0.2rem;
}

/* Date picker fields */
.date-field {
    position: relative;
    display: block;
}

.date-field .date-input {
    width: 100%;
    padding-right: 2.75rem;
}

.date-field-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
    margin: 0;
}

.date-field-trigger {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-left: 1px solid var(--border);
    border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
    background: var(--elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.date-field-trigger:hover,
.date-field-trigger:focus-visible {
    background: var(--hover);
    color: var(--accent);
    outline: none;
}

.date-picker-popup {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 120;
    width: min(100%, 18rem);
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-lg);
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.date-picker-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.date-picker-nav,
.date-picker-today {
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--elevated);
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.date-picker-nav {
    width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.date-picker-today {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
}

.date-picker-nav:hover,
.date-picker-today:hover,
.date-picker-nav:focus-visible,
.date-picker-today:focus-visible {
    background: var(--hover);
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
}

.date-picker-weekdays,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.2rem;
}

.date-picker-weekdays {
    margin-bottom: 0.35rem;
}

.date-picker-weekdays span {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.date-picker-day {
    min-height: 2rem;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.date-picker-day.is-empty {
    pointer-events: none;
}

.date-picker-day:hover,
.date-picker-day:focus-visible {
    background: var(--hover);
    outline: none;
}

.date-picker-day.is-today {
    border: 1px solid var(--accent);
}

.date-picker-day.is-selected {
    background: var(--accent);
    color: #fff;
}

.date-picker-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--divider);
}

@media (max-width: 900px) {
    .isms-record-form .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .isms-record-form .grid-2 {
        grid-template-columns: 1fr;
    }

    .isms-record-form .datetime-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .isms-record-form .datetime-input-row .time-input {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }
}

/* Dark theme — spacing & surface polish */
.stat-card,
.form-card,
.chart-card,
.report-card,
.report-detail,
.stat,
.login-card,
.empty-state,
.calendar-grid {
    border: 1px solid var(--border);
}

select option {
    background: var(--card);
    color: var(--text);
}

.footer {
    background: var(--surface);
}

.page-header {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dl-grid dt {
    font-weight: 500;
}

.table-scroll {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.badge[style*="background"] {
    color: #fff;
    border: none;
}

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

@media print {
    .navbar, .footer, .filter-form, .header-actions, .btn { display: none !important; }
    body { background: white; }
    .container { max-width: 100%; padding: 0; }
}
