/* =============================================
   DSpace – Global Styles
   ============================================= */

:root {
    --brand:        #0f6cbd;
    --brand-dark:   #0c56a8;
    --brand-bg:     #eff6ff;
    --text-1:       #111827;
    --text-2:       #6b7280;
    --text-3:       #9ca3af;
    --border:       #e5e7eb;
    --bg-page:      #f3f4f6;
    --bg-card:      #ffffff;
    --nav-width:    240px;
    --header-h:     52px;
    --footer-h:     44px;
    --radius-sm:    6px;
    --radius:       10px;
    --radius-lg:    14px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:    0 4px 16px rgba(0,0,0,.1);
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-1);
    font-size: 15px;
    line-height: 1.5;
}

/* =============================================
   App Shell
   ============================================= */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.app-header {
    height: var(--header-h);
    background: var(--brand);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
    flex-shrink: 0;
    z-index: 100;
}

.brand-link {
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.brand-name {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
}

/* =============================================
   Hamburger
   ============================================= */

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.hamburger:hover {
    background: rgba(255,255,255,0.15);
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.header-spacer { flex: 1; }

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

.header-user-name {
    color: rgba(255,255,255,0.9);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255,255,255,0.4);
    transition: color 0.15s, border-color 0.15s;
}

.header-user-name:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.8);
}

.header-action {
    padding: 0.3125rem 0.875rem;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.8);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}

.header-action:hover {
    color: #fff;
}

.header-logout {
    padding: 0.3125rem 0.875rem;
    border: 1.5px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.header-logout:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.7);
}

/* =============================================
   Body: Sidebar + Content
   ============================================= */

.app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* =============================================
   Sidebar
   ============================================= */

.app-sidebar {
    width: var(--nav-width);
    min-width: var(--nav-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
    transition: width 0.22s ease, min-width 0.22s ease;
}

.app-sidebar.collapsed {
    width: 56px;
    min-width: 56px;
}

.app-sidebar.collapsed .nav-label {
    display: none;
}

.app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.5625rem 0;
    margin: 0.125rem 0.5rem;
}

.app-sidebar.collapsed .nav-section-label,
.app-sidebar.collapsed .nav-divider {
    visibility: hidden;
}

.nav-section-label {
    padding: 1.25rem 1.25rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6875rem;
    padding: 0.5625rem 1.25rem;
    margin: 0.125rem 0.625rem;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
    border: none;
    background: transparent;
    width: calc(100% - 1.25rem);
}

.nav-item:hover {
    background: var(--bg-page);
    color: var(--text-1);
}

.nav-item.active {
    background: var(--brand-bg);
    color: var(--brand);
    font-weight: 600;
}

.nav-item fluent-icon,
.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active fluent-icon,
.nav-item.active svg {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 1.25rem;
}

/* =============================================
   Main Content
   ============================================= */

.app-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-page);
    min-width: 0;
}

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

.app-footer {
    height: var(--footer-h);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-shrink: 0;
    color: var(--text-3);
    font-size: 0.8rem;
}

.app-footer-version {
    opacity: 0.6;
    font-size: 0.72rem;
    font-family: monospace;
}

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

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

.page-title {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
    outline: none;
}

.page-subtitle {
    margin: 0;
    color: var(--text-2);
    font-size: 0.9rem;
}

/* =============================================
   Stat Cards
   ============================================= */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.375rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.stat-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    color: var(--brand);
    font-size: 1.125rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1;
}

.stat-note {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-top: 0.125rem;
}

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

.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, #1a7cd4 0%, #0a58a3 45%, #06357a 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 2.75rem 2.5rem;
    box-shadow: 0 24px 64px rgba(0,0,0,.32);
}

.login-brand {
    text-align: center;
    margin-bottom: 2.25rem;
}

.login-logo {
    width: 58px;
    height: 58px;
    background: linear-gradient(140deg, #1e8ae0, #0856a0);
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.625rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(15,108,189,.4);
}

.login-title {
    margin: 0 0 0.3rem;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-1);
}

.login-subtitle {
    margin: 0;
    color: var(--text-2);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-1);
}

