/* =====================================================================
   CSS Custom Properties
   ===================================================================== */
:root, [data-theme="warm"] {
    /* Háttér rétegek — meleg, természetes, visszafogott tónusok */
    --bg-primary:      #f4efe7;   /* oldal háttér */
    --bg-secondary:    #fffcf7;   /* fejléc, panelek */
    --bg-column:       #fffcf7;   /* kanban oszlopok */
    --bg-card:         #ffffff;   /* kártyák */
    --bg-card-hover:   #f6e3d4;   /* kiemelés / hover */
    --bg-input:        #ffffff;   /* input mezők */

    /* Szövegszínek */
    --text-primary:    #332c28;   /* fő szöveg */
    --text-secondary:  #756a63;   /* másodlagos */
    --text-faint:      #b8a99b;   /* halvány / placeholder */
    --text-on-accent:  #2e2620;   /* szöveg accent-színű háttéren */

    /* Akcentszínek — terrakotta elsődleges */
    --accent-blue:     #d9773f;   /* terrakotta — fő accent */
    --accent-hover:    #c1642f;   /* terrakotta hover */
    --accent-glow:     rgba(217, 119, 63, 0.18);
    --accent-green:    #5e8c61;   /* siker */
    --accent-orange:   #d9773f;   /* orange = terrakotta */
    --accent-red:      #c95146;   /* veszély / sürgős */
    --purple:          #8c7a94;   /* visszafogott mályva — AI badge */
    --muted-blue:      #7c93a8;   /* tompa kék — Collector, csak-átfutási állapot */

    /* Terrakotta opacity variánsok */
    --amber-10:  rgba(217, 119, 63, 0.10);
    --amber-12:  rgba(217, 119, 63, 0.12);
    --amber-18:  rgba(217, 119, 63, 0.18);
    --amber-20:  rgba(217, 119, 63, 0.20);
    --amber-30:  rgba(217, 119, 63, 0.30);
    --amber-35:  rgba(217, 119, 63, 0.35);
    --amber-40:  rgba(217, 119, 63, 0.40);
    --amber-45:  rgba(217, 119, 63, 0.45);
    /* Piros opacity variánsok */
    --red-12:    rgba(201, 81, 70, 0.12);
    --red-15:    rgba(201, 81, 70, 0.15);
    --red-25:    rgba(201, 81, 70, 0.25);
    --red-30:    rgba(201, 81, 70, 0.30);
    --red-40:    rgba(201, 81, 70, 0.40);
    /* Zöld opacity variánsok */
    --green-15:  rgba(94, 140, 97, 0.15);
    --green-25:  rgba(94, 140, 97, 0.25);
    --green-30:  rgba(94, 140, 97, 0.30);

    /* Border */
    --border-color:    #ded3c7;

    /* Árnyék — finom, meleg tónusú */
    --shadow-soft:      0 2px 8px rgb(70 50 35 / 8%);
    --shadow-soft-lg:   0 4px 16px rgb(70 50 35 / 10%);
    --vignette-color:   rgba(70, 50, 35, 0.10);

    /* Layout */
    --header-height:   76px;
    --column-min-w:    340px;
    --radius:          9px;
    --radius-lg:       12px;
}

/* Eredeti Hajka 1.0 sötét téma — smink-választóval elérhető */
[data-theme="dark"] {
    --bg-primary:      #0f1117;
    --bg-secondary:    #1a1b2e;
    --bg-column:       #161727;
    --bg-card:         #1e2035;
    --bg-card-hover:   #252848;
    --bg-input:        #12131f;

    --text-primary:    #e2e4f0;
    --text-secondary:  #7c7f9e;
    --text-faint:      #454763;
    --text-on-accent:  #0f1117;

    --accent-blue:     #f59e0b;
    --accent-hover:    #d97706;
    --accent-glow:     rgba(245, 158, 11, 0.15);
    --accent-green:    #34d399;
    --accent-orange:   #f59e0b;
    --accent-red:      #f87171;
    --purple:          #8b5cf6;
    --muted-blue:      #5b7a99;

    --amber-10:  rgba(245, 158, 11, 0.10);
    --amber-12:  rgba(245, 158, 11, 0.12);
    --amber-18:  rgba(245, 158, 11, 0.18);
    --amber-20:  rgba(245, 158, 11, 0.20);
    --amber-30:  rgba(245, 158, 11, 0.30);
    --amber-35:  rgba(245, 158, 11, 0.35);
    --amber-40:  rgba(245, 158, 11, 0.40);
    --amber-45:  rgba(245, 158, 11, 0.45);
    --red-12:    rgba(248, 113, 113, 0.12);
    --red-15:    rgba(248, 113, 113, 0.15);
    --red-25:    rgba(248, 113, 113, 0.25);
    --red-30:    rgba(248, 113, 113, 0.30);
    --red-40:    rgba(248, 113, 113, 0.40);
    --green-15:  rgba(52, 211, 153, 0.15);
    --green-25:  rgba(52, 211, 153, 0.25);
    --green-30:  rgba(52, 211, 153, 0.30);

    --border-color:    #252640;

    --shadow-soft:      0 2px 10px rgb(0 0 0 / 30%);
    --shadow-soft-lg:   0 4px 20px rgb(0 0 0 / 40%);
    --vignette-color:   rgba(15, 17, 23, 0.6);
}

