:root {
    --bg: #f5f2ea;
    --surface: #fffdf9;
    --surface-soft: #faf6ef;
    --border: #ddd5c7;
    --text: #2d2a26;
    --muted: #756d61;
    --primary: #1f6a5b;
    --primary-hover: #185347;
    --primary-soft: #dcebe7;
    --danger: #a4493f;
    --danger-soft: #f6e1de;
    --shadow: 0 12px 30px rgba(56, 46, 35, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(180deg, #f8f5ef 0%, var(--bg) 100%);
}

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

.sidebar {
    padding: 28px 22px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

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

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle,
.muted,
.meta-label {
    color: var(--muted);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-logout {
    margin-top: 24px;
    display: grid;
    gap: 10px;
}

.nav-link {
    padding: 13px 15px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
}

.nav-link.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.content {
    padding: 32px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 420px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.auth-card h1 {
    margin: 0 0 8px;
}

.page-head,
.section-head,
.card-top,
.card-grid,
.inline-form {
    display: flex;
    gap: 16px;
}

.page-head,
.section-head,
.card-top {
    align-items: flex-start;
    justify-content: space-between;
}

.page-head h1,
.section-head h2,
.card h2,
.card h3 {
    margin: 0 0 8px;
}

.page-head p,
.section-head p,
.card p {
    margin: 0;
}

.section,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.section {
    margin-bottom: 24px;
    padding: 24px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 18px;
}

.card {
    padding: 20px;
}

.stack {
    display: grid;
    gap: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(320px, 460px) 1fr;
    gap: 20px;
}

.card-grid {
    flex-wrap: wrap;
}

.card-grid > div {
    min-width: 170px;
    flex: 1 1 170px;
}

.meta-block {
    margin-top: 16px;
}

.meta-label {
    font-size: 13px;
}

.meta-value {
    margin-top: 6px;
    font-weight: 600;
    word-break: break-word;
}

.inline-form,
.stack-form {
    margin-top: 18px;
}

.inline-form {
    flex-wrap: wrap;
    align-items: center;
}

.inline-form input,
.inline-form textarea {
    flex: 1 1 220px;
}

.inline-form input {
    min-height: 46px;
}

.inline-form textarea.textarea-compact {
    min-height: 46px;
    height: 46px;
    max-height: 46px;
    overflow: hidden;
    resize: none;
}

.stack-form {
    display: grid;
    gap: 14px;
}

.pending-form {
    max-width: 720px;
}

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

label span {
    font-size: 14px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

.textarea-compact {
    min-height: 46px;
    height: 46px;
    max-height: 46px;
    overflow: hidden;
    resize: none;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #8db9ad;
    box-shadow: 0 0 0 3px rgba(31, 106, 91, 0.12);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

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

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

.button-secondary:hover {
    background: #edd0cb;
}


.button-small {
    min-height: 38px;
    padding: 10px 14px;
}

.action-row {
    margin-top: 18px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
}

.danger-row {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.action-row-between {
    justify-content: space-between;
}

.detail-grid .card .action-row-between {
    align-items: stretch;
    gap: 14px;
}

.detail-grid .card .action-row-between > .button,
.detail-grid .card .action-row-between > form {
    flex: 1 1 0;
}

.detail-grid .card .action-row-between > form {
    display: flex;
}

.detail-grid .card .action-row-between .button {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 12px 18px;
}

.danger-row form,
.action-row form {
    margin: 0;
}

.pending-action-form {
    margin: 0;
    display: inline;
}

.action-row .pending-action-form .button {
    min-height: 42px;
    padding: 10px 18px;
    font-size: 14px;
}

.danger-row .button,
.pending-form .button {
    width: auto;
}

.flash,
.empty,
.badge,
.list-item,
.check-item {
    border-radius: 12px;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #eef6f3;
    border: 1px solid #cfe1db;
}

.flash-error {
    background: #fdf0ee;
    border-color: #edc9c4;
    color: var(--danger);
}

.empty {
    padding: 16px;
    background: var(--surface-soft);
    color: var(--muted);
}

.badge {
    padding: 6px 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.checklist {
    display: grid;
    gap: 10px;
}

.check-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.check-item input {
    width: auto;
    margin-top: 3px;
}

.list {
    display: grid;
    gap: 12px;
}

.list-item {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: #fff;
    color: inherit;
    text-decoration: none;
}

.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

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

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .content {
        padding: 20px;
    }

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

    .danger-row,
    .action-row {
        justify-content: stretch;
    }

    .danger-row form,
    .action-row form,
    .button {
        width: 100%;
    }
}
