:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #0f766e;
    --accent-soft: #e6fffb;
    --danger: #b91c1c;
    --border: #d1d5db;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

h1, h2, h3 {
    margin-top: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.app-shell.auth-shell {
    grid-template-columns: 1fr;
}

.sidebar {
    background: #0f172a;
    color: #f8fafc;
    padding: 1.5rem 1rem;
}

.sidebar h1 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar nav a {
    color: #e2e8f0;
    padding: 0.45rem 0.5rem;
    border-radius: 0.4rem;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: #1e293b;
    text-decoration: none;
}

.sidebar nav a.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.logout-form {
    margin-top: 1.2rem;
}

.link-button {
    background: transparent;
    border: 0;
    color: #f8fafc;
    cursor: pointer;
    padding: 0;
}

.content {
    padding: 1.5rem;
}

.auth-page {
    max-width: 100%;
    min-height: calc(100vh - 3rem);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 5px 20px rgba(15, 23, 42, 0.06);
}

.auth-card {
    width: min(420px, 100%);
    margin: 0 auto;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-card .stack button[type="submit"] {
    width: fit-content;
    align-self: center;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.55rem 0.65rem;
    margin-top: 0.25rem;
}

button,
.button-link {
    border: 0;
    background: var(--accent);
    color: #fff;
    padding: 0.55rem 0.8rem;
    border-radius: 0.4rem;
    cursor: pointer;
    display: inline-block;
}

.button-link:hover,
button:hover {
    filter: brightness(1.05);
    text-decoration: none;
}

.button-secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: #111827;
    padding: 0.55rem 0.8rem;
    border-radius: 0.4rem;
    display: inline-block;
}

.button-secondary:hover {
    text-decoration: none;
    background: #f8fafc;
}

.actions-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.list-header.compact {
    margin-bottom: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

th,
td {
    text-align: left;
    padding: 0.65rem;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f8fafc;
}

.search-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-row input[type="text"] {
    max-width: 340px;
}

.search-row select {
    max-width: 240px;
}

.flash {
    margin-bottom: 0.8rem;
    border-radius: 0.4rem;
    padding: 0.6rem 0.8rem;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-paused {
    background: #fef3c7;
    color: #92400e;
}

.badge-ended {
    background: #e5e7eb;
    color: #374151;
}

.badge-status {
    background: #e0f2fe;
    color: #0c4a6e;
}

.detail-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0.55rem 1rem;
}

.detail-grid dt {
    font-weight: 600;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.summary-grid {
    margin-bottom: 1rem;
}

.dashboard-2col {
    grid-template-columns: 1fr 1fr;
}

.big-number {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.simple-list {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 0.8rem;
}

.checkbox-label {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.inline-filters {
    display: flex;
    gap: 0.4rem;
}

.inline-filters a {
    border: 1px solid var(--border);
    color: #111827;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    text-decoration: none;
}

.inline-filters a.active-pill {
    background: var(--accent-soft);
    border-color: #5eead4;
}

.kanban-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(210px, 1fr));
    gap: 0.9rem;
    align-items: flex-start;
    overflow-x: auto;
}

.kanban-column {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.7rem;
    min-height: 300px;
}

.kanban-column h3 {
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
}

.kanban-card {
    margin-bottom: 0.6rem;
}

.kanban-card h4 {
    margin: 0 0 0.3rem;
}

.small-gap {
    gap: 0.45rem;
}

.danger-zone {
    margin-top: 1rem;
}

button.danger {
    background: var(--danger);
}

.small-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
}

.mt-24 {
    margin-top: 24px;
}

.nested-card {
    background: #f8fafc;
    box-shadow: none;
}

.totals-inline {
    width: 340px;
    margin-top: 0.8rem;
    margin-left: auto;
    border-collapse: collapse;
}

.totals-inline td {
    border: 1px solid #e5e7eb;
    padding: 0.45rem 0.6rem;
}

.totals-inline td:last-child {
    text-align: right;
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.todo-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.6rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.6rem;
    align-items: center;
}

.todo-item.done span {
    text-decoration: line-through;
    color: #6b7280;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: block;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}