/* =====================================================================
   Reset & Base
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
    height: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Atkinson Hyperlegible Next', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Az eredeti sötét témában megmarad a finom háttér-izzás */
[data-theme="dark"] html,
[data-theme="dark"] body {
    background-image:
        radial-gradient(ellipse 80% 40% at 10% 90%, rgba(139, 92, 246, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(245, 158, 11, 0.03)  0%, transparent 60%);
}

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--accent-blue);
    color: var(--text-on-accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover { background: #dcc7ac; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }

.btn-action {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    font-size: 12px;
}
.btn-action:hover { background: var(--amber-10); }

.btn-timer {
    background: var(--green-15);
    color: var(--accent-green);
    border: 1px solid var(--green-30);
    padding: 4px 8px;
    font-size: 12px;
}
.btn-timer:hover { background: var(--green-25); }
.btn-timer.btn-timer-active {
    background: var(--amber-18);
    color: var(--accent-blue);
    border-color: var(--amber-35);
}
.btn-timer.btn-timer-active:hover { background: var(--amber-30); }

.btn-timer-stop {
    background: var(--amber-18);
    color: var(--accent-blue);
    border: 1px solid var(--amber-40);
}
.btn-timer-stop:hover { background: var(--amber-35); }

.btn-disabled, .btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.btn:disabled { pointer-events: auto; }
.btn:disabled:hover { opacity: 0.35; }

/* =====================================================================
   Login
   ===================================================================== */
.login-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-select {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.lang-select:hover { background: var(--amber-10); }

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 360px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
    text-align: center;
    letter-spacing: 1px;
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin: 4px 0 28px;
    font-size: 13px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 14px;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.error-message {
    background: var(--red-12);
    border: 1px solid var(--red-30);
    border-radius: 6px;
    color: var(--accent-red);
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* =====================================================================
   Header
   ===================================================================== */
#board-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Vignette: enyhe sötétedés a board széleín */
#board-view::after {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(
        to right,
        var(--vignette-color) 0%,
        transparent 11%,
        transparent 89%,
        var(--vignette-color) 100%
    );
    pointer-events: none;
    z-index: 3;
}

.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
    z-index: 10;
}

.header-left { flex-shrink: 0; }
.header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
}
.header-right { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }

.header-menu-panel { display: flex; align-items: center; gap: 10px; }
.mobile-menu-btn { display: none; }
#mobile-menu-overlay { display: none; }

#timer-display {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 640px;
    justify-content: center;
    padding: 6px 4px;
}

#timer-display.timer-bar-active {
    justify-content: space-between;
}

.timer-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.timer-status-dot.timer-status-active  { background: var(--accent-blue); }
.timer-status-dot.timer-status-passive { background: var(--muted-blue); }
.timer-status-dot.timer-status-idle    { background: var(--text-faint); }

.timer-bar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}
.timer-bar-empty-title {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}
.timer-bar-empty-sub {
    color: var(--text-faint);
    font-size: 11px;
}

.timer-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.timer-bar-center {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-shrink: 0;
}

.timer-bar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.timer-bar-biglabel {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.timer-bar-turnaround {
    color: var(--muted-blue);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

#passive-display {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 14px;
}

.passive-header-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    background: rgba(74, 55, 40,0.05);
    border-radius: 10px;
    padding: 1px 7px;
    white-space: nowrap;
}

.passive-header-title {
    color: var(--text-secondary);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.passive-header-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.app-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: 1px;
}

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

/* Timer in header */
.timer-header-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-header-elapsed {
    color: var(--accent-blue);
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 90px;
    text-align: center;
}

/* =====================================================================
   Board layout
   ===================================================================== */
.board-container {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    justify-content: safe center;
}

.column {
    flex: 0 0 340px;
    background: var(--bg-column);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s;
}

/* =====================================================================
   Column header
   ===================================================================== */
