/* ============================================================
   Tasker — Design System
   ============================================================ */
:root {
    --bg: #eef1f6;
    --bg-grad-1: #eef2ff;
    --bg-grad-2: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f7f9fc;
    --surface-hover: #eef2f8;
    --border: #e3e8ef;
    --border-strong: #cdd5e1;

    --text: #1f2733;
    --text-muted: #64748b;
    --text-soft: #94a3b8;

    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-soft: #eef2ff;
    --brand-ring: rgba(79, 70, 229, 0.18);

    --danger: #e11d48;
    --danger-hover: #be123c;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.18);

    /* Status palette */
    --st-planned: #6366f1;
    --st-in_progress: #f59e0b;
    --st-done: #10b981;
    --st-scratched: #ec4899;
    --st-cancelled: #94a3b8;
}

/* --- Base & Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(1200px 600px at 100% -10%, var(--bg-grad-1), transparent 60%),
        radial-gradient(1000px 500px at -10% 0%, var(--bg-grad-2), transparent 55%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-hover); }

::selection { background: var(--brand-ring); }
/* --- Layout --- */

app-header {
    display: block;
    width: 100%;
}

.app-header {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-header h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.app-header h1::before {
    content: "";
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), #818cf8);
    box-shadow: var(--shadow-sm);
}
.app-header h1, .app-header h1 a { color: var(--text); }
.app-header h1 a:hover { color: var(--text); }
.header-actions { display: flex; gap: 0.6rem; align-items: center; }
#user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.container {
    max-width: 1140px;
    margin: 1.75rem auto;
    padding: 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}
.panel h2 {
    margin-top: 0;
    margin-bottom: 1.1rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.panel h2::before {
    content: "";
    width: 0.55rem;
    height: 1.15rem;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--brand), #818cf8);
}
.panel h3 {
    margin-top: 0;
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

/* --- Buttons --- */
button {
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1.05rem;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, color .15s;
}
button:active { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }

.btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--text-soft); }
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: var(--shadow-sm);
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

/* --- Forms --- */
label {
    display: block;
    margin-bottom: 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}
input[type="text"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    margin-top: 0.35rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-soft); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}
textarea { resize: vertical; }

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background:
        radial-gradient(900px 500px at 80% -10%, #c7d2fe, transparent 60%),
        radial-gradient(700px 500px at 0% 100%, #ddd6fe, transparent 55%),
        linear-gradient(135deg, #eef2ff 0%, #f5f7fb 100%);
}
.login-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 2.75rem 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
}
.login-container h1 {
    margin: 0 0 0.4rem;
    text-align: center;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
    color: var(--text);
}
.login-container form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1.25rem; }
.login-container label { margin-bottom: 0.25rem; }
.login-container button {
    margin-top: 0.85rem;
    padding: 0.75rem;
    font-size: 0.95rem;
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: var(--shadow-sm);
}
.login-container button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

/* --- Task Lists --- */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.task-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem 0.8rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.task-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 4px;
    border-radius: 999px;
    background: var(--border-strong);
}
.task-item[data-status="planned"]::before { background: var(--st-planned); }
.task-item[data-status="in_progress"]::before { background: var(--st-in_progress); }
.task-item[data-status="done"]::before { background: var(--st-done); }
.task-item[data-status="scratched"]::before { background: var(--st-scratched); }
.task-item[data-status="cancelled"]::before { background: var(--st-cancelled); }
.task-item:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.task-item .task-name {
    flex: 1;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-item .task-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.task-item .task-actions-inline { display: flex; gap: 0.25rem; }

/* Type tag */
.type-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    white-space: nowrap;
}

