/* ── App layout ───────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    font-size: 14px;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── App bar ──────────────────────────────────────────────────────────────── */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 44px;
    background: var(--pico-background-color, #fff);
    border-bottom: 1px solid var(--pico-card-border-color, #d0d7de);
    flex-shrink: 0;
}

.app-bar__title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.app-bar button {
    margin: 0;
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
}

/* ── Content area ─────────────────────────────────────────────────────────── */
#app {
    flex: 1;
    padding: 1rem 1.25rem 2rem;
    max-width: 1400px;
    width: 100%;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--pico-muted-color, #6c757d);
    font-size: 0.875rem;
}

/* ── Group card ───────────────────────────────────────────────────────────── */
.group-card {
    margin-bottom: 0.875rem;
    border: 1.5px solid var(--pico-primary);
    padding: 0;
}

/* Override Pico's article > header sectioning style */
.group-card>header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.4rem 0.75rem;
}

.group-card>header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    word-break: break-word;
    line-height: 1.3;
}

.group-actions {
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* Left side of group header: toggle + title */
.group-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
    padding-top: 0.1rem;
}

button.group-toggle {
    flex-shrink: 0;
    margin: 0;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1;
}

/* Group card footer — add-task button */
.group-card>footer {
    margin: 0;
    padding: 0.35rem 0.75rem 0.5rem;
}

.group-card>footer button {
    margin: 0;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
}

/* ── Task list ────────────────────────────────────────────────────────────── */
.task-list {
    display: flex;
    flex-direction: column;
    margin-top: 0;
    margin-bottom: 0;
}

/* ── Task row (horizontal grid) ──────────────────────────────────────────── */
.task-row {
    display: grid;
    grid-template-columns: minmax(90px, 1.4fr) 3rem minmax(100px, 3fr) 5.5rem auto auto;
    gap: 0.3rem 0.6rem;
    align-items: start;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid var(--pico-card-border-color, #d0d7de);
}

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

.task-cell {
    min-width: 0;
}

.task-name-cell {
    font-weight: 600;
    font-size: 0.875rem;
    word-break: break-word;
    padding-top: 0.3rem;
}

.task-link-cell {
    font-size: 0.8rem;
    padding-top: 0.3rem;
}

.task-desc-cell {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--pico-muted-color, #6c757d);
    font-size: 0.8rem;
    line-height: 1.45;
    padding-top: 0.3rem;
}

.task-time-cell {
    display: flex;
    align-items: flex-start;
    padding-top: 0.2rem;
}

.task-timer-cell,
.task-actions-cell {
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    flex-wrap: nowrap;
}

/* ── Time display ─────────────────────────────────────────────────────────── */
.time-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--pico-color, #333);
    white-space: nowrap;
}

/* Start timer — uses default Pico primary */
button.timer-start {
    margin: 0;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Stop timer — red */
/* Delete buttons — red icon */
button[data-action="delete-group"],
button[data-action="delete-task"] {
    --pico-color: #c0392b;
    --pico-border-color: #c0392b;
    --pico-color-hover: #a93226;
    --pico-border-color-hover: #a93226;
}

button.timer-stop {
    margin: 0;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    --pico-background-color: #c0392b;
    --pico-border-color: #c0392b;
    --pico-color: #fff;
    --pico-background-color-hover: #a93226;
    --pico-border-color-hover: #a93226;
}

/* ── Small button modifier ────────────────────────────────────────────────── */
button.small {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}

/* ── Group form (edit/create) ─────────────────────────────────────────────── */
.group-card--edit {
    border-color: var(--pico-primary, #1095c1);
    border-width: 2px;
    padding: 0.875rem 1rem;
}

.group-card--edit h3 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* ── Task form (edit/create) ──────────────────────────────────────────────── */
.task-form {
    background: var(--pico-card-background-color, #fff);
    border: 2px solid var(--pico-primary, #1095c1);
    border-radius: var(--pico-border-radius, 0.375rem);
    padding: 0.875rem 1rem;
}

.task-form h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Tighten Pico label + input spacing inside forms */
.task-form label,
.group-card--edit label {
    margin-bottom: 0.6rem;
}

/* ── Form action row ──────────────────────────────────────────────────────── */
.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.form-actions button {
    margin: 0;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
}

/* ── Material Icons font ──────────────────────────────────────────────────── */
@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/MaterialIcons-Regular-20260501.woff2') format('woff2');
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
}

/* Buttons that mix icon + text */
button:has(.material-icons) {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Icon-only buttons: tighter square-ish padding */
button.btn-icon {
    padding: 0.2rem 0.4rem;
}

button.small .material-icons {
    font-size: 16px;
}