.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.column-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.column-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(74, 55, 40,0.06);
    padding: 2px 8px;
    border-radius: 12px;
}

.column-count.wip { color: var(--accent-blue); }
.column-count.wip-full { color: var(--accent-red) !important; }

/* Oszlop-azonosító felső csík — finom, nem a teljes fejléc */
#collector-column { border-top: 3px solid var(--muted-blue); }
#todo-column       { border-top: 3px solid var(--accent-blue); }
#recurring-column  { border-top: 3px solid var(--accent-green); }

#todo-column .column-title { color: var(--accent-blue); }

#todo-column.wip-full { border-color: var(--red-40); border-top-color: var(--accent-red); }
#todo-column.wip-full .column-title { color: var(--accent-red); }

@keyframes wip-flash {
    0%, 100% { border-color: var(--red-40); }
    50%       { border-color: var(--accent-red); box-shadow: 0 0 12px var(--red-40); }
}
#todo-column.wip-flash { animation: wip-flash 0.4s ease 2; }

/* =====================================================================
   Column body / cards scroll
   ===================================================================== */
.column-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.column-body::-webkit-scrollbar,
.filter-panel::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 4px; }
.column-body::-webkit-scrollbar-track,
.filter-panel::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track { background: transparent; }
.column-body::-webkit-scrollbar-thumb,
.filter-panel::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* =====================================================================
   Cards
   ===================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--amber-20);
}

/* Card aging */
.card {
    position: relative;
}

.card-aging-resting {
    border-left: 3px solid rgba(242, 153, 74, 0.45) !important;
}

.card-aging-aging {
    border-left: 3px solid var(--accent-orange) !important;
    background: rgba(242, 153, 74, 0.06) !important;
}

.card-aging-critical {
    border-left: 3px solid var(--accent-red) !important;
    background: rgba(226, 112, 94, 0.07) !important;
}

.card-age-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(226, 112, 94, 0.20);
    color: #b5453a;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    line-height: 1.6;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Company + task type row */
.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.task-type {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Labels */
.card-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.label-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

/* Checklist progress */
.card-checklist {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checklist-text {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(74, 55, 40,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Time display per todo card */
.card-times {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    min-height: 16px;
}

.passive-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.active-time {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.times-sep {
    color: var(--text-secondary);
    opacity: 0.5;
}

.timer-elapsed {
    color: var(--accent-green);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Pulsating dot */
.timer-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}
.timer-dot.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* Card action buttons */
.card-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding-top: 2px;
    border-top: 1px solid rgba(74, 55, 40,0.05);
}

.card { cursor: pointer; }

/* =====================================================================
   Filter panel
   ===================================================================== */
.filter-panel {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 10px;
    gap: 0;
}


.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.filter-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-subtitle {
    font-size: 10px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 12px;
    opacity: 0.7;
}

.filter-section {
    margin-bottom: 12px;
}

.filter-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    opacity: 0.8;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    text-align: left;
    background: rgba(74, 55, 40,0.03);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px 7px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 3px;
    transition: background 0.12s, border-color 0.12s;
}

.filter-chip:hover { background: rgba(74, 55, 40,0.07); }

.filter-chip.active {
    background: var(--amber-10);
    border-color: var(--amber-30);
    color: var(--accent-blue);
}

.filter-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-empty {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 8px;
    opacity: 0.7;
}

/* =====================================================================
   Modal / Card Detail
   ===================================================================== */
.modal-overlay,
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
}
.modal-overlay {
    background: rgba(0, 0, 0, 0.65);
    justify-content: flex-end;
    align-items: stretch;
}

.modal-overlay[hidden] { display: none; }

.modal-panel {
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slide-in-right 0.22s ease;
}

@keyframes slide-in-right {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-title-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.modal-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    align-self: flex-start;
}

.modal-close-btn { flex-shrink: 0; }

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


.modal-loading,
.modal-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-error { color: var(--accent-red); }

/* Sections */
.modal-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-section:last-child { border-bottom: none; }

.modal-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.modal-section-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 14px 0 8px;
}

/* Summary */
.modal-summary {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.modal-raw-intent {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Metadata */
.modal-meta-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-meta-label {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 72px;
}

.modal-meta-value {
    font-size: 13px;
    color: var(--text-primary);
}

/* Company selector */
.company-selector {
    position: relative;
    display: inline-block;
}

.company-badge-btn {
    cursor: pointer;
    transition: opacity 0.15s;
}

.company-badge-btn:hover { opacity: 0.75; }

.company-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 190px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft-lg);
    z-index: 300;
    overflow: hidden;
}

.company-option {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.1s;
}

.company-option:hover { background: rgba(74, 55, 40,0.06); }
.company-option.active { color: var(--accent-blue); }

/* Checklist modal */
.modal-checklist-progress {
    height: 5px;
    margin-bottom: 12px;
}

.checklist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checklist-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--accent-green);
}

