:root {
    --bg: #eef2f5;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9e0e7;
    --primary: #1f6f78;
    --primary-dark: #164f56;
    --accent: #b3532f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    background: #14252d;
    color: #fff;
    padding: 24px 18px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 34px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    font-weight: 800;
}

.brand span {
    display: block;
    color: #b7c4cc;
    font-size: 13px;
    margin-top: 2px;
}

nav {
    display: grid;
    gap: 8px;
}

nav a {
    color: #dce6eb;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 7px;
}

nav a.active,
nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.main {
    padding: 24px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0 0 4px;
    font-size: 26px;
}

.topbar p,
.muted {
    margin: 0;
    color: var(--muted);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.metrics article,
.panel,
.auth-card,
.flash {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 37, 45, 0.06);
}

.metrics article {
    padding: 18px;
}

.metrics span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.metrics strong {
    font-size: 31px;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.two {
    grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
}

.panel,
.auth-card {
    padding: 20px;
}

.panel h2,
.auth-card h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

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

.panel-head.split {
    align-items: flex-start;
}

.panel-head a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-card {
    max-width: 440px;
    margin: 60px auto;
}

.auth-note {
    margin: 14px 0 0;
}

.auth-note a {
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: none;
}

.auth-note a:hover {
    text-decoration: underline;
}

.form {
    display: grid;
    gap: 13px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.inline-check input {
    width: auto;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    font-size: 13px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #c9d3dc;
    border-radius: 7px;
    padding: 10px 11px;
    font: inherit;
    background: #fff;
}

.link-input {
    min-width: 250px;
    font-size: 12px;
}

textarea {
    resize: vertical;
}

.button {
    border: 0;
    border-radius: 7px;
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}

.button:hover {
    background: var(--primary-dark);
}

.button.secondary {
    background: #fff;
    color: var(--primary-dark);
    border: 1px solid var(--line);
}

.button.danger {
    color: #b91c1c;
}

.button.small {
    padding: 7px 10px;
    font-size: 13px;
}

.footer {
    margin-top: auto;
    padding-top: 26px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-size: 13px;
}

.footer form {
    margin: 0;
}

.footer-link {
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    text-align: left;
    padding: 11px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.badge {
    display: inline-block;
    border-radius: 999px;
    background: #e6f3f4;
    color: var(--primary-dark);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 800;
}

.news {
    border-top: 1px solid var(--line);
    padding: 14px 0;
}

.news:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.news h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.news p {
    margin: 0 0 8px;
    color: #334155;
}

.task-page {
    max-width: 980px;
}

.launcher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    width: min(960px, calc(100vw - 48px));
}

.launcher-card {
    display: grid;
    gap: 6px;
    min-height: 132px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(20, 37, 45, 0.08);
    align-content: end;
}

.launcher-card strong {
    font-size: 18px;
}

.launcher-card span {
    color: var(--muted);
    font-size: 13px;
}

.launcher-card:hover {
    border-color: var(--primary);
    box-shadow: 0 14px 28px rgba(16, 89, 99, 0.12);
}

.launcher-page {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #f4f7f9 0%, #eef2f5 100%);
}

.launcher-shell {
    display: grid;
    gap: 28px;
    justify-items: center;
    padding: 32px 24px;
}

.launcher-header {
    text-align: center;
}

.launcher-header h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: 0;
}

.launcher-header p {
    margin: 8px 0 0;
    color: var(--muted);
}

.reminder-form {
    display: grid;
    gap: 12px;
}

.repeat-group {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.weekday-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.weekday-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.weekday-item input {
    width: auto;
}

.reminder-title {
    font-size: 16px;
    line-height: 1.3;
}

.compact-details summary {
    cursor: pointer;
    list-style: none;
}

.compact-details summary::-webkit-details-marker {
    display: none;
}

.compact-details summary::after {
    content: "Rozbalit";
    display: block;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    margin-top: 4px;
}

.compact-details[open] summary::after {
    content: "Sbalit";
}

.compact-details p {
    margin: 8px 0 0;
    color: #334155;
    line-height: 1.45;
}

.reminder-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    margin: 0;
}

tr.overdue,
.task-row.overdue {
    background: #fff2f2;
    border-color: #f0b8b8;
}

tr.inactive,
.inactive {
    opacity: 0.72;
}

.page-headline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-headline h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.icon-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--primary-dark);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.share-actions,
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.share-actions.bottom {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    align-items: flex-start;
}

.inline-share {
    display: inline-flex;
    position: relative;
}

