:root {
    --red: #e83646;
    --red-dark: #c92a38;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e8edf3;
    --bg: #f4f6f9;
    --card: #ffffff;
    font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { overflow: hidden; }
#app, .screen { height: 100%; }
.screen { display: flex; flex-direction: column; }
.screen[hidden] { display: none !important; }

.brand { text-align: center; padding: 0 0 8px; }
.brand-hero {
    background: linear-gradient(90deg, #e83646 0%, #ef4353 50%, #d92f3f 100%);
    padding: 16px 20px 14px;
    margin-bottom: 16px;
}
.brand-logo {
    display: block;
    height: 40px;
    width: auto;
    margin: 0 auto;
}
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    margin: 12px; padding: 16px; display: grid; gap: 10px;
}
label { display: grid; gap: 5px; font-size: 11px; font-weight: 700; color: var(--muted); }
input {
    width: 100%; border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 11px; font-size: 14px; color: var(--ink); background: #fff;
}
input:focus { outline: 2px solid #fecdd3; border-color: var(--red); }
details { font-size: 12px; color: var(--muted); }
details summary { cursor: pointer; margin-bottom: 8px; }

.btn-primary, .icon-btn, .tool, .act {
    border: 0; cursor: pointer; font-weight: 700;
}
.act {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--red);
    color: #fff;
    flex-shrink: 0;
}
.act svg { width: 16px; height: 16px; display: block; }
.act:disabled { opacity: 0.4; }
.btn-primary {
    background: var(--red); color: #fff; border-radius: 12px; padding: 11px 14px; font-size: 14px;
}
.btn-primary:disabled, .act:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { background: var(--red-dark); }

.error { color: var(--red); font-size: 12px; margin: 0; }
.error[hidden] { display: none !important; }

.chrono-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 14px 12px 12px;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: #fff;
}
.chrono-bar.running { background: linear-gradient(180deg, #e83646 0%, #c92a38 100%); }
.timer-status {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
}
.timer-display {
    margin: 2px 0 0;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
}
.timer-brief {
    margin: 4px 0 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.86);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tools {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.tool {
    border: 0;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 14px;
    padding: 10px 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.tool svg { width: 18px; height: 18px; display: block; }
.tool span { font-size: 10px; font-weight: 700; letter-spacing: 0.01em; }
.tool:hover:not(:disabled) { background: rgba(255,255,255,0.2); }
.tool:active:not(:disabled) { transform: scale(0.96); }
.tool:disabled { opacity: 0.32; cursor: not-allowed; }
.tool.is-primary,
.tool.is-open {
    background: #fff;
    color: var(--red);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.manual-panel {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px 12px;
}
.manual-panel[hidden] { display: none !important; }
.manual-panel p { margin: 0 0 8px; font-size: 11px; color: var(--muted); }
.manual-row { display: flex; gap: 8px; align-items: end; }
.manual-row label { flex: 1; margin: 0; }
.manual-row .btn-primary { padding: 9px 12px; font-size: 12px; }

.list-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 8px;
}
.brief-search {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 10px;
}
.brief-search svg {
    width: 14px;
    height: 14px;
    color: var(--muted);
    flex-shrink: 0;
}
.brief-search input {
    border: 0;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
}
.brief-search input:focus {
    outline: none;
    border-color: transparent;
}
.brief-search:focus-within {
    border-color: #fda4af;
    box-shadow: 0 0 0 3px #fff1f2;
}
.icon-btn {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 14px;
    color: var(--ink);
    flex-shrink: 0;
}

.brief-list {
    flex: 1;
    overflow: auto;
    padding: 4px 10px 12px;
    display: grid;
    gap: 8px;
    align-content: start;
}

.brief-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.brief-item:hover {
    border-color: #dbe3ee;
}
.brief-item.selected {
    border-color: #fda4af;
    box-shadow: 0 0 0 1px #fecdd3;
}
.brief-item.open { align-items: start; }
.brief-item.running {
    border-color: #fda4af;
    background: #fff7f8;
}
.brief-body { min-width: 0; }
.brief-top {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.brief-item h3 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.3;
}
.brief-toggle {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: 0;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
}
.brief-toggle svg {
    width: 14px;
    height: 14px;
    display: block;
    transition: transform 0.15s ease;
}
.brief-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.brief-toggle:hover { background: #e2e8f0; color: var(--ink); }
.brief-meta {
    margin: 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}
.brief-meta .brief-time {
    font-style: normal;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.brief-more {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}
.brief-more[hidden] { display: none !important; }
.brief-details {
    margin: 0;
    display: grid;
    gap: 3px;
}
.brief-details div {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 6px;
    font-size: 11px;
    line-height: 1.35;
}
.brief-details dt {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}
.brief-details dd {
    margin: 0;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sessions {
    margin: 10px 0 0;
    display: grid;
    gap: 10px;
}
.session-day header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--ink);
}
.session-day-total {
    font-style: normal;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-weight: 700;
}
.session-day ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 3px;
}
.session-day li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.session-day li.is-running { color: var(--red); font-weight: 700; }
.session-day li em,
.session-day-total {
    font-style: normal;
    font-weight: 700;
    color: var(--ink);
}

.empty, .loading {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 28px 10px;
}