.checklist-label {
    font-size: 13px;
    color: var(--text-primary);
    transition: color 0.15s;
    line-height: 1.4;
}

.checklist-item.done .checklist-label {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Timer section */
.timer-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timer-summary-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-active-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-green);
    font-variant-numeric: tabular-nums;
}

/* Sessions */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-top: 1px solid rgba(74, 55, 40,0.04);
    font-size: 11px;
}

.session-time { color: var(--text-secondary); }
.session-dur  { color: var(--text-primary); font-weight: 500; }

/* Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
    min-height: 0;
}

.comments-empty {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 14px;
}

.comment-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-blue);
}

.comment-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 58px;
    transition: border-color 0.15s;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Timeline */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.timeline-icon {
    font-size: 13px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    padding-top: 1px;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    line-height: 1.4;
}

.timeline-actor {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-sep {
    font-size: 11px;
    color: var(--text-secondary);
}

.timeline-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-date {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: 1px;
}

/* =====================================================================
   Stat bar
   ===================================================================== */
.stat-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 16px;
    background: rgba(74, 55, 40, 0.02);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
    white-space: nowrap;
    min-height: 32px;
}

.stat-bar:empty { display: none; }

.stat-chip {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(74, 55, 40, 0.05);
    white-space: nowrap;
    user-select: none;
}

.stat-chip-warn    { color: var(--accent-red);   font-weight: 600; }
.stat-chip-success { color: #4f8060;             font-weight: 600; }
.stat-chip-dim     { color: var(--text-secondary); opacity: 0.6; }
.stat-chip-clickable { cursor: pointer; }
.stat-chip-clickable:hover { background: rgba(74, 55, 40,0.1); }

.stat-sep {
    color: var(--border-color);
    font-size: 0.75rem;
    padding: 0 2px;
    flex-shrink: 0;
    user-select: none;
}

@media (max-width: 768px) {
    .stat-bar { display: none; }
}

/* =====================================================================
   AI input bar
   ===================================================================== */
#ai-input-bar {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    align-items: flex-end;
}

#ai-intent-input {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 14px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    min-height: 38px;
    max-height: 90px;
    overflow-y: auto;
    transition: border-color 0.15s;
}

#ai-intent-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

#ai-intent-input::placeholder { color: var(--text-secondary); }

#ai-generate-btn {
    background: var(--accent-blue);
    color: var(--text-on-accent);
    white-space: nowrap;
    min-height: 38px;
    font-weight: 600;
}

#ai-generate-btn:hover:not(:disabled) { background: var(--accent-hover); }
#ai-generate-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* =====================================================================
   Quick Capture bar
   ===================================================================== */
.quick-capture-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--amber-35);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.quick-capture-bar.visible {
    transform: translateY(0);
    opacity: 1;
}

.quick-capture-icon {
    font-size: 16px;
    flex-shrink: 0;
}

#quick-capture-input {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--amber-40);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 14px;
    font-family: inherit;
    height: 36px;
    transition: border-color 0.15s;
}

#quick-capture-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

#quick-capture-input::placeholder { color: var(--text-secondary); font-size: 12px; }

/* =====================================================================
   Toast notifications
   ===================================================================== */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 90vw;
}

