/* ============================================================================
   Tätigkeitsnachweis - Stylesheet
   ============================================================================ */

/* CSS Variables */
:root {
    /* Colors */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #16a34a;
    --color-success-dark: #15803d;
    --color-danger: #dc2626;
    --color-danger-dark: #b91c1c;
    --color-warning: #f59e0b;
    --color-warning-dark: #d97706;
    --color-info: #0891b2;

    /* Status Colors */
    --status-draft: #6b7280;
    --status-submitted: #2563eb;
    --status-approved: #16a34a;
    --status-rejected: #dc2626;

    /* Role Colors */
    --role-employee: #8b5cf6;
    --role-employer: #f59e0b;
    --role-agency: #06b6d4;

    /* Neutrals */
    --color-bg: #f9fafb;
    --color-card: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-text-light: #6b7280;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* Borders */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* ============================================================================
   Reset & Base Styles
   ============================================================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   Typography
   ============================================================================ */

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

p {
    margin-bottom: var(--space-md);
}

/* ============================================================================
   Layout
   ============================================================================ */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* ============================================================================
   Navigation
   ============================================================================ */

.navbar {
    background-color: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md) 0;
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar-brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: #fff;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.user-name {
    font-weight: 600;
    color: var(--color-text);
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
    align-items: center;
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.nav-link:hover {
    color: var(--color-primary);
    background-color: #eff6ff;
}

.nav-link-active {
    color: var(--color-primary);
    background-color: #eff6ff;
}

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

.nav-link-logout:hover {
    color: var(--color-danger-dark);
}

/* ============================================================================
   Page Header
   ============================================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--color-border);
}

.page-subtitle {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: var(--space-sm);
}

.page-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

/* ============================================================================
   Alerts & Flash Messages
   ============================================================================ */

.alert {
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: var(--color-success-dark);
}

.alert-error,
.alert-danger {
    background-color: #fee2e2;
    color: var(--color-danger-dark);
}

/* ============================================================================
   Badges & Status
   ============================================================================ */

.badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-large {
    font-size: 0.875rem;
    padding: var(--space-sm) var(--space-lg);
}

/* Status Badges */
.badge-draft {
    background-color: #f3f4f6;
    color: var(--status-draft);
}

.badge-submitted {
    background-color: #dbeafe;
    color: var(--status-submitted);
}

.badge-approved {
    background-color: #d1fae5;
    color: var(--status-approved);
}

.badge-rejected {
    background-color: #fee2e2;
    color: var(--status-rejected);
}

/* Role Badges */
.badge-employee {
    background-color: #ede9fe;
    color: var(--role-employee);
}

.badge-employer {
    background-color: #fef3c7;
    color: var(--role-employer);
}

.badge-agency {
    background-color: #cffafe;
    color: var(--role-agency);
}

.badge-success {
    background-color: #d1fae5;
    color: var(--color-success-dark);
}

.badge-warning {
    background-color: #fef3c7;
    color: var(--color-warning-dark);
}

.badge-secondary {
    background-color: #f3f4f6;
    color: var(--color-text-light);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

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

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    background-color: var(--color-success-dark);
}

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

.btn-danger:hover {
    background-color: var(--color-danger-dark);
}

.btn-secondary {
    background-color: #f3f4f6;
    color: var(--color-text);
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-warning {
    background-color: var(--color-warning);
    color: white;
}

.btn-warning:hover {
    background-color: var(--color-warning-dark);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.75rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-edit {
    background-color: #f3f4f6;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-edit:hover {
    background-color: #e5e7eb;
}

.btn-delete {
    background-color: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.btn-delete:hover {
    background-color: #fee2e2;
}

/* ============================================================================
   Forms
   ============================================================================ */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-lg);
}

.form-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.create-week-form {
    display: flex;
    align-items: end;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.create-week-form label {
    font-weight: 600;
    margin-bottom: 0;
}

.create-week-form input[type="week"] {
    padding: 0.52rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-width: 170px;
}

/* ============================================================================
   Tables
   ============================================================================ */

.table-container {
    background-color: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-xl);
}

.table-container-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table,
.entries-table,
.timesheets-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.table th,
.entries-table th,
.timesheets-table th {
    background-color: #f9fafb;
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-light);
    border-bottom: 2px solid var(--color-border);
}

.table td,
.entries-table td,
.timesheets-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.table tbody tr:hover,
.entries-table tbody tr:hover,
.timesheets-table tbody tr:hover {
    background-color: #f9fafb;
}

.table a:not(.btn),
.entries-table a:not(.btn),
.timesheets-table a:not(.btn) {
    color: var(--color-primary);
    font-weight: 500;
}

.table a:not(.btn):hover,
.entries-table a:not(.btn):hover,
.timesheets-table a:not(.btn):hover {
    color: var(--color-primary-dark);
}

.work-minutes {
    font-weight: 600;
    color: var(--color-primary);
}

.entry-remark {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-name,
.employer-name {
    font-weight: 600;
}

.empty-table {
    text-align: center;
    color: var(--color-text-light);
    padding: var(--space-2xl) !important;
}

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

.actions {
    white-space: nowrap;
}

.row-inactive {
    opacity: 0.7;
    background-color: #f8fafc;
}

/* Agency Admin Table UX */
.page-header-admin {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top right, #eff6ff 0%, #ffffff 48%);
    border: 1px solid #dce8fb;
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.06);
    padding: clamp(1rem, 2.2vw, 1.5rem);
    margin-bottom: 1.25rem;
}

.page-header-admin::after {
    content: "";
    position: absolute;
    right: -2.5rem;
    top: -2.5rem;
    width: 9rem;
    height: 9rem;
    background: radial-gradient(circle at center, rgb(59 130 246 / 0.16) 0%, rgb(59 130 246 / 0) 70%);
    pointer-events: none;
}

.page-header-admin h1 {
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.page-header-admin .page-subtitle {
    margin-bottom: 0;
    max-width: 52rem;
}

.page-header-admin .page-actions {
    position: relative;
    z-index: 1;
}

.table-admin {
    border-collapse: separate;
    border-spacing: 0 0.55rem;
}

.table-admin th {
    white-space: nowrap;
}

.table-admin td {
    vertical-align: middle;
}

.table-admin-employees {
    min-width: 980px;
}

.table-admin-employers {
    min-width: 1020px;
}

.table-admin-assignments {
    min-width: 960px;
}

.admin-table-shell {
    background: linear-gradient(180deg, #fcfdff 0%, #f8fbff 100%);
    border: 1px solid #dce6f8;
    border-radius: 1rem;
    box-shadow: 0 8px 22px rgb(15 23 42 / 0.05);
    margin-bottom: var(--space-xl);
    overflow: hidden;
}

.admin-table-shell .table-container-scroll {
    padding: 0 0.85rem 0.85rem;
}

.table-admin thead th {
    background-color: transparent;
    border: none;
    color: #334155;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.95rem 0.35rem;
}

.table-admin tbody tr {
    transition: transform 0.15s ease;
}

.table-admin tbody td {
    background-color: #fff;
    border-top: 1px solid #e2eaf8;
    border-bottom: 1px solid #e2eaf8;
    padding: 0.85rem 0.95rem;
}

.table-admin tbody td:first-child {
    border-left: 1px solid #e2eaf8;
    border-top-left-radius: 0.75rem;
    border-bottom-left-radius: 0.75rem;
}

.table-admin tbody td:last-child {
    border-right: 1px solid #e2eaf8;
    border-top-right-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.table-admin tbody tr:hover {
    transform: translateY(-1px);
}

.table-admin tbody tr:hover td {
    background-color: #f8fbff;
    border-color: #d4e2fb;
}

.table-admin tbody tr.row-inactive {
    opacity: 1;
}

.table-admin tbody tr.row-inactive td {
    background-color: #f8fafd;
    border-color: #e6edf9;
}

.table-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 1rem 1.2rem 0.8rem;
    border-bottom: 1px solid #e4ebf8;
    background: linear-gradient(180deg, #fdfdff 0%, #f6f9ff 100%);
}

.table-title {
    margin: 0;
    font-size: 1.06rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.table-subtitle {
    margin: 0;
    color: var(--color-text-light);
    font-size: 0.84rem;
}

.table-meta-note {
    margin: 0.3rem 0 0;
    color: #64748b;
    font-size: 0.76rem;
}

.table-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.34rem 0.72rem;
    border-radius: 999px;
    border: 1px solid #b8d4ff;
    background-color: #e4efff;
    color: #1e3a8a;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.person-cell {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.person-cell-main {
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}

.person-cell-sub {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.entity-id {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    background-color: #f1f5f9;
    color: #475569;
    font-size: 0.6875rem;
    line-height: 1;
    padding: 0.28rem 0.48rem;
    font-weight: 600;
}

.entity-meta-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.entity-meta-item {
    font-size: 0.8125rem;
}

.table-admin .meta-stack {
    display: grid;
    gap: 0.2rem;
}

.table-admin .meta-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.table-admin .meta-value {
    font-size: 0.875rem;
    color: #0f172a;
    text-decoration: none;
    line-height: 1.35;
    word-break: break-word;
}

.table-admin a.meta-value:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.actions-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    justify-content: flex-end;
    align-items: center;
}

.actions-cell-admin {
    min-width: 13rem;
}

.actions-cell-admin .btn-sm {
    border-radius: 0.58rem;
    padding: 0.34rem 0.63rem;
    font-weight: 600;
}

.actions-cell-admin .end-date-form {
    justify-content: flex-end;
}

.date-range {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.table-admin .date-stack {
    display: grid;
    gap: 0.16rem;
}

.url-cell {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.url-cell:hover {
    text-decoration: underline;
}

.info-text-compact {
    margin-bottom: var(--space-lg);
    font-size: 0.875rem;
    max-width: 980px;
}

.assignment-date-field {
    min-width: 8.9rem;
}

.admin-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: var(--space-lg);
}

.admin-overview-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dce6f8;
    border-radius: 0.8rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 4px 12px rgb(15 23 42 / 0.05);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "label value"
        "hint value";
    gap: 0.2rem 0.7rem;
    align-items: center;
}

.admin-overview-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa 0%, #93c5fd 100%);
}

.admin-overview-label {
    grid-area: label;
    margin: 0;
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.admin-overview-value {
    grid-area: value;
    justify-self: end;
    margin: 0.3rem 0 0.15rem;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
    color: #1d4ed8;
}

.admin-overview-hint {
    grid-area: hint;
    margin: 0;
    color: #64748b;
    font-size: 0.73rem;
}

/* ============================================================================
   Agency Editor Forms
   ============================================================================ */

.editor-page-header {
    margin-bottom: var(--space-md);
}

.editor-info-box {
    margin-bottom: var(--space-lg);
}

.editor-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: var(--space-lg);
}

.editor-meta-card {
    background: linear-gradient(155deg, #ffffff 0%, #f6f9ff 100%);
    border: 1px solid #dde6f5;
    border-radius: 0.75rem;
    padding: 0.7rem 0.85rem;
    box-shadow: 0 4px 10px rgb(15 23 42 / 0.04);
}

.editor-meta-label {
    margin: 0;
    color: #64748b;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.editor-meta-value {
    margin: 0.3rem 0 0;
    color: #1e293b;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.2;
}

.editor-shell {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dce6f6;
    border-radius: 1rem;
    box-shadow: 0 10px 26px rgb(15 23 42 / 0.06);
    margin-bottom: var(--space-xl);
}

.editor-form {
    padding: 1.15rem 1.2rem 1.3rem;
}

.editor-section + .editor-section {
    margin-top: 1.05rem;
    padding-top: 1rem;
    border-top: 1px solid #e5ecf8;
}

.editor-section-head {
    margin-bottom: 0.75rem;
}

.editor-section-title {
    margin: 0;
    font-size: 1rem;
    letter-spacing: -0.01em;
    color: #0f172a;
}

.editor-section-note {
    margin: 0.25rem 0 0;
    font-size: 0.81rem;
    color: #64748b;
}

.editor-grid {
    display: grid;
    gap: 0.85rem 0.95rem;
}

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

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

.editor-field-full {
    grid-column: 1 / -1;
}

.editor-field-compact {
    max-width: 23rem;
}

.editor-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.83rem;
    font-weight: 700;
    color: #1e293b;
}

.editor-required {
    color: #dc2626;
}

.editor-form .form-control {
    width: 100%;
    padding: 0.58rem 0.74rem;
    border: 1px solid #d2ddee;
    border-radius: 0.6rem;
    background-color: #fff;
    font-size: 0.9rem;
    line-height: 1.35;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.editor-form .form-control:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15);
}

.editor-textarea {
    min-height: 88px;
    resize: vertical;
}

.editor-help {
    margin-top: 0.36rem;
    margin-bottom: 0;
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.35;
}

.editor-input-with-suffix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-input-with-suffix .form-control {
    flex: 1;
}

.editor-input-suffix {
    white-space: nowrap;
    color: #475569;
    font-size: 0.86rem;
    font-weight: 600;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.3rem;
    padding-top: 1rem;
    border-top: 1px solid #e5ecf8;
}

/* ============================================================================
   Cards & Grids
   ============================================================================ */

.timesheets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.timesheet-card {
    background-color: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.timesheet-card:hover {
    box-shadow: var(--shadow-md);
}

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

.timesheet-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.timesheet-card-body {
    padding: var(--space-lg);
}

.timesheet-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.meta-label {
    color: var(--color-text-light);
}

.meta-value {
    font-weight: 500;
}

.rejection-reason {
    color: var(--color-danger);
    font-style: italic;
}

.timesheet-card-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.summary-card {
    background-color: var(--color-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.summary-label {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.summary-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-primary);
}

.summary-subvalue {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* ============================================================================
   Login Page
   ============================================================================ */

.login-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--color-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-title {
    text-align: center;
    margin-bottom: var(--space-sm);
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
}

.login-form {
    margin-bottom: var(--space-xl);
}

.login-footer {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-lg);
}

.default-accounts summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--color-warning-dark);
    padding: var(--space-md);
    background-color: #fef3c7;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.default-accounts[open] summary {
    margin-bottom: var(--space-lg);
}

.accounts-table {
    width: 100%;
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
}

.accounts-table th {
    text-align: left;
    padding: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.accounts-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.warning-text {
    font-size: 0.75rem;
    color: var(--color-danger);
    line-height: 1.4;
}

/* ============================================================================
   Entry Form
   ============================================================================ */

.entry-form-container {
    background-color: var(--color-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-xl);
}

.entry-form {
    /* Inherits form styles from above */
}

/* ============================================================================
   Modals
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-text-light);
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: var(--space-xl);
}

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

/* ============================================================================
   Filter Bar
   ============================================================================ */

.filter-bar {
    background-color: var(--color-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
}

.filter-form {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    white-space: nowrap;
}

.filter-select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    cursor: pointer;
    min-height: 2.25rem;
    background-color: #fff;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.filter-results {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
}

/* ============================================================================
   Timeline (Agency View)
   ============================================================================ */

.status-timeline {
    background-color: var(--color-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-xl);
}

.timeline-item {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md) 0;
    border-left: 2px solid var(--color-border);
    padding-left: var(--space-xl);
    position: relative;
}

.timeline-item:last-child {
    border-left: none;
}

.timeline-icon {
    position: absolute;
    left: -0.875rem;
    width: 1.75rem;
    height: 1.75rem;
    background-color: var(--color-card);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.timeline-success .timeline-icon {
    background-color: #d1fae5;
    border-color: var(--status-approved);
}

.timeline-error .timeline-icon {
    background-color: #fee2e2;
    border-color: var(--status-rejected);
}

.timeline-title {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.timeline-date {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.timeline-reason {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background-color: #fee2e2;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--color-danger-dark);
}

/* ============================================================================
   Audit Log (Agency View)
   ============================================================================ */

.audit-section {
    background-color: var(--color-card);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.audit-log {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.audit-entry {
    padding: var(--space-md);
    background-color: #f9fafb;
    border-radius: var(--radius-md);
}

.audit-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.audit-action {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--color-primary);
}

.audit-date {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.audit-actor {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* ============================================================================
   Empty States
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--color-text-light);
    background-color: var(--color-card);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    max-width: 760px;
    margin: 0 auto var(--space-xl);
}

.empty-state p:last-child {
    margin-bottom: 0;
}

.empty-state .btn {
    margin-top: var(--space-md);
}

.info-text {
    background-color: #e7f3ff;
    border-left: 4px solid var(--color-info);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-xl);
    border-radius: var(--radius-sm);
}

.end-date-form {
    display: inline-flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.form-control {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: #fff;
    color: var(--color-text);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.form-control-sm {
    padding: 0.38rem 0.6rem;
    font-size: 0.875rem;
}

/* ============================================================================
   Employee Support Contact Overlay
   ============================================================================ */

.support-contact-overlay {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 950;
}

.support-contact-overlay > summary {
    list-style: none;
}

.support-contact-overlay > summary::-webkit-details-marker {
    display: none;
}

.support-contact-trigger {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: 2px solid #dbeafe;
    background: #fff;
    box-shadow: 0 8px 20px rgb(2 6 23 / 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.support-contact-trigger:focus-visible {
    outline: 3px solid rgb(37 99 235 / 0.3);
    outline-offset: 2px;
}

.support-contact-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
}

.support-contact-fallback {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e3a8a;
    font-size: 1.4rem;
    font-weight: 700;
}

.support-contact-card {
    display: none;
    position: absolute;
    right: 0;
    bottom: 3.6rem;
    width: min(320px, calc(100vw - 2rem));
    padding: 0.9rem 1rem;
    border-radius: 0.8rem;
    border: 1px solid #dbeafe;
    background: #fff;
    box-shadow: 0 12px 28px rgb(2 6 23 / 0.2);
}

.support-contact-overlay[open] .support-contact-card {
    display: block;
}

.support-contact-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e3a8a;
}

.support-contact-subtitle {
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: #64748b;
}

.support-contact-details {
    margin-top: 0.55rem;
    display: grid;
    gap: 0.3rem;
    font-size: 0.86rem;
    color: #0f172a;
}

.support-contact-name {
    font-weight: 700;
    color: #0f172a;
}

.support-contact-details a {
    color: var(--color-primary);
    text-decoration: none;
}

.support-contact-details a:hover {
    text-decoration: underline;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.text-warning {
    color: var(--color-warning);
}

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

.text-success {
    color: var(--color-success);
}

.text-muted {
    color: var(--color-text-light);
}

.inline-form {
    display: inline-block;
}

.modal-hidden {
    display: none;
}

.field-hidden {
    display: none;
}

.entry-type-placeholder {
    text-align: center;
    font-style: italic;
    color: var(--color-text-light);
}

.pre-line-text {
    white-space: pre-line;
}

/* ============================================================================
   Footer
   ============================================================================ */

.footer {
    background-color: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: var(--space-xl) 0;
    margin-top: auto;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.footer-legal-links {
    margin-top: var(--space-sm);
}

.footer-legal-links a {
    color: var(--color-text-light);
    text-decoration: none;
}

.footer-legal-links a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ============================================================================
   Legal Pages
   ============================================================================ */

.legal-page {
    max-width: 860px;
    margin: 0 auto;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.legal-page ul {
    margin-left: 1.25rem;
    margin-bottom: var(--space-lg);
}

/* ============================================================================
   Autocomplete Component
   ============================================================================ */

.autocomplete-wrapper {
    position: relative;
    display: inline-block;
    min-width: 200px;
}

.autocomplete-control {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-card);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.autocomplete-control:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.autocomplete-input {
    flex: 1;
    min-width: 0;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    font-size: 0.875rem;
}

.autocomplete-input:focus {
    outline: none;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.autocomplete-item {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: background-color 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f3f4f6;
}

.autocomplete-item.selected {
    background-color: var(--color-primary);
    color: white;
}

.autocomplete-empty {
    padding: var(--space-md);
    color: var(--color-text-light);
    text-align: center;
    font-style: italic;
}

.autocomplete-clear {
    border: none;
    border-left: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.autocomplete-clear:hover {
    background-color: #f3f4f6;
    color: var(--color-danger);
}

.autocomplete-clear:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* Filter Input consistent with Filter Select */
.filter-input {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1180px) {
    .admin-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .editor-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .editor-field-compact {
        max-width: none;
    }

    .table-admin {
        min-width: 0;
        border-spacing: 0;
    }

    .table-admin thead {
        display: none;
    }

    .table-admin,
    .table-admin tbody,
    .table-admin tr,
    .table-admin td {
        display: block;
        width: 100%;
    }

    .admin-table-shell .table-container-scroll {
        padding: 0 0.75rem 0.75rem;
        overflow: visible;
    }

    .table-admin tbody tr {
        margin-bottom: var(--space-md);
        border: 1px solid #dde6f6;
        border-radius: 0.9rem;
        background-color: #fff;
        box-shadow: 0 4px 12px rgb(15 23 42 / 0.05);
        overflow: hidden;
    }

    .table-admin tbody td {
        border: none;
        border-top: 1px solid #eef2fb;
        border-radius: 0;
        background: transparent;
        padding: 0.68rem 0.82rem;
        display: grid;
        grid-template-columns: minmax(108px, 36%) 1fr;
        gap: var(--space-sm);
        align-items: start;
    }

    .table-admin tbody td:first-child {
        border-top: none;
        border-left: none;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    .table-admin tbody td:last-child {
        border-right: none;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

    .table-admin tbody td::before {
        content: attr(data-label);
        font-size: 0.68rem;
        line-height: 1.2;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 700;
        padding-top: 0.2rem;
    }

    .table-admin tbody tr:hover {
        transform: none;
    }

    .table-admin tbody tr:hover td {
        background-color: transparent;
        border-color: transparent;
    }

    .table-admin tbody tr.row-inactive td {
        background-color: transparent;
    }

    .table-admin .actions-cell-admin {
        min-width: 0;
    }

    .table-admin .actions-cell-admin .actions-wrap,
    .table-admin .actions-cell-admin .end-date-form {
        justify-content: flex-start;
    }

    .table-admin .assignment-date-field {
        min-width: 0;
        width: 100%;
    }

    .table-admin .end-date-form {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .editor-meta-grid {
        grid-template-columns: 1fr;
    }

    .editor-grid-two,
    .editor-grid-three {
        grid-template-columns: 1fr;
    }

    .editor-field-full {
        grid-column: auto;
    }

    .editor-form {
        padding: 0.95rem 0.9rem 1rem;
    }

    .editor-actions .btn {
        width: 100%;
    }

    .admin-overview-grid {
        grid-template-columns: 1fr;
    }

    .admin-overview-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "label"
            "value"
            "hint";
        gap: 0.28rem;
    }

    .admin-overview-value {
        justify-self: start;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: var(--space-md);
        align-items: stretch;
    }

    .navbar-brand {
        justify-content: center;
    }

    .navbar-menu {
        width: 100%;
        flex-direction: column;
        gap: var(--space-md);
    }

    .navbar-user {
        justify-content: center;
        flex-wrap: wrap;
    }

    .navbar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: var(--space-sm);
    }

    .nav-link {
        display: block;
        text-align: center;
        padding: var(--space-sm) var(--space-md);
        border: 1px solid var(--color-border);
        background-color: #fff;
    }

    .page-header {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .page-header-admin {
        padding: var(--space-md);
    }

    .table-title-row {
        padding: 0.95rem 1rem 0.75rem;
    }

    .table-meta-note {
        font-size: 0.73rem;
    }

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

    .page-actions .btn,
    .page-actions .inline-form {
        width: 100%;
    }

    .page-actions .inline-form .btn {
        width: 100%;
    }

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

    .create-week-form {
        width: 100%;
    }

    .create-week-form input[type="week"] {
        width: 100%;
    }

    .create-week-form .btn {
        width: 100%;
    }

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

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

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

    .table-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-chip {
        align-self: flex-start;
    }

    .actions-wrap {
        justify-content: flex-start;
    }

    .table-admin .actions-cell {
        text-align: left;
    }

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

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select,
    .filter-input {
        width: 100%;
    }

    .autocomplete-wrapper {
        width: 100%;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-group {
        flex-direction: column;
        align-items: stretch;
    }

    .table,
    .entries-table,
    .timesheets-table {
        min-width: 680px;
    }

    .table-admin {
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .navbar-nav {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .admin-overview-grid {
        grid-template-columns: 1fr;
    }

    .support-contact-overlay {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .support-contact-trigger {
        width: 2.75rem;
        height: 2.75rem;
    }

    .support-contact-card {
        width: min(300px, calc(100vw - 1.5rem));
        bottom: 3.25rem;
    }
}

/* ============================================================================
   PDF Export Section
   ============================================================================ */

.export-section {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.export-header {
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.export-header strong {
    font-size: 1rem;
    color: var(--color-text);
}

.export-hint {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.export-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.export-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
}

.export-select {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: white;
    min-width: 160px;
}

.export-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.btn-export {
    white-space: nowrap;
}
