/* Base */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #1d2733;
    --muted: #667085;
    --line: #d9e0e8;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

h1,
h2,
p {
    margin: 0;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.button:hover {
    border-color: #b7c4d2;
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

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

.button-ghost {
    background: transparent;
}

.button-danger {
    border-color: #f5c2bd;
    color: var(--danger);
}

.button-small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.button-full {
    width: 100%;
}

/* Auth */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #eaf0f2;
}

.auth-wrap {
    width: min(100%, 420px);
}

.login-panel {
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-intro {
    display: grid;
    gap: 8px;
    margin-bottom: 28px;
}

.login-intro h1 {
    font-size: 30px;
}

.login-intro p,
.eyebrow,
.metric-card span {
    color: var(--muted);
    font-size: 13px;
}

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

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    background: #18212b;
    color: #ffffff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 18px;
}

.nav {
    display: grid;
    gap: 8px;
    margin-top: 32px;
}

.nav-link {
    padding: 12px 14px;
    border-radius: 8px;
    color: #c8d2df;
    font-weight: 700;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.workspace {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.topbar h1 {
    font-size: 28px;
}

.content {
    display: grid;
    gap: 24px;
    padding: 32px;
}

/* Panels */
.panel,
.metric-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-header h2 {
    margin-top: 4px;
    font-size: 22px;
}

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

.metric-card {
    display: grid;
    gap: 8px;
    padding: 22px;
}

.metric-card strong {
    font-size: 22px;
}

.alert {
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.alert-success {
    border-color: #abefc6;
    color: var(--success);
    background: #ecfdf3;
}

/* Forms */
.form {
    display: grid;
    gap: 18px;
}

.form-panel {
    max-width: 760px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field label,
.check {
    font-weight: 700;
    font-size: 14px;
}

.field input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.field input:focus {
    outline: 3px solid rgba(15, 118, 110, 0.14);
    border-color: var(--primary);
}

.field-error {
    color: var(--danger);
    font-size: 13px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.table th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

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

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.actions-cell {
    text-align: right;
}

.pagination {
    margin-top: 18px;
}

.pagination nav {
    display: flex;
    gap: 8px;
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .topbar,
    .panel-header,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .content,
    .topbar {
        padding: 22px;
    }

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