.toast {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-soft-lg);
    animation: toast-in 0.22s ease, toast-out 0.22s ease 2.8s forwards;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.toast-success { background: #4b7a5b; color: #fff; }
.toast-error   { background: #b5453a; color: #fff; }
.toast-info    { background: #8a5a2e; color: #fff; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* =====================================================================
   Mobile filter overlay (global — not inside media query)
   ===================================================================== */
#mobile-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 149;
}

#mobile-filter-overlay.visible { display: block; }

/* Mobile close button inside filter panel — hidden on desktop */
.filter-mobile-close { display: none; }

/* Mobile tabs — hidden on desktop */
.mobile-tabs { display: none; }

/* =====================================================================
   Desktop: always show columns
   ===================================================================== */
@media (min-width: 769px) {
    .column { display: flex !important; }
}

/* =====================================================================
   Mobile (max-width: 768px)
   ===================================================================== */
@media (max-width: 768px) {

    /* --- Header --- */
    .app-header {
        position: relative;
        height: auto;
        min-height: 48px;
        flex-wrap: wrap;
        padding: 8px 14px;
        gap: 4px;
    }

    .header-left { order: 0; }

    .header-right {
        order: 1;
        margin-left: auto;
    }

    /* --- Header overflow menu (☰) --- */
    .mobile-menu-btn { display: flex; }
    .mobile-menu-btn.active { background: var(--amber-12); border-color: var(--accent-blue); }

    .header-menu-panel { display: none; }

    .header-menu-panel.mobile-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        padding: 12px 14px;
        z-index: 150;
        box-shadow: var(--shadow-soft-lg);
        animation: slide-down-menu 0.18s ease;
    }

    .header-menu-panel.mobile-open .lang-select,
    .header-menu-panel.mobile-open .btn {
        width: 100%;
        justify-content: center;
    }

    @keyframes slide-down-menu {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    #mobile-menu-overlay.visible {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9; /* below .app-header's own z-index:10 stacking context, which contains the menu panel */
    }

    .header-center {
        order: 2;
        width: 100%;
        align-items: flex-start;
        gap: 0;
        padding-bottom: 2px;
    }

    .user-name { display: none; }

    #passive-display { display: none; }

    .timer-bar-empty-sub { display: none; }

    .timer-bar-biglabel { display: none; }

    .timer-bar-turnaround { display: none; }

    #timer-display {
        justify-content: flex-start;
        font-size: 11px;
    }

    .timer-header-title {
        max-width: 150px;
        font-size: 12px;
    }

    .timer-header-elapsed { font-size: 18px; min-width: unset; }

    /* --- Mobile tabs bar --- */
    .mobile-tabs {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 8px 0;
        background: var(--bg-primary);
        flex-shrink: 0;
        z-index: 5;
    }

    .mobile-tab-select-wrap {
        position: relative;
        flex: 1;
        min-width: 0;
    }

    .mobile-tab-select-btn {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding: 10px 12px;
        background: var(--bg-card);
        border: 1px solid var(--accent-blue);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 13px;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        text-align: left;
        min-height: 44px;
        transition: background 0.15s, border-color 0.15s;
    }

    .mobile-tab-select-btn.active { background: var(--amber-12); }

    .mobile-tab-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .mobile-tab-select-caret { flex-shrink: 0; color: var(--text-secondary); font-size: 11px; }

    .mobile-tab-menu {
        display: none;
        flex-direction: column;
        gap: 4px;
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 6px;
        box-shadow: var(--shadow-soft-lg);
        z-index: 6;
    }

    .mobile-tab-menu.open {
        display: flex;
        animation: slide-down-menu 0.15s ease;
    }

    .mobile-tab-menu-item {
        padding: 10px 10px;
        background: transparent;
        border: none;
        border-radius: 6px;
        color: var(--text-secondary);
        font-size: 13px;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        text-align: left;
        min-height: 40px;
        transition: background 0.15s, color 0.15s;
    }

    .mobile-tab-menu-item.mobile-tab-active {
        background: var(--amber-10);
        color: var(--accent-blue);
    }

    .mobile-filter-btn {
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 16px;
        cursor: pointer;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s, border-color 0.15s;
    }

    .mobile-filter-btn.active {
        background: var(--amber-12);
        border-color: var(--accent-blue);
    }

    /* --- Board container / columns --- */
    .board-container {
        padding: 8px;
        overflow-x: hidden;
        justify-content: flex-start;
    }

    .column {
        display: none;
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .column.mobile-active {
        display: flex;
    }

    .filter-panel { display: none; }

    /* --- Filter panel as mobile bottom sheet --- */
    .filter-panel.mobile-open {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
        border-radius: var(--radius) var(--radius) 0 0;
        border: 1px solid var(--border-color);
        border-bottom: none;
        z-index: 150;
        animation: slide-up-filter 0.22s ease;
    }

    @keyframes slide-up-filter {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .filter-mobile-close {
        display: flex;
        align-items: center;
        gap: 6px;
        width: 100%;
        background: transparent;
        border: none;
        border-bottom: 1px solid var(--border-color);
        color: var(--accent-blue);
        font-size: 14px;
        font-weight: 500;
        font-family: inherit;
        padding: 0 0 12px 0;
        margin-bottom: 10px;
        cursor: pointer;
        text-align: left;
        min-height: 44px;
    }

    /* --- Cards: larger touch targets --- */
    .card {
        padding: 14px;
        gap: 10px;
    }

    .card-actions {
        gap: 6px;
    }

    .btn-action {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
    }

    .btn-timer {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 13px;
    }

    /* --- Modal: full-screen bottom sheet on mobile --- */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-panel {
        max-width: 100%;
        max-height: 95vh;
        height: 95vh;
        border-left: none;
        border-top: 1px solid var(--border-color);
        border-radius: var(--radius) var(--radius) 0 0;
        animation: slide-up-modal 0.25s ease;
    }

    @keyframes slide-up-modal {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Larger checklist items */
    .checklist-item {
        min-height: 44px;
        gap: 12px;
        align-items: center;
    }

    .checklist-checkbox {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .checklist-label { cursor: pointer; }

    /* Comment textarea */
    .comment-textarea {
        font-size: 16px; /* Prevents iOS auto-zoom */
        min-height: 72px;
    }

    /* AI input bar on mobile */
    #ai-input-bar {
        padding: 8px 10px;
        gap: 8px;
    }

    #ai-intent-input {
        font-size: 16px; /* Prevents iOS auto-zoom */
    }

    #ai-generate-btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* Modal close button larger */
    .modal-close-btn {
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }

}

/* =====================================================================
   Admin View
   ===================================================================== */
.admin-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.admin-loading,
.admin-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}
.admin-error { color: var(--accent-red); }

.admin-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.admin-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.admin-setting-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 12px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(74, 55, 40,0.04);
}
.admin-setting-row:last-of-type { border-bottom: none; }