.table-actions {
    margin: 0;
}

.task-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0 8px;
    align-items: center;
}

.add-task-details,
.sort-details {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.add-task-details summary,
.sort-details summary {
    list-style: none;
    display: inline-block;
}

.add-task-details summary::-webkit-details-marker,
.sort-details summary::-webkit-details-marker {
    display: none;
}

.task-form {
    display: grid;
    gap: 12px;
    min-width: min(640px, calc(100vw - 48px));
    margin-top: 12px;
    padding: 14px;
    background: #f7fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    position: absolute;
    z-index: 4;
    box-shadow: 0 12px 30px rgba(20, 37, 45, 0.14);
}

.sort-form {
    display: grid;
    gap: 6px;
    min-width: 220px;
    margin-top: 12px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 37, 45, 0.14);
}

.sort-form button {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 9px;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
}

.sort-form button.active,
.sort-form button:hover {
    background: #e6f3f4;
    color: var(--primary-dark);
}

.inline-add,
.rename-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.rename-details {
    position: relative;
}

.rename-details summary,
.share-details summary {
    list-style: none;
    display: inline-block;
}

.rename-details summary::-webkit-details-marker,
.share-details summary::-webkit-details-marker {
    display: none;
}

.rename-details .rename-form {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 3;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 37, 45, 0.14);
}

.share-details.bottom-share {
    margin-top: 18px;
}

.inline-add {
    margin: 16px 0 8px;
}

.rename-form input {
    min-width: 260px;
}

.share-details {
    margin: 10px 0 18px;
}

.share-form {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    align-items: end;
    margin-top: 12px;
    padding: 14px;
    background: #f7fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.share-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.share-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 9px 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.share-item button {
    border: 0;
    background: transparent;
    color: #9a3412;
    cursor: pointer;
    font-weight: 800;
}

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

.task-row {
    display: grid;
    grid-template-columns: 34px 38px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.task-row.readonly {
    grid-template-columns: 38px minmax(0, 1fr);
}

.task-row.overdue {
    background: #fff2f2;
    border-color: #f0b8b8;
}

.overdue-count {
    color: #b91c1c;
    font-weight: 900;
    white-space: nowrap;
    margin-left: 8px;
}

.task-row.dragging {
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgba(31, 111, 120, 0.16);
    opacity: 0.92;
}

.task-row.done .task-title {
    color: var(--muted);
    text-decoration: line-through;
}

.drag-handle {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--muted);
    cursor: grab;
    touch-action: none;
    font-weight: 900;
}

.drag-handle:active {
    cursor: grabbing;
}

.check-button {
    width: 28px;
    height: 28px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    background: #fff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.check-button.static {
    cursor: default;
}

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

.task-title {
    font-weight: 800;
    font-size: 18px;
    line-height: 1.25;
    margin-top: 2px;
}

.task-content p {
    margin: 7px 0 0;
    color: #334155;
    line-height: 1.45;
}

.task-image {
    display: inline-block;
    max-width: min(160px, 100%);
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.task-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: cover;
}

.add-list-details,
.add-reminder-details {
    margin: 12px 0 16px;
}

.add-list-details summary,
.add-reminder-details summary {
    display: inline-block;
    list-style: none;
}

.add-list-details summary::-webkit-details-marker,
.add-reminder-details summary::-webkit-details-marker {
    display: none;
}

.compact-create-form,
.add-reminder-details .reminder-form {
    margin-top: 14px;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto auto;
    gap: 12px;
    align-items: end;
    margin: 12px 0 18px;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
}

.priority-high {
    background: #dc2626;
    color: #fff;
}

.priority-normal {
    background: #facc15;
    color: #553a00;
}

.priority-low {
    background: #2563eb;
    color: #fff;
}

.page-link {
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: none;
}

.page-link:hover {
    text-decoration: underline;
}

.task-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.delete-form {
    margin: 0;
}

.delete-form button,
.edit-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.delete-form button {
    color: #9a3412;
}

.edit-toggle {
    color: var(--primary-dark);
}

.task-edit-form {
    display: none;
    grid-column: 3 / -1;
    gap: 12px;
    margin-top: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.task-row.editing .task-edit-form {
    display: grid;
}

.flash {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-color: #d9b99e;
    background: #fff8ed;
    color: #7c3f1d;
}

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

    .sidebar {
        position: static;
    }

    nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .task-form,
    .sort-form {
        position: static;
        min-width: 0;
    }

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

    .page-headline h2 {
        font-size: 21px;
    }
}
