:root {
    --bg: #F6F9FC;
    --surface: #FFFFFF;
    --surface-2: #FBFCFE;

    --text: #0A2540;
    --muted: #425466;
    --muted-2: #6B7C93;

    --border: #E3E8EE;
    --border-2: #DCE3EC;

    --primary: #635BFF;
    --primary-2: #4B43E3;

    --danger: #D14343;
    --success: #167C4B;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);

    --radius: 14px;
    --radius-sm: 10px;

    --space-1: 6px;
    --space-2: 10px;
    --space-3: 14px;
    --space-4: 18px;
    --space-5: 24px;
    --space-6: 32px;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.45;
}

.container {
    width: min(1100px, calc(100% - 32px));
    margin: 28px auto 60px;
}

h1,
h2,
h3 {
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 28px;
    font-weight: 700;
}

h2 {
    font-size: 20px;
    font-weight: 650;
}

h3 {
    font-size: 16px;
    font-weight: 650;
    color: var(--text);
}

p {
    margin: 0 0 12px;
    color: var(--muted);
}

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

a:hover {
    text-decoration: underline;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

/* Topbar */
.topbar {
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.topbar-inner {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 14px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
    color: var(--text);
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: var(--shadow-sm);
}

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

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
}

.panel--compact {
    padding: var(--space-4);
}

/* Page head */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.page-title {
    margin: 0 0 6px;
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
}

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

/* KV */
.kv {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px 18px;
    align-items: start;
}

.kv .k {
    color: var(--muted-2);
    font-size: 13px;
}

.kv .v {
    color: var(--text);
}

/* Buttons */
button,
.btn {
    appearance: none;
    border: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: 9px 12px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    line-height: 1;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary,
button.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

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

.btn-secondary {
    background: #fff;
    color: var(--text);
}

.btn-danger {
    background: #fff;
    color: var(--danger);
    border-color: #F2C8C8;
}

.btn-link {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    color: var(--primary);
    font-weight: 650;
}

/* Alerts */
.alert {
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    background: #F8FAFD;
    color: var(--text);
}

.alert-error {
    background: #FFF3F3;
    border-color: #F2C8C8;
    color: #7A1F1F;
}

/* Forms */
form {
    margin: 0;
}

label {
    display: inline-block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    accent-color: var(--primary);
}

.help,
.helptext {
    font-size: 12px;
    color: var(--muted-2);
    margin-top: 6px;
}

.errorlist {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.errorlist li {
    background: #FFF3F3;
    border: 1px solid #F2C8C8;
    color: #7A1F1F;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 13px;
}

.field-row {
    margin-bottom: 14px;
}

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

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

.field-full {
    grid-column: 1 / -1;
}

.file-input {
    width: 100%;
    padding: 10px 0;
    color: var(--muted);
}

.file-input::file-selector-button {
    border: 1px solid var(--border-2);
    background: var(--surface);
    border-radius: 12px;
    padding: 8px 12px;
    margin-right: 12px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

/* Actions bar */
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 18px;
}

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

/* Board */
.board {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 14px;
    align-items: start;
    margin-top: 14px;
}

.column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 12px;
}

.column>h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 4px 10px;
}

.cards {
    min-height: 36px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
}

.card-title {
    display: block;
    font-weight: 650;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
}

.card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.assignee {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.card:active {
    cursor: grabbing;
}

.card a {
    color: var(--text);
    text-decoration: none;
    font-weight: 650;
    font-size: 14px;
}

.cards.is-over {
    outline: 2px solid rgba(99, 91, 255, 0.25);
    outline-offset: 2px;
    border-radius: 12px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table th {
    font-size: 12px;
    color: var(--muted);
    background: #F8FAFD;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.table tr:last-child td {
    border-bottom: 0;
}

/* Auth pages */
.auth-shell {
    max-width: 460px;
    margin: 8vh auto 0;
}

.auth-title {
    margin-bottom: 10px;
}

.auth-subtitle {
    margin-bottom: 18px;
    color: var(--muted);
}

/* Responsive */
@media (max-width: 1100px) {
    .board {
        grid-template-columns: repeat(5, 260px);
        overflow-x: auto;
        padding-bottom: 10px;
    }
}

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


.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--border);
    background: #fff;
}

.badge-priority.p-low {
    border-color: #E3E8EE;
    color: var(--muted);
}

.badge-priority.p-medium {
    border-color: #FAD3A7;
    color: #92400E;
}

.badge-priority.p-high {
    border-color: #F2C8C8;
    color: #B91C1C;
}