.admin-setting-label {
    font-size: 12px;
    font-family: monospace;
    color: var(--accent-blue);
    padding-top: 7px;
}

.admin-setting-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 10px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.admin-input:focus { border-color: var(--accent-blue); }
.admin-input-narrow { max-width: 80px; }

.admin-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}
.admin-input-group .admin-input { flex: 1; }
.admin-eye-btn { flex-shrink: 0; }

.admin-setting-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.admin-ai-test {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.admin-test-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}
.admin-test-running { background: rgba(160,160,160,0.15); color: var(--text-secondary); }
.admin-test-ok      { background: rgba(102,187,106,0.15); color: var(--accent-green); }
.admin-test-error   { background: rgba(248,113,113,0.15);   color: var(--accent-red); }

.admin-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: flex-end;
    z-index: 50;
}

@media (max-width: 600px) {
    .admin-setting-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .admin-setting-label { padding-top: 0; }
}

/* =====================================================================
   Admin Tabs
   ===================================================================== */
.admin-tabs-bar {
    display: flex;
    gap: 4px;
    padding: 12px 16px 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.admin-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab-active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* =====================================================================
   Admin Users table
   ===================================================================== */
.admin-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-users-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.admin-users-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(74, 55, 40,0.04);
    vertical-align: middle;
}

.admin-users-table tr:last-child td { border-bottom: none; }
.admin-users-table tr:hover td { background: rgba(245,158,11,0.04); }

.user-row-self td { background: rgba(245,158,11,0.06); }

.user-cell-name { font-weight: 500; }

.self-badge {
    font-size: 11px;
    color: var(--accent-blue);
    font-weight: 400;
}

.user-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.user-status-active   { background: var(--accent-green); }
.user-status-inactive { background: var(--text-secondary); }

/* =====================================================================
   Admin user modal
   ===================================================================== */
.admin-modal-overlay {
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}

.admin-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    overflow-y: auto;
}

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

.admin-modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.admin-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 20px 0;
}

.admin-form-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.admin-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.admin-form-error {
    margin: 12px 20px 0;
    padding: 8px 12px;
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.3);
    border-radius: 6px;
    color: var(--accent-red);
    font-size: 12px;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
}

/* =====================================================================
   Admin — Data management (M5.3)
   ===================================================================== */
.admin-entity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.admin-entity-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 16px;
    padding: 0 5px;
    background: var(--border-color);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 6px;
    vertical-align: middle;
}

.admin-entity-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-entity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    transition: background 0.12s;
}
.admin-entity-row:hover { background: rgba(245,158,11,0.05); }

.color-chip {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(74, 55, 40,0.1);
}

.entity-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.entity-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-slug {
    font-size: 11px;
    color: var(--text-secondary);
}

.entity-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
}

.entity-badge {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.entity-badge-active   { background: rgba(102,187,106,0.15); color: var(--accent-green); }
.entity-badge-inactive { background: rgba(248,113,113,0.15);   color: var(--accent-red); }
.entity-badge-count    { background: rgba(245,158,11,0.12);  color: var(--accent-blue); }

.admin-entity-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-danger-action:not(:disabled) {
    color: var(--accent-red);
    border-color: rgba(248,113,113,0.3);
}
.btn-danger-action:not(:disabled):hover { background: rgba(248,113,113,0.1); }
.btn-danger-action:disabled { opacity: 0.35; cursor: not-allowed; }

/* =====================================================================
   M7.1 — Search
   ===================================================================== */

#search-overlay {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px 16px;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

#search-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    min-width: 0;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-results {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.search-card-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 500;
}