.form-input {
    padding: 0.6875rem 0.9375rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    color: var(--text-1);
    background: #fafbfc;
    width: 100%;
}

.form-input::placeholder { color: #b0b8c1; }

.form-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15,108,189,.15);
    background: #fff;
}

.login-btn {
    margin-top: 0.375rem;
    padding: 0.8125rem;
    background: linear-gradient(135deg, #1a7cd4, #0856a0);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity .15s, transform .1s, box-shadow .15s;
    width: 100%;
    box-shadow: 0 4px 14px rgba(15,108,189,.35);
    letter-spacing: .01em;
}

.login-btn:hover { opacity: .92; box-shadow: 0 6px 20px rgba(15,108,189,.45); }
.login-btn:active { transform: translateY(1px); }

.login-error {
    padding: .625rem .875rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* =============================================
   Blazor error UI
   ============================================= */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    padding: .875rem 1.25rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #b91c1c;
    font-size: .875rem;
    z-index: 9999;
    box-shadow: var(--shadow-md);
    max-width: 340px;
}
#blazor-error-ui .reload { color: #b91c1c; font-weight: 600; margin-left: .25rem; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; margin-left: 1rem; opacity: .6; }

/* =============================================
   Toolbar & Search
   ============================================= */

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.search-wrap { flex: 1; max-width: 360px; }

.search-input {
    width: 100%;
    padding: 0.5625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-1);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15,108,189,.12);
}

.btn-primary {
    padding: 0.5625rem 1.125rem;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}

.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
    padding: 0.5625rem 1.125rem;
    background: transparent;
    color: var(--text-1);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}

.btn-secondary:hover { background: var(--bg-page); }

/* =============================================
   Data Table
   ============================================= */

.table-wrap {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-2);
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 0.8125rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafbfc; }
.data-table tbody tr.row-inactive td { opacity: 0.55; }

.col-name { font-weight: 600; }
.col-email { color: var(--text-2); }
.col-actions { width: 90px; text-align: right; }

.table-empty {
    padding: 3rem;
    text-align: center;
    color: var(--text-3);
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* =============================================
   Badges
   ============================================= */

.badge {
    display: inline-block;
    padding: 0.1875rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.25rem;
}

.badge-admin    { background: #ede9fe; color: #6d28d9; }
.badge-hr       { background: #fef3c7; color: #b45309; }
.badge-pm       { background: #ede9fe; color: #5b21b6; }
.badge-employee { background: var(--brand-bg); color: var(--brand); }
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: var(--text-2); }

/* =============================================
   Action buttons in table
   ============================================= */

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    color: var(--text-2);
    transition: background .12s, color .12s;
    margin-left: 2px;
}

.action-btn:hover { background: var(--bg-page); color: var(--text-1); }
.action-deactivate:hover { background: #fef2f2; color: #b91c1c; }
.action-activate:hover   { background: #d1fae5; color: #065f46; }

/* =============================================
   Side Panel
   ============================================= */

.panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 200;
    animation: fadeIn .18s ease;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100%;
    background: var(--bg-card);
    box-shadow: -4px 0 32px rgba(0,0,0,.14);
    z-index: 201;
    display: flex;
    flex-direction: column;
    animation: slideIn .22s ease;
}

@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideIn { from { transform: translateX(100%) } to { transform: translateX(0) } }

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

.panel-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-1);
}

.panel-close {
    background: transparent;
    border: none;
    font-size: 1rem;
    color: var(--text-2);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background .12s;
}

.panel-close:hover { background: var(--bg-page); color: var(--text-1); }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.role-checks {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.role-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-1);
    cursor: pointer;
}

.role-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
}

.alert-error {
    padding: .625rem .875rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: .875rem;
}

.alert-success {
    padding: .625rem .875rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #15803d;
    font-size: .875rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-1);
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding-top: .25rem;
}

/* =============================================
   Dashboard charts
   ============================================= */

.view-toggle {
    display: flex;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.vt-btn {
    padding: 0.4375rem 1rem;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-2);
    transition: background .12s, color .12s;
}

