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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────── */
header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    height: 56px;
    gap: 10px;
}
header svg { color: #e01e5a; flex-shrink: 0; }
header h1 { font-size: 1.15rem; font-weight: 700; color: #1a1a2e; }

/* ── Layout ──────────────────────────────────────── */
main { padding: 32px 24px 64px; }
.container { max-width: 920px; margin: 0 auto; }

/* ── Cards ───────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
}

/* ── Step header ─────────────────────────────────── */
.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e01e5a;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    flex: 1;
}
.step-meta { font-size: 0.85rem; color: #888; font-weight: 400; }
.step-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Forms ───────────────────────────────────────── */
.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}
label.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .03em;
}
input[type="number"],
input[type="time"],
input[type="text"],
select {
    padding: 8px 11px;
    border: 1px solid #d0d0d0;
    border-radius: 7px;
    font-size: 0.93rem;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
input:focus, select:focus {
    border-color: #e01e5a;
    box-shadow: 0 0 0 3px rgba(224,30,90,.12);
}
select { cursor: pointer; }

/* ── Date checkboxes ─────────────────────────────── */
.dates-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.date-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    user-select: none;
    transition: border-color .15s, background .15s;
    color: #555;
}
.date-chip input[type="checkbox"] { accent-color: #e01e5a; }
.date-chip.active { border-color: #e01e5a; background: #fff5f8; color: #1a1a2e; }

/* ── Project cards ───────────────────────────────── */
.hint { font-size: 0.83rem; color: #999; margin-bottom: 18px; }
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}
.project-card {
    border: 1px solid #e8e8e8;
    border-radius: 9px;
    padding: 16px;
    background: #fafafa;
}
.project-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #1a1a2e;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ececec;
}
.duration-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 10px;
}
.duration-row .sep { padding-bottom: 9px; color: #bbb; font-size: 1rem; }
.duration-row input[type="number"] { width: 72px; }
.project-card label.field { margin-top: 10px; }
.project-card label.field input[type="text"] { width: 100%; }

/* ── Actions ─────────────────────────────────────── */
.actions {
    display: flex;
    justify-content: center;
    margin: 12px 0 24px;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1.5px solid transparent;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    line-height: 1.4;
}
.btn-primary   { background: #e01e5a; color: #fff; }
.btn-primary:hover  { background: #c4174e; }
.btn-secondary { background: #f2f2f2; color: #333; border-color: #ddd; }
.btn-secondary:hover { background: #e8e8e8; }
.btn-success   { background: #2ea44f; color: #fff; }
.btn-success:hover  { background: #268a41; }
.btn-lg { padding: 12px 32px; font-size: 1rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Preview table ───────────────────────────────── */
.table-wrapper { overflow-x: auto; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
    text-align: left;
    padding: 9px 12px;
    background: #f7f7f8;
    border-bottom: 2px solid #e8e8e8;
    font-size: 0.75rem;
    font-weight: 700;
    color: #777;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid #f2f2f2; }
tbody tr:hover td { background: #fafafa; }
tbody tr.new-date td { border-top: 2px solid #ececec; }
.td-date { font-weight: 700; color: #333; white-space: nowrap; }
.td-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.83rem; color: #555; }
.td-dur  { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.83rem; font-weight: 600; }

/* ── Results ─────────────────────────────────────── */
.results-summary { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.count-ok  { color: #2ea44f; }
.count-err { color: #e01e5a; margin-left: 14px; }
.results-list { display: flex; flex-direction: column; gap: 5px; }
.result-row {
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.83rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.result-row.ok  { background: #f0fff5; color: #1a6b38; }
.result-row.err { background: #fff0f3; color: #b01844; }

/* ── Loading overlay ─────────────────────────────── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 500;
    align-items: center;
    justify-content: center;
}
.overlay.show { display: flex; }
.overlay-box {
    background: #fff;
    padding: 24px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    display: flex;
    align-items: center;
    gap: 12px;
}
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top-color: #e01e5a;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ────────────────────────────────────────── */
.hidden { display: none !important; }

@media (max-width: 600px) {
    main { padding: 16px 12px 48px; }
    .card { padding: 18px; }
    .projects-grid { grid-template-columns: 1fr; }
}