.search-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.search-status-badge {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
}

.search-status-collector { background: rgba(245,158,11,0.15); color: var(--accent-blue); }
.search-status-todo       { background: rgba(52,211,153,0.15); color: var(--accent-green); }
.search-status-archive    { background: rgba(124,127,158,0.15); color: var(--text-secondary); }

.search-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* =====================================================================
   M7.1 — Archive view
   ===================================================================== */

#archive-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
}

.archive-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.archive-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.archive-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.archive-card-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 1.35;
}

.archive-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.archive-card-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.archive-empty,
.archive-loading,
.archive-error {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 0.9rem;
}

/* =====================================================================
   M7.1 — Due date
   ===================================================================== */

.card-due-row {
    margin-top: 4px;
}

.due-date-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(124,127,158,0.12);
    color: var(--text-secondary);
    white-space: nowrap;
}

.due-date-chip.due-overdue {
    background: rgba(248,113,113,0.12);
    color: var(--accent-red);
    font-weight: 600;
}

.due-date-chip.due-soon {
    background: rgba(245,158,11,0.12);
    color: var(--accent-orange);
    font-weight: 600;
}

.due-date-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.due-date-value {
    cursor: pointer;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 1px;
    transition: border-color 0.15s;
}

.due-date-value:hover {
    border-color: var(--accent-blue);
}

.due-date-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.due-date-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* =====================================================================
   M7.2 — DB Dashboard
   ===================================================================== */

.db-summary-cards {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.db-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    flex: 1;
    min-width: 150px;
}

.db-stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

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

.db-table td,
.db-table th { padding: 8px 12px; }

/* =====================================================================
   Dashboard (built-in analytics — no Grafana in the box edition)
   ===================================================================== */
.dashboard-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.dash-stats-row { margin-top: 0; margin-bottom: 16px; }

.dash-columns {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.dash-section-half {
    flex: 1 1 320px;
    min-width: 280px;
}

.dash-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.backup-import-warning {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-red);
    background: color-mix(in srgb, var(--accent-red) 12%, transparent);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin: 0 0 14px;
}

.dash-empty,
.dash-empty-cell {
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
}

/* --- Vertical bar chart (daily activity) --- */
.dash-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    padding-top: 8px;
}

.dash-bar-col {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-width: 0;
}

.dash-bar-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    background: var(--bg-column);
    border-radius: 4px;
    overflow: hidden;
}

.dash-bar-fill {
    width: 100%;
    background: var(--accent-blue);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.2s ease;
}

.dash-bar-dot {
    position: absolute;
    top: -6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
}

.dash-bar-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 6px;
    white-space: nowrap;
}

/* --- Horizontal bar chart (company / task type breakdown) --- */
.dash-hbar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-hbar-row {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    align-items: center;
    gap: 10px;
}

.dash-hbar-label {
    font-size: 12px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.dash-hbar-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
}

.dash-hbar-value {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* --- Progress bars (recurring completion rate) --- */
.dash-progress-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dash-progress-row {
    display: grid;
    grid-template-columns: 130px 1fr 44px;
    align-items: center;
    gap: 10px;
}

.dash-progress-label {
    font-size: 12px;
    color: var(--text-primary);
}

.dash-progress-count {
    color: var(--text-secondary);
}

.dash-progress-track {
    background: var(--bg-column);
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.dash-progress-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 4px;
}

.dash-progress-value {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
    .dash-hbar-row,
    .dash-progress-row {
        grid-template-columns: 90px 1fr auto;
    }
}

.db-num {
    text-align: right;
    font-family: monospace;
    font-size: 0.85rem;
}

.db-table-name {
    font-family: monospace;
    font-size: 0.85rem;
}

.db-schema-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(74, 55, 40,0.05);
    font-family: monospace;
    white-space: nowrap;
}

.db-schemas-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.db-schema-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.db-schema-row:last-child { border-bottom: none; }

.db-schema-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.db-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.db-pgadmin-hint {
    font-size: 0.8rem;
    color: var(--text-faint);
    font-family: monospace;
}

/* =====================================================================
   M7.3 — Health check kártyák
   ===================================================================== */

.health-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.health-badge {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.health-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 4px;
}

.health-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    position: relative;
}

.health-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 8px 8px 0 0;
    background: var(--border-color);
}