.vt-btn + .vt-btn { border-left: 1.5px solid var(--border); }
.vt-btn:hover  { background: var(--bg-page); color: var(--text-1); }
.vt-active     { background: var(--brand) !important; color: #fff !important; }

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.chart-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 1.25rem;
}

/* Horizontal bar chart */
.hbar-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hbar-row {
    display: grid;
    grid-template-columns: 200px 1fr 100px;
    align-items: center;
    gap: 0.75rem;
}

.hbar-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.hbar-track {
    height: 22px;
    background: var(--bg-page);
    border-radius: 4px;
    overflow: hidden;
}

.hbar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
    min-width: 4px;
}

.hbar-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hbar-hours {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-1);
    min-width: 48px;
}

.hbar-pct {
    font-size: 0.75rem;
    color: var(--text-3);
    font-weight: 600;
}

.hbar-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.hbar-footer-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hbar-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-2);
    padding: 0.2rem 0.625rem;
    border-radius: 20px;
    background: var(--bg-page);
    border: 1px solid var(--border);
}

.hbar-legend-chip::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chip-color);
    flex-shrink: 0;
}

/* Monthly bar chart (vertical) */
.month-bar-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.375rem;
    height: 160px;
    align-items: end;
}

.month-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.month-bar-wrap {
    flex: 1;
    width: 100%;
    background: var(--bg-page);
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.month-bar-fill {
    width: 100%;
    background: var(--brand);
    border-radius: 4px 4px 0 0;
    transition: height .4s ease;
    min-height: 0;
}

.month-bar-current { background: #10b981; }

.month-bar-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-3);
    white-space: nowrap;
}

.month-bar-value {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-2);
}

/* =============================================
   Timesheet
   ============================================= */

.ts-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ts-month-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-nav-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-1);
    transition: background .12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-nav-btn:hover:not(:disabled) { background: var(--bg-page); }
.ts-nav-btn:disabled { opacity: .35; cursor: not-allowed; }

.ts-month-label {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-1);
    min-width: 180px;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: capitalize;
}

.ts-archive-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #fef9c3;
    color: #854d0e;
    padding: 0.125rem 0.5rem;
    border-radius: 20px;
}

.ts-user-select {
    max-width: 240px;
    margin-left: auto;
}

/* Summary */
.ts-summary {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.ts-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.ts-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1;
}

.ts-summary-label {
    font-size: 0.75rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

.ts-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ts-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-page);
    border-radius: 4px;
    overflow: hidden;
}

.ts-progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 4px;
    transition: width .4s ease;
}

.ts-progress-pct {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    min-width: 36px;
    text-align: right;
}

/* Day list */
.ts-day-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ts-day-row {
    display: grid;
    grid-template-columns: 64px 1fr 56px 40px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    min-height: 48px;
    transition: background .1s;
}

.ts-day-row:last-child { border-bottom: none; }
.ts-day-row:hover:not(.ts-day-weekend) { background: #fafbfc; }

.ts-day-weekend {
    background: var(--bg-page);
    opacity: .55;
}

.ts-day-today {
    background: var(--brand-bg);
}

.ts-day-today .ts-day-num {
    color: var(--brand);
    font-weight: 800;
}

.ts-day-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.ts-day-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1;
}

.ts-day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-3);
    font-weight: 600;
}

.ts-day-entries {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    padding: 0.25rem 0;
}

.ts-day-empty {
    color: var(--text-3);
    font-size: 0.85rem;
}

.ts-entry-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: var(--brand-bg);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    color: var(--text-1);
}

.ts-entry-chip:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.ts-entry-jira {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    color: #fff;
    background: #6d28d9;
    border-radius: 4px;
    padding: 0 4px;
    white-space: nowrap;
}