/* Status pill (subtasks / read-only status) */
.status-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
    border: 1px solid transparent;
}
.status-pill[data-status="planned"] { color: var(--st-planned); background: #eef2ff; border-color: #e0e7ff; }
.status-pill[data-status="in_progress"] { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.status-pill[data-status="done"] { color: #047857; background: #d1fae5; border-color: #a7f3d0; }
.status-pill[data-status="scratched"] { color: #be185d; background: #fce7f3; border-color: #fbcfe8; }
.status-pill[data-status="cancelled"] { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }

/* Quick status dropdown on the list */
.quick-status {
    width: auto;
    margin-top: 0;
    padding: 0.4rem 1.9rem 0.4rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.quick-status:hover { border-color: var(--text-soft); }

/* --- Backlog --- */
.backlog-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.backlog-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.backlog-item:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.backlog-item .task-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.backlog-item .task-meta { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

.backlog-item .backlog-handle {
    flex: none;
    font-size: 1rem;
    color: var(--text-soft);
    cursor: grab;
    padding: 0.15rem 0.25rem;
    user-select: none;
    line-height: 1;
}
.backlog-item .backlog-order {
    flex: none;
    width: 1.6rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--brand);
}

.backlog-item.dragging {
    opacity: 0.5;
    border: 2px dashed var(--brand);
    background: var(--brand-soft);
}
.backlog-item.drag-over {
    border-top: 2px solid var(--brand);
    transform: translateY(2px);
}

/* --- Meetings --- */
.meetings-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.meeting-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.85rem;
    background: linear-gradient(0deg, #fbf9ff, #fbf9ff), var(--surface);
    border: 1px solid #ece4fb;
    border-radius: var(--radius);
}
.meeting-item .meeting-time {
    flex: none;
    font-weight: 700;
    color: #6d28d9;
    background: #f3eafe;
    border: 1px solid #e6d9fb;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
}
.meeting-item .task-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.meeting-item .meeting-task-link {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.meeting-item .meeting-task-link:hover {
    color: var(--brand);
    text-decoration: underline;
}
.meeting-item a {
    flex: none;
    padding: 0.35rem 0.7rem !important;
    border-radius: 8px;
    text-decoration: none;
}
.meeting-past {
    opacity: 0.55;
}
.meeting-past .meeting-time,
.meeting-past .task-name {
    text-decoration: line-through;
}
.meeting-ongoing {
    background: #dcfce7;
    border-color: #86efac;
}
.meeting-ongoing .meeting-time {
    color: #15803d;
    background: #bbf7d0;
    border-color: #86efac;
}
.meeting-edit-btn {
    flex: none;
    padding: 0.35rem 0.55rem !important;
    border-radius: 8px;
}

/* --- Task Details Page --- */
#breadcrumbs {
    margin-bottom: 1.1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
#breadcrumbs a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
#breadcrumbs a:hover { background: var(--surface-hover); }

.detail-grid {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr;
    gap: 0.15rem 1.25rem;
    align-items: center;
}
.detail-row { display: contents; }
.detail-row + .detail-row .detail-label,
.detail-row + .detail-row .detail-value { border-top: 1px solid var(--border); }
.detail-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: right;
    padding: 0.55rem 0.5rem 0.55rem 0;
}
.detail-value {
    padding: 0.45rem 0.6rem;
    min-height: 2rem;
    display: flex;
    align-items: center;
    color: var(--text);
    border-radius: 8px;
}
.detail-value.editable {
    cursor: text;
    border: 1px solid transparent;
    position: relative;
}
.detail-value.editable:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
}
.detail-value.editable:hover::after {
    content: "✎";
    position: absolute;
    right: 0.55rem;
    color: var(--text-soft);
    font-size: 0.8rem;
}
.detail-value.editing { padding: 0.2rem; }
.detail-value.editing::after { content: none; }

/* Inline editor */
.inline-input,
.inline-select,
.inline-textarea {
    width: 100%;
    margin-top: 0;
    padding: 0.45rem 0.6rem;
    font-size: inherit;
    font-family: inherit;
    border: 1px solid var(--brand);
    border-radius: 8px;
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring);
}
.inline-textarea { min-height: 4.5rem; resize: vertical; }

.attributes-section {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.task-actions {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* --- Modal --- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.hidden { display: none !important; }
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    animation: fade-in .15s ease;
}
.modal-content {
    position: relative;
    background: var(--surface);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: pop-in .18s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-content h3 { margin-top: 0; font-size: 1.2rem; letter-spacing: -0.01em; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Utilities --- */
.empty-state {
    color: var(--text-soft);
    font-style: italic;
    padding: 1.25rem;
    text-align: center;
    background: var(--surface-muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    margin: 0;
}

/* --- Task Detail page --- */
.task-panel { padding: 1.5rem 1.75rem; }

.task-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}
.parent-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    box-shadow: var(--shadow-sm);
}
.parent-link:hover { background: var(--surface-hover); color: var(--text); }
.task-topbar-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.task-title-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.1rem;
}
.task-type-icon {
    flex: none;
    width: 2.7rem;
    height: 2.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    border-radius: 14px;
    background: var(--brand-soft);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: box-shadow .15s;
}
.task-type-icon:hover { box-shadow: 0 0 0 3px var(--brand-ring); }
.task-type-icon.editing {
    width: auto;
    min-width: 9rem;
    height: auto;
    padding: 0;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.task-title {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.15rem 0.4rem;
    cursor: text;
}
.task-title::before { content: none; }       /* override panel h2 accent bar */
.task-title:hover { background: var(--surface-muted); border-color: var(--border-strong); }

/* Control bar: status + backlog */
.control-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1.35rem;
    padding-bottom: 1.35rem;
    border-bottom: 1px solid var(--border);
}
.status-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.status-choice {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-muted);
}
.status-choice:hover { border-color: var(--text-soft); color: var(--text); }
.status-choice.active { color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.status-choice.active[data-status="planned"] { background: var(--st-planned); }
.status-choice.active[data-status="in_progress"] { background: var(--st-in_progress); }
.status-choice.active[data-status="done"] { background: var(--st-done); }
.status-choice.active[data-status="scratched"] { background: var(--st-scratched); }
.status-choice.active[data-status="cancelled"] { background: var(--st-cancelled); }

.backlog-toggle { flex-shrink: 0; white-space: nowrap; }
.backlog-toggle.in-backlog { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.backlog-toggle.in-backlog:hover { background: #e0e7ff; }

/* Generic labelled section */
.task-section { margin-bottom: 1.25rem; }
.field-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    margin-bottom: 0.4rem;
}
.task-description {
    min-height: 2.6rem;
    padding: 0.65rem 0.8rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: pre-wrap;
    cursor: text;
}
.task-description:hover { background: var(--surface-hover); border-color: var(--border-strong); }

/* Stats: multi-column on wide screens */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.stat {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.7rem 0.9rem;
}
.stat-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    margin-bottom: 0.3rem;
}
.stat-value { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.stat-value.editable {
    cursor: text;
    border-radius: 6px;
    padding: 0.05rem 0.25rem;
    border: 1px solid transparent;
    display: inline-block;
}
.stat-value.editable:hover { background: var(--surface-hover); border-color: var(--border-strong); }

/* Two-column detail grid for wide screens */
.detail-grid.two-col { grid-template-columns: auto minmax(0, 1fr); }
@media (min-width: 780px) {
    .detail-grid.two-col { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); }
}

/* Collapsible "more details" */
.more-details {
    margin-top: 1.5rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
}
.more-details > summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary::before {
    content: "\25B8";
    display: inline-block;
    transition: transform .15s;
}
.more-details[open] > summary::before { transform: rotate(90deg); }
.more-details > summary:hover { color: var(--text); }
.more-details .detail-grid { margin-top: 0.9rem; }
.detail-value.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* --- Task Tree --- */
.task-tree { display: flex; flex-direction: column; gap: 0; }

.tree-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    position: relative;
}
.tree-node:hover { background: var(--surface-hover); }

.tree-toggle {
    width: 1.5rem; height: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.tree-toggle:hover { background: var(--surface-muted); color: var(--text); }
.tree-toggle.empty { visibility: hidden; pointer-events: none; }

.tree-indent { flex-shrink: 0; }

.tree-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.tree-name {
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.tree-name:hover { color: var(--brand); text-decoration: underline; }

.tree-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.tree-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.tree-badge--jira     { background: #dbeafe; color: #1d4ed8; }
.tree-badge--work     { background: #dcfce7; color: #15803d; }
.tree-badge--meeting  { background: #fae8ff; color: #a21caf; }
.tree-badge--personal { background: #fef9c3; color: #a16207; }

.tree-status { font-size: 0.75rem; color: var(--text-muted); }
.tree-status--in_progress { color: var(--brand); font-weight: 600; }
.tree-status--done       { color: #16a34a; }

.tree-remaining {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.tree-backlog-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 500;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.tree-backlog-btn--add {
    background: var(--surface-muted);
    color: var(--text-muted);
    border-color: var(--border);
}
.tree-backlog-btn--add:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
}
.tree-backlog-btn--remove {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
}
.tree-backlog-btn--remove:hover {
    background: var(--brand);
    color: #fff;
}

.tree-children { display: flex; flex-direction: column; padding-left: 0.75rem; }
.tree-children.collapsed { display: none; }

.header-nav { display: flex; gap: 1rem; align-items: center; margin-right: auto; margin-left: 1.5rem; }
.header-nav a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.header-nav a:hover { color: var(--text); text-decoration: none; }
.header-nav a.active { color: var(--brand); border-bottom-color: var(--brand); }

.header-interval-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Phase colors */
.badge-focus {
    background: #e0e7ff;
    color: #312e81;
}
.badge-break {
    background: #dcfce7;
    color: #14532d;
}
.badge-paused_focus {
    background: #fef3c7;
    color: #78350f;
}
.badge-completed {
    background: #f3f4f6;
    color: #374151;
}

/* Meeting alert badge */
.header-meeting-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.badge-meeting-soon {
    background: #fef3c7;
    color: #92400e;
}
.badge-meeting-warning {
    background: #fee2e2;
    color: #991b1b;
}
.badge-meeting-critical,
.badge-meeting-overdue {
    background: #fecaca;
    color: #7f1d1d;
}
@keyframes blink {
    0%, 66% { opacity: 1; }
    67%, 100% { opacity: 0.25; }
}
.badge-blink {
    animation: blink 1.5s infinite;
}

/* --- Focuser / Timer --- */
.focus-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.interval-config-hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }

.timer-phase {
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}
.timer-phase--focus    { color: var(--brand); }
.timer-phase--break    { color: #16a34a; }
.timer-phase--paused   { color: #d97706; }
.timer-phase--paused-focus { color: #d97706; }
.timer-phase--paused-break { color: #d97706; }
.timer-phase--finished { color: var(--text-muted); }

.timer-display {
    text-align: center;
    font-size: 4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin: 0.5rem 0;
    color: var(--text);
}

.timer-info {
    text-align: center;
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.timer-end-time {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.85;
}

.timer-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.timer-bar-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 999px;
    width: 0%;
    transition: width 1s linear;
}
.timer-bg--break .timer-bar-fill { background: #16a34a; }
.timer-bg--paused .timer-bar-fill { background: #d97706; }
.timer-bg--finished .timer-bar-fill { background: var(--text-muted); }

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.timer-bg--focus    { border-left: 4px solid var(--brand); }
.timer-bg--break    { border-left: 4px solid #16a34a; }
.timer-bg--paused   { border-left: 4px solid #d97706; }
.timer-bg--finished { border-left: 4px solid var(--text-muted); }

#btn-continue {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
#btn-continue:hover {
    background: #15803d;
}

.interval-edit-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.interval-edit-inline label { font-size: 0.8125rem; margin-bottom: 0; }
.interval-edit-inline input,
.interval-edit-inline textarea { margin-top: 0.15rem; }
.interval-edit-inline button { grid-column: 2; justify-self: end; margin-top: 0.5rem; }

/* --- Simplified fullscreen focus view --- */
.simple-focus {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #0f172a;
    color: #f8fafc;
    transition: background 0.5s ease;
}
.simple-bg--focus { background: radial-gradient(circle at 50% 35%, rgba(129, 140, 248, 0.18), #0f172a 65%); }
.simple-bg--break { background: radial-gradient(circle at 50% 35%, rgba(74, 222, 128, 0.16), #0f172a 65%); }
.simple-bg--paused-focus { background: radial-gradient(circle at 50% 35%, rgba(251, 191, 36, 0.16), #0f172a 65%); }
.simple-bg--finished { background: radial-gradient(circle at 50% 35%, rgba(148, 163, 184, 0.12), #0f172a 65%); }

.simple-panel {
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.simple-phase {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
    color: #94a3b8;
}
.simple-phase--focus { color: #818cf8; }
.simple-phase--break { color: #4ade80; }
.simple-phase--paused-focus,
.simple-phase--paused-break { color: #fbbf24; }
.simple-phase--finished { color: #94a3b8; }

.simple-timer {
    font-size: 8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin: 0.5rem 0 1.5rem;
    color: #f8fafc;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.simple-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.5rem;
    min-height: 2.5rem;
    word-break: break-word;
}

.simple-end-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 2rem;
}

.simple-bar {
    width: 100%;
    max-width: 700px;
    height: 14px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
    margin: 0 auto 2rem;
}

.simple-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 1s linear;
    background: #818cf8;
}
.simple-bar-fill--focus { background: #818cf8; }
.simple-bar-fill--break { background: #4ade80; }
.simple-bar-fill--paused-focus,
.simple-bar-fill--paused-break { background: #fbbf24; }
.simple-bar-fill--finished { background: #94a3b8; }

.simple-meeting-alert {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.4rem;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: #334155;
    color: #f8fafc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.simple-meeting-alert--soon { background: #fef3c7; color: #92400e; }
.simple-meeting-alert--warning { background: #fee2e2; color: #991b1b; }
.simple-meeting-alert--critical,
.simple-meeting-alert--overdue { background: #fecaca; color: #7f1d1d; }
.simple-meeting-alert--blink {
    animation: blink 1.2s infinite;
}

.simple-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.simple-controls button {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
}

.simple-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.simple-footer a,
.simple-footer button {
    font-size: 0.95rem;
    padding: 0.65rem 1.2rem;
    border-radius: 10px;
}

.simple-no-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #f8fafc;
}
.simple-no-text {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-bottom: 2rem;
}

@media (max-width: 640px) {
    .app-header { padding: 0.7rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .container { margin: 1rem auto; }
    .panel { padding: 1.15rem; border-radius: var(--radius); }
    .detail-grid { grid-template-columns: 1fr; gap: 0; }
    .detail-label { text-align: left; padding-bottom: 0; border-top: none !important; }
    .detail-row + .detail-row .detail-value { border-top: none; }
    .detail-row { padding: 0.35rem 0; border-bottom: 1px solid var(--border); display: block; }
    .task-item, .backlog-item, .meeting-item { flex-wrap: wrap; }
    .timer-display { font-size: 2.5rem; }
    .focus-row { grid-template-columns: 1fr; }
    .interval-edit-inline { grid-template-columns: 1fr; }
    .interval-edit-inline button { grid-column: 1; }

    .simple-focus { padding: 1.25rem; }
    .simple-timer { font-size: 4.5rem; }
    .simple-phase { font-size: 1.1rem; }
    .simple-title { font-size: 1.25rem; }
    .simple-meeting-alert { font-size: 0.95rem; padding: 0.6rem 1rem; }
    .simple-controls button,
    .simple-footer a,
    .simple-footer button { font-size: 0.9rem; padding: 0.55rem 1rem; }
}

/* --- Meeting Action Modal --- */
.meeting-modal-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.meeting-modal-shift-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.meeting-modal-picker-wrap {
    position: relative;
    display: inline-block;
}
.meeting-modal-picker-btn {
    pointer-events: none;
}
.meeting-modal-picker-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.meeting-modal-target {
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

/* --- PAT / API Tokens --- */
.hint {
    font-size: 0.9375rem;
    color: var(--text-soft);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.token-result {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.token-result h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
}
.token-box {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: var(--bg);
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    word-break: break-all;
}
.token-box code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    flex: 1;
}
.warning {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.75rem;
}
.pat-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.pat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.pat-info strong {
    font-weight: 600;
}
.pat-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* --- Intervals --- */
.intervals-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.interval-item {
    display: grid;
    grid-template-columns: 2rem 1fr 2fr 5rem;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
    cursor: pointer;
}
.interval-item:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.interval-number {
    width: 1.6rem;
    height: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.interval-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.interval-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.interval-duration {
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Interval modal */
#interval-details .detail-row.full-width {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
#interval-details .detail-row.full-width .detail-label {
    text-align: left;
    padding: 0.55rem 0 0 0;
}
#interval-details .detail-row.full-width .detail-value {
    padding: 0.45rem 0;
    width: 100%;
    min-height: 4rem;
    align-items: flex-start;
    white-space: pre-wrap;
}