.health-card.health-ok::before    { background: var(--accent-green); }
.health-card.health-warning::before { background: var(--accent-orange); }
.health-card.health-critical::before { background: #d64545; }

.health-card-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.health-card-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.health-conn-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.health-conn-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.health-card.health-warning .health-conn-fill  { background: var(--accent-orange); }
.health-card.health-critical .health-conn-fill { background: #d64545; }

/* =====================================================================
   Recurring column
   ===================================================================== */
#recurring-column {
    flex: 0 0 300px;
}

.recurring-column-footer {
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.recurring-add-btn {
    width: 100%;
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    background: transparent;
}
.recurring-add-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

.recurring-empty {
    padding: 20px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}

/* ── Sections ──────────────────────────────────────────────────────── */
.recurring-section + .recurring-section {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 4px;
}

.recurring-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 4px;
}

.recurring-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.recurring-section-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(74, 55, 40,0.06);
    padding: 1px 6px;
    border-radius: 10px;
}

/* ── Task items ────────────────────────────────────────────────────── */
.recurring-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    margin: 2px 4px;
    transition: background 0.2s, opacity 0.2s;
    cursor: default;
}

.recurring-item.recurring-completed { background: rgba(34, 197, 94, 0.08); }
.recurring-item.recurring-pending   { background: rgba(234, 179, 8, 0.07); }
.recurring-item.recurring-overdue   { background: rgba(239, 68, 68, 0.08); }
.recurring-item.recurring-loading   { opacity: 0.5; pointer-events: none; }

/* ── Checkbox ──────────────────────────────────────────────────────── */
.recurring-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    background: transparent;
    color: transparent;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin-top: 1px;
    padding: 0;
}

.recurring-checkbox.checked {
    background: #5f9973;
    border-color: #5f9973;
    color: #fff;
}

.recurring-checkbox:not(.checked):hover {
    border-color: #5f9973;
    color: rgba(95, 153, 115, 0.4);
}

.recurring-checkbox:not(.checked)::after { content: '✓'; }
.recurring-checkbox.checked::after { content: ''; }

/* ── Item body ─────────────────────────────────────────────────────── */
.recurring-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recurring-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    word-break: break-word;
}

.recurring-item.recurring-completed .recurring-item-title {
    opacity: 0.6;
    text-decoration: line-through;
}

.recurring-day-label {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
}

.recurring-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.badge-sm      { font-size: 10px !important; padding: 1px 6px !important; }
.label-badge-sm { font-size: 10px !important; padding: 1px 6px !important; }

/* ── Right side ────────────────────────────────────────────────────── */
.recurring-item-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.recurring-streak {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    white-space: nowrap;
}

.recurring-menu-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.recurring-item:hover .recurring-menu-btn { opacity: 1; }
.recurring-menu-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ── Context menu ──────────────────────────────────────────────────── */
.recurring-context-menu {
    position: absolute;
    z-index: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft-lg);
    min-width: 160px;
    overflow: hidden;
}

.recurring-context-menu button {
    display: block;
    width: 100%;
    padding: 9px 14px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s;
}

.recurring-context-menu button:hover { background: var(--bg-card-hover); }
.recurring-context-menu button.danger { color: var(--accent-red); }

/* ── Modal ─────────────────────────────────────────────────────────── */
.recurring-modal-panel {
    max-width: 460px;
    width: 92%;
}

.recurring-modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    max-height: 70vh;
}

.recurring-modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recurring-modal-body label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.recurring-modal-body input[type="text"],
.recurring-modal-body input[type="number"],
.recurring-modal-body textarea,
.recurring-modal-body select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.recurring-modal-body input:focus,
.recurring-modal-body textarea:focus,
.recurring-modal-body select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.recurring-type-group {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px !important;
    font-weight: 400 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-primary) !important;
    cursor: pointer;
}

.radio-label input[type="radio"] { cursor: pointer; accent-color: var(--accent-blue); }

.recurring-labels-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.recurring-labels-picker .filter-chip {
    width: auto;
    margin-bottom: 0;
}

.recurring-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ── History ───────────────────────────────────────────────────────── */
.recurring-history-body {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 50vh;
    overflow-y: auto;
}

.recurring-history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    font-size: 13px;
}

.recurring-history-period { font-weight: 600; color: var(--text-primary); }
.recurring-history-time   { font-size: 12px; color: var(--text-secondary); }
.recurring-history-loading,
.recurring-history-empty  { padding: 20px; color: var(--text-secondary); text-align: center; }

/* Mobile: recurring tab */
@media (max-width: 768px) {
    #recurring-column { flex: 1 1 auto; min-width: 0; max-width: 100%; width: 100%; }
}

/* Pénzes munkák kiemelése */
.card.card-has-business {
    border-left: 3px solid #d4a017;
}
.label-badge.label-category-business {
    outline: 1px solid #d4a017;
    outline-offset: 1px;
}