.ts-entry-project {
    font-weight: 600;
    color: var(--brand-dark);
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-entry-hours {
    font-weight: 700;
    color: var(--brand);
    white-space: nowrap;
}

.ts-day-total {
    text-align: right;
    font-size: 0.875rem;
    font-weight: 700;
}

.ts-hours-full    { color: #065f46; }
.ts-hours-partial { color: #92400e; }

.ts-day-action { text-align: right; }

.ts-add-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    font-size: 1rem;
    line-height: 1;
    color: var(--text-2);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ts-add-btn:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Hours input + presets */
.ts-hours-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ts-hours-input {
    max-width: 120px;
}

.ts-hours-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.ts-preset-btn {
    padding: 0.25rem 0.625rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-2);
    transition: background .12s, color .12s, border-color .12s;
}

.ts-preset-btn:hover,
.ts-preset-btn.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Panel subtitle */
.panel-subtitle {
    font-size: 0.8125rem;
    color: var(--text-2);
    margin-top: 2px;
    text-transform: capitalize;
}

/* Danger button */
.btn-danger {
    padding: 0.5625rem 1.125rem;
    background: transparent;
    color: #b91c1c;
    border: 1.5px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}

.btn-danger:hover { background: #fef2f2; }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; }

.project-desc {
    font-size: 0.8rem;
    color: var(--text-2);
    margin: 2px 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.col-period  { font-size: 0.8rem; color: var(--text-2); white-space: nowrap; }
.col-budget  { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.badge-billing-tm  { background: #e0f2fe; color: #0369a1; }
.badge-billing-fp  { background: #fef9c3; color: #854d0e; }
.badge-billing-ret { background: #f3e8ff; color: #7e22ce; }
.badge-billing-ms  { background: #fce7f3; color: #9d174d; }

.side-panel-wide  { width: 540px; }
.side-panel-xl    { width: min(820px, 92vw); }

.form-textarea {
    resize: vertical;
    min-height: 72px;
    font-family: inherit;
}

/* =============================================
   Import Wizard
   ============================================= */

.wizard-steps {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ws-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-3);
}

.ws-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-3);
}

.ws-active .ws-num  { border-color: var(--brand); background: var(--brand); color: #fff; }
.ws-active .ws-label { color: var(--text-1); }
.ws-done .ws-num    { border-color: #16a34a; background: #16a34a; color: #fff; }
.ws-done .ws-label  { color: var(--text-2); }

.wizard-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 0.75rem;
}

.wizard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 860px;
}

.wizard-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* File drop zone */
.file-drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--bg-page);
}

.file-drop-zone input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--brand);
    background: var(--brand-bg);
}

.file-drop-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-2);
    font-size: 0.9rem;
    pointer-events: none;
}

.file-drop-hint small { color: var(--text-3); font-size: 0.75rem; }

.import-format-hint {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-2);
    font-family: 'Cascadia Code', 'Consolas', monospace;
}

/* Customer mapping */
.import-info {
    color: var(--text-2);
    font-size: 0.9rem;
    margin: 0;
}

.customer-map-row {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1rem;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.cm-raw-name { min-width: 160px; padding-top: 2px; }
.cm-choice   { display: flex; flex-direction: column; gap: 0.5rem; min-width: 200px; }
.cm-select   { max-width: 280px; }

.cm-new-fields {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Summary stats */
.import-summary-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.import-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 100px;
}

.import-stat-val {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1;
}

.import-stat-lbl {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-2);
}

.import-stat-ok .import-stat-val { color: #16a34a; }
.import-stat-err .import-stat-val { color: #b91c1c; }

.import-notice {
    padding: 0.75rem 1rem;
    background: var(--brand-bg);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--brand-dark);
}

/* Result */
.import-result-icon {
    text-align: center;
    padding: 1rem 0;
}

.import-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    padding: 1rem;
    border-radius: var(--radius-sm);
}

