:root {
    color-scheme: light dark;
    --bg: var(--tg-theme-bg-color, #f7f8f3);
    --surface: var(--tg-theme-secondary-bg-color, #ffffff);
    --text: var(--tg-theme-text-color, #181b1f);
    --muted: var(--tg-theme-hint-color, #66706a);
    --accent: var(--tg-theme-button-color, #206a5d);
    --accent-text: var(--tg-theme-button-text-color, #ffffff);
    --line: rgba(24, 27, 31, 0.12);
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100svh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

.app-shell {
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 18px 16px 28px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0 18px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.05;
    font-weight: 800;
}

h2 {
    font-size: 18px;
    line-height: 1.2;
}

.sync-state {
    min-width: 72px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.sync-state.online {
    border-color: color-mix(in srgb, var(--accent), transparent 65%);
    color: var(--accent);
}

.login-pane {
    display: grid;
    gap: 13px;
    padding-top: 12px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 13px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

input:focus {
    border-color: var(--accent);
}

.primary-button,
.ghost-button {
    height: 46px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.primary-button {
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 800;
}

.ghost-button {
    height: 36px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 700;
}

.error-text {
    min-height: 20px;
    color: var(--danger);
    font-size: 13px;
}

.workspace {
    display: grid;
    gap: 22px;
    animation: rise 220ms ease-out both;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.metrics div {
    min-height: 76px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 12px;
    background: var(--surface);
}

.metrics strong {
    font-size: 25px;
    line-height: 1;
}

.metrics span {
    color: var(--muted);
    font-size: 12px;
}

.task-section {
    display: grid;
    gap: 12px;
}

.section-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.task-list {
    display: grid;
    gap: 8px;
}

.task-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    min-height: 74px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    transition: transform 160ms ease, border-color 160ms ease;
}

.task-row:active {
    transform: scale(0.99);
}

.task-title {
    font-weight: 800;
}

.task-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    max-width: 112px;
    padding: 6px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent), transparent 88%);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    white-space: normal;
}

.empty {
    padding: 28px 0;
    color: var(--muted);
    text-align: center;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
