:root {
    --font-display: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #137fec;
    --primary-hover: #0f6cc9;
    --success: #0f766e;
    --success-bg: #ccfbf1;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --warning: #b45309;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-soft: 0 6px 20px rgba(2, 6, 23, 0.04);
    --shadow-card: 0 10px 24px rgba(2, 6, 23, 0.06);
}

/* Material Symbols Icons */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

html.dark {
    --bg: #101922;
    --surface: #16202a;
    --surface-soft: #111a22;
    --text: #e2e8f0;
    --text-muted: #92adc9;
    --border: #233648;
    --shadow-soft: none;
    --shadow-card: none;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: min(1240px, calc(100% - 2rem));
    margin-inline: auto;
}

.page-wrap {
    padding: 1.4rem 0 2.4rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
}

.card-lg {
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.muted {
    color: var(--text-muted);
}

.mt-24 {
    margin-top: 1.5rem;
}

.list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.list.bullets {
    list-style: disc;
    padding-left: 1.1rem;
    display: block;
}

.list.bullets li {
    margin: 0.35rem 0;
}

.mt-24 {
    margin-top: 1.5rem;
}

.list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.list.bullets {
    list-style: disc;
    padding-left: 1.1rem;
    display: block;
}

.list.bullets li {
    margin: 0.35rem 0;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stack-6 > * + * {
    margin-top: 0.375rem;
}

.stack-12 > * + * {
    margin-top: 0.75rem;
}

.stack-16 > * + * {
    margin-top: 1rem;
}

.stack-24 > * + * {
    margin-top: 1.5rem;
}

.section-title {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid transparent;
    border-radius: 12px;
    min-height: 42px;
    padding: 0.6rem 0.9rem;
    font-size: 0.92rem;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn:active {
    transform: translateY(1px);
}

.btn-outline {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--surface-soft);
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text-muted);
}

.btn-sm {
    min-height: 34px;
    border-radius: 10px;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
}

.btn-danger {
    background: var(--danger);
}

label {
    display: grid;
    gap: 0.45rem;
    font-size: 0.9rem;
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    min-height: 42px;
    padding: 0.55rem 0.7rem;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--primary) 28%, transparent);
    outline-offset: 1px;
    border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
}

.form-grid {
    display: grid;
    gap: 0.9rem;
}

.form-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
    grid-column: 1 / -1;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.alert {
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
    color: var(--success);
}

.alert-error {
    background: var(--danger-bg);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.table th,
.table td {
    border-bottom: 1px solid var(--border);
    padding: 0.68rem;
    text-align: left;
    vertical-align: top;
}

.table th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--surface-soft) 85%, transparent);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-open,
.status-in_progress,
.status-sent,
.status-pending {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

.status-paid,
.status-completed,
.status-accepted,
.status-published,
.status-resolved {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.status-overdue,
.status-failed,
.status-rejected,
.status-cancelled,
.status-closed {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.shell-sidebar {
    border-right: 1px solid var(--border);
    background: var(--surface);
    padding: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}

.shell-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
}

.shell-topbar {
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.shell-content {
    padding: 1rem;
}

.menu-list {
    display: grid;
    gap: 0.3rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.58rem 0.72rem;
    border-radius: 11px;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.menu-link:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.menu-link.is-active {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

.auth-shell {
    min-height: calc(100vh - 140px);
    display: grid;
    place-items: center;
    padding: 1rem 0;
}

.auth-card {
    width: min(520px, 100%);
}

@media (max-width: 1024px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .shell-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 25;
        width: min(320px, 84vw);
    }

    .shell-sidebar.is-open {
        transform: translateX(0);
    }
}

@media (max-width: 900px) {
    .grid-2,
    .grid-3,
    .form-grid.cols-2 {
        grid-template-columns: 1fr;
    }
}