.result-ok   { background: #d1fae5; color: #065f46; }
.result-warn { background: #fef9c3; color: #854d0e; }

.code-chip {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    letter-spacing: 0.04em;
    color: var(--text-2);
}

/* ── Language switcher ─────────────────────────────────────────────────────── */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0;
    margin-right: 0.75rem;
    background: rgba(0,0,0,0.18);
    border-radius: 6px;
    padding: 2px;
}

.lang-btn {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.lang-btn:hover {
    color: #fff;
}

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

/* =============================================
   Planner
   ============================================= */

.planner-wrap {
    overflow-x: auto;
}

.planner-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.planner-user-col {
    width: 160px;
    min-width: 140px;
}

.planner-day-th {
    text-align: center;
    padding: .4rem .25rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-weight: 600;
}

.planner-weekend {
    background: var(--bg-page) !important;
    opacity: .7;
}

.planner-today-col {
    background: #eff6ff !important;
}

.planner-day-name {
    font-size: .7rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.planner-day-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-1);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: .15rem auto 0;
    border-radius: 50%;
}

.planner-today-num {
    background: var(--accent);
    color: #fff;
}

.planner-row {
    border-bottom: 1px solid var(--border);
}

.planner-user-cell {
    padding: .5rem .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    left: 0;
    z-index: 1;
}

.planner-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.planner-user-name {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planner-cell {
    vertical-align: top;
    padding: .3rem .25rem;
    border: 1px solid var(--border);
    min-height: 60px;
    cursor: pointer;
    transition: background .1s;
    position: relative;
}

.planner-cell:hover {
    background: #f0f7ff;
}

.planner-weekend.planner-cell:hover {
    background: var(--bg-page);
    cursor: default;
}

.planner-chip {
    border-radius: 5px;
    padding: .2rem .45rem;
    margin-bottom: .2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    min-height: 1.6rem;
    transition: filter .15s;
}

.planner-chip:hover {
    filter: brightness(.9);
}

.planner-chip-title {
    font-size: .75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Color picker */
.planner-color-picker {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    padding-top: .25rem;
}

.planner-color-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
}

.planner-color-btn:hover {
    transform: scale(1.15);
}

.planner-color-btn.selected {
    border-color: var(--text-1);
}

.planner-cell-readonly {
    cursor: default;
}

.planner-cell-readonly:hover {
    background: inherit;
}

.planner-chip-readonly {
    cursor: default;
}

.planner-chip-readonly:hover {
    filter: none;
}

/* Planner month view */
.planner-month-th {
    min-width: 32px;
    padding: .2rem .05rem;
}

.planner-month-day-num {
    font-size: .8rem;
    width: 1.6rem;
    height: 1.6rem;
}

.planner-month-cell {
    padding: .1rem .05rem;
    min-height: 30px;
    vertical-align: middle;
}

/* Lane sub-rows: no top border repetition */
.planner-row-lane td {
    border-top: none;
    min-height: 26px;
}

/* Activity spanning cell: no padding so chip fills edge-to-edge */
.planner-act-cell {
    padding: 2px 0 !important;
    border-left: none;
    border-right: none;
    cursor: pointer;
}

.planner-month-chip {
    padding: .15rem .5rem;
    min-height: 1.4rem;
    margin: 0;
}

/* Spanning chip fills full cell width */
.planner-span-chip {
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.planner-month-chip .planner-chip-title {
    font-size: .72rem;
}

/* =============================================
   Suggestions
   ============================================= */

.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.suggestion-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
}

.suggestion-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.suggestion-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
}

.suggestion-title {
    font-weight: 600;
    font-size: .95rem;
    color: var(--text-1);
}

.suggestion-body {
    font-size: .875rem;
    color: var(--text-2);
    white-space: pre-wrap;
    margin-bottom: .5rem;
}

.suggestion-meta {
    font-size: .75rem;
    color: var(--text-3);
}

.suggestion-admin-note {
    margin-top: .5rem;
    padding: .5rem .75rem;
    background: #f8fafc;
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    font-size: .8rem;
    color: var(--text-2);
}

.suggestion-admin-note-label {
    font-weight: 600;
    margin-right: .35rem;
    color: var(--accent);
}

/* Status badges */
.badge-suggestion-pending    { background: #f1f5f9; color: #475569; }
.badge-suggestion-discussion { background: #fff7ed; color: #c2410c; }

/* Readonly text in panel */
.suggestion-readonly-text {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    font-size: .875rem;
    color: var(--text-1);
}

.suggestion-readonly-body {
    white-space: pre-wrap;
    min-height: 80px;
}

/* Status selector buttons */
.suggestion-status-btns {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    padding-top: .25rem;
}

.suggestion-status-btn {
    padding: .3rem .8rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, opacity .15s;
    opacity: .6;
}

.suggestion-status-btn.selected {
    border-color: var(--text-1);
    opacity: 1;
}

.suggestion-status-btn:hover {
    opacity: 1;
}


/* =============================================
   Reports
   ============================================= */

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 .25rem;
    color: var(--text-2);
    line-height: 1;
}
.btn-icon:hover { color: var(--brand); }

.btn-icon-danger:hover { color: #dc2626; }

.btn-sm {
    padding: .25rem .6rem;
    font-size: .8rem;
}

.text-muted {
    color: var(--text-3);
    font-size: .85em;
}

.data-table-sm th,
.data-table-sm td {
    padding: .35rem .6rem;
    font-size: .85rem;
}

.row-selected td {
    background: #eff6ff !important;
}

.data-table tfoot td {
    border-top: 2px solid var(--border);
    padding: .4rem .75rem;
}

/* =============================================
   Reports
   ============================================= */

/* ── Status badges ── */
.badge-report-draft      { background: #f1f5f9; color: #64748b; font-weight: 500; }
.badge-report-inprogress { background: #fff7ed; color: #c2410c; font-weight: 500; }
.badge-report-complete   { background: #f0fdf4; color: #15803d; font-weight: 500; }

/* ── Summary cards ── */
.reports-stat-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 240px));
    margin-bottom: 1.25rem;
}
.reports-grand-total { font-size: 1.75rem; color: var(--brand); }

/* ── Table wrapper ── */
.reports-table-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    background: var(--bg-card);
}

/* ── Column headers ── */
.reports-table th.rth-customer { width: 40%; }
.reports-table th.rth-status   { width: 140px; }
.reports-table th.rth-hours    { text-align: right; padding-right: 1.25rem; }

/* ── Customer cell: name + period stacked ── */
.rtd-customer {
    padding-top: .85rem !important;
    padding-bottom: .85rem !important;
}
.rtd-name {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-1);
    line-height: 1.3;
}
.rtd-period {
    display: block;
    font-size: .78rem;
    color: var(--text-3);
    margin-top: 1px;
    text-transform: capitalize;
}

/* ── Status cell ── */
.rtd-status { vertical-align: middle; }

/* ── Hours cell: value + entries stacked ── */
.rtd-hours {
    text-align: right;
    padding-right: 1.25rem !important;
    vertical-align: middle;
}
.rtd-hours-val {
    display: block;
    font-size: .95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-1);
    line-height: 1.3;
}
.rtd-entries {
    display: block;
    font-size: .75rem;
    color: var(--text-3);
    margin-top: 1px;
}

/* ── Row interactions ── */
.reports-row { cursor: pointer; }
.reports-row td { transition: background .1s; }
.reports-row:hover td { background: #f5f8ff !important; }
.reports-row.row-selected td { background: #eff6ff !important; }

/* ── Chevron ── */
.col-open { text-align: right; width: 32px; padding-right: .75rem !important; }
.reports-chevron {
    display: inline-block;
    color: var(--text-3);
    font-size: 1.1rem;
    line-height: 1;
    transition: transform .15s, color .15s;
}
.reports-row:hover .reports-chevron { color: var(--brand); }
.reports-chevron-open { transform: rotate(90deg); color: var(--brand) !important; }

/* ── Total footer row ── */
.reports-total-row td {
    border-top: 2px solid var(--border);
    background: #f8fafc;
    padding: .75rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-2);
}
.reports-total-row .rtd-hours { padding-right: 1.25rem !important; }
.reports-total-row .rtd-hours-val { font-size: 1rem; }

/* Report detail entries table */
.report-entries-wrap {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    max-height: 520px;
    overflow-y: auto;
}
.report-entries-wrap .table-wrapper { border: none; }

.col-entry-date    { white-space: nowrap; color: var(--text-2); font-size: .82rem; width: 48px; }
.col-entry-name    { font-size: .85rem; white-space: nowrap; }
.col-entry-proj    { font-size: .85rem; color: var(--text-2); }
.col-entry-hours   { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.col-entry-actions { text-align: right; white-space: nowrap; padding-right: .5rem !important; }

.report-entries-total td {
    border-top: 2px solid var(--border);
    background: var(--bg-page);
    padding: .5rem .6rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-2);
}
.report-entries-total .col-entry-hours {
    color: var(--brand);
    font-size: .95rem;
}

/* ═══════════════════════════════════════════════════════════════
   LEAVES
   ═══════════════════════════════════════════════════════════════ */

/* ── Legend ── */
.leaves-legend {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1rem;
    font-size: .82rem;
    color: var(--text-2);
}
.leaves-legend-item { display: flex; align-items: center; gap: .4rem; }
.leaves-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

/* ── Pending panel ── */
.leaves-pending-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.leaves-pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1;
}
.leaves-pending-list {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
}
.leaves-pending-header {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #92400e;
    margin-bottom: .5rem;
}
.leaves-pending-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .45rem .5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: .85rem;
    transition: background .1s;
}
.leaves-pending-item:hover { background: #fef3c7; }
.leaves-pi-name { font-weight: 600; color: var(--text-1); min-width: 130px; }
.leaves-pi-detail { display: flex; align-items: center; gap: .5rem; color: var(--text-2); }

/* ── Type toggle (form) ── */
.leaves-type-toggle {
    display: flex;
    gap: .5rem;
}
.leaves-type-btn {
    flex: 1;
    padding: .5rem .75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-2);
    font-size: .875rem;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.leaves-type-btn:hover { border-color: var(--brand); color: var(--brand); }
.leaves-type-btn.selected {
    border-color: var(--brand);
    background: #eff6ff;
    color: var(--brand);
    font-weight: 600;
}

/* ── Days hint ── */
.leaves-days-hint {
    font-size: .82rem;
    color: var(--text-3);
    margin-top: -.25rem;
    margin-bottom: .25rem;
    padding-left: .25rem;
}

/* ── Leave chips in calendar ── */
.leave-chip {
    height: 20px;
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    overflow: hidden;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: filter .1s;
}
.leave-chip:hover { filter: brightness(.9); }
.leave-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

/* Chip shapes: border-radius only on edges */
.leave-chip-single  { border-radius: 4px; padding: 0 4px; }
.leave-chip-first   { border-radius: 4px 0 0 4px; padding-left: 4px; margin-right: -1px; }
.leave-chip-middle  { border-radius: 0; margin: 0 -1px; }
.leave-chip-last    { border-radius: 0 4px 4px 0; padding-right: 4px; margin-left: -1px; }

/* Ferie colors */
.leave-chip-ferie              { background: #bfdbfe; color: #1e40af; }
.leave-chip-ferie.leave-chip-pending   { background: repeating-linear-gradient(45deg, #bfdbfe, #bfdbfe 4px, #dbeafe 4px, #dbeafe 8px); color: #1e40af; }
.leave-chip-ferie.leave-chip-rejected  { background: #e2e8f0; color: #94a3b8; }

/* Permesso colors */
.leave-chip-permesso           { background: #a7f3d0; color: #065f46; }
.leave-chip-permesso.leave-chip-pending  { background: repeating-linear-gradient(45deg, #a7f3d0, #a7f3d0 4px, #d1fae5 4px, #d1fae5 8px); color: #065f46; }
.leave-chip-permesso.leave-chip-rejected { background: #e2e8f0; color: #94a3b8; }

/* Legend dots */
.leaves-ferie-approved    { background: #bfdbfe; }
.leaves-permesso-approved { background: #a7f3d0; }
.leaves-pending-dot       { background: repeating-linear-gradient(45deg, #bfdbfe, #bfdbfe 3px, #dbeafe 3px, #dbeafe 6px); }

/* Readonly chip (other people's leaves for non-privileged) */
.planner-chip-readonly { cursor: default; }

/* ── Badges for leave types ── */
.badge-leave-ferie    { background: #dbeafe; color: #1d4ed8; }
.badge-leave-permesso { background: #d1fae5; color: #047857; }

/* ═══════════════════════════════════════════════════════════════
   MARKDOWN EDITOR (EasyMDE)
   ═══════════════════════════════════════════════════════════════ */

.md-editor-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.md-editor-wrap .EasyMDEContainer {
    font-family: inherit;
}

/* Toolbar */
.md-editor-wrap .editor-toolbar {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    border-top: none;
    border-left: none;
    border-right: none;
    padding: .25rem .4rem;
    opacity: 1;
}

.md-editor-wrap .editor-toolbar button {
    color: var(--text-2) !important;
    border-radius: 4px;
    width: 28px;
    height: 26px;
}

.md-editor-wrap .editor-toolbar button:hover,
.md-editor-wrap .editor-toolbar button.active {
    background: var(--border);
    color: var(--text-1) !important;
    border-color: transparent;
}

.md-editor-wrap .editor-toolbar i.separator {
    border-color: var(--border);
}

/* Code area */
.md-editor-wrap .CodeMirror {
    font-family: inherit;
    font-size: .875rem;
    line-height: 1.6;
    border: none;
    background: var(--bg-card);
    color: var(--text-1);
    padding: .5rem .25rem;
    min-height: 180px;
}

.md-editor-wrap .CodeMirror-scroll {
    min-height: 180px;
}

.md-editor-wrap .CodeMirror .cm-s-easymde .cm-header { color: var(--brand); }

/* Preview pane */
.md-editor-wrap .editor-preview,
.md-editor-wrap .editor-preview-side {
    background: var(--bg-card);
    font-size: .875rem;
    line-height: 1.6;
    color: var(--text-1);
    padding: .75rem 1rem;
}

.md-editor-wrap .editor-preview p,
.md-editor-wrap .editor-preview-side p { margin-bottom: .5rem; }

.md-editor-wrap .editor-preview ul,
.md-editor-wrap .editor-preview-side ul { padding-left: 1.25rem; }

/* Remove outer border from EasyMDE (we wrap it ourselves) */
.md-editor-wrap .CodeMirror,
.md-editor-wrap .editor-toolbar,
.md-editor-wrap .editor-statusbar {
    border-radius: 0;
}

/* ═══════════════════════════════════════════════════════════════
   MERGE PROJECTS PANEL
   ═══════════════════════════════════════════════════════════════ */

.merge-project-list {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 320px;
    overflow-y: auto;
    margin-top: .4rem;
}

.merge-project-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: .875rem;
    transition: background .1s;
    user-select: none;
}

.merge-project-item:last-child { border-bottom: none; }
.merge-project-item:hover { background: #f5f8ff; }

.merge-project-item.selected { background: #eff6ff; }
.merge-project-item.is-dest  { opacity: .45; cursor: not-allowed; background: var(--bg-page); }

.merge-project-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--brand);
}

.merge-pi-name { font-weight: 600; color: var(--text-1); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.merge-pi-customer { font-size: .78rem; color: var(--text-3); white-space: nowrap; }

.merge-sources-count {
    font-size: .78rem;
    color: var(--brand);
    font-weight: 600;
    margin-top: .35rem;
    padding-left: .25rem;
}

/* Confirm step */
.merge-confirm-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: .75rem 1rem;
    font-size: .875rem;
    color: #92400e;
    font-weight: 500;
    margin-bottom: 1rem;
}

.merge-confirm-list {
    list-style: disc;
    padding-left: 1.25rem;
    font-size: .875rem;
    color: var(--text-2);
    line-height: 1.8;
}

.merge-entry-count {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .75rem 1rem;
    font-size: .875rem;
    color: var(--text-2);
    margin-top: .5rem;
}

.merge-entry-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand);
    margin-right: .4rem;
    font-variant-numeric: tabular-nums;
}

/* ── Export column picker ── */
.export-col-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .6rem;
    padding: .5rem .75rem;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .8rem;
}

.export-col-label {
    font-weight: 600;
    color: var(--text-2);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: .25rem;
    white-space: nowrap;
}

.export-col-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.export-col-item input[type="checkbox"] {
    accent-color: var(--brand);
    cursor: pointer;
}
