:root {
    --color-background: #f6f6f6;
    --color-surface: #ffffff;
    --color-strong: #101010;
    --color-text: #1f1f1f;
    --color-muted: #6d6d6d;
    --color-line: #dedede;
    --color-soft: #eeeeee;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --sidebar-width: 272px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-background);
    color: var(--color-text);
    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;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 28px 20px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-line);
}

.brand {
    display: grid;
    gap: 12px;
    color: var(--color-strong);
    font-weight: 700;
}

.brand img,
.login-logo {
    display: block;
    max-width: 180px;
    height: auto;
}

.brand span {
    line-height: 1.2;
}

.nav-list {
    display: grid;
    gap: 6px;
}

.nav-list a,
.language-switch a {
    border-radius: var(--radius);
    color: var(--color-muted);
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
}

.nav-list a.active,
.nav-list a:hover,
.language-switch a.active,
.language-switch a:hover {
    background: var(--color-strong);
    color: #ffffff;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 16px;
}

.language-switch {
    display: flex;
    gap: 6px;
}

.language-switch a {
    min-width: 42px;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.content {
    flex: 1;
    min-width: 0;
    padding: 36px;
}

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

.auth-content {
    width: min(100%, 420px);
    display: grid;
    gap: 18px;
}

.auth-language {
    justify-content: flex-end;
}

.login-panel,
.panel,
.metric {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
}

.login-panel {
    padding: 32px;
    box-shadow: var(--shadow-soft);
}

.login-heading {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    color: var(--color-strong);
    line-height: 1.15;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 18px;
}

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

.field {
    display: grid;
    gap: 7px;
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
}

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

.field input:focus {
    border-color: var(--color-strong);
    outline: 3px solid rgba(16, 16, 16, 0.1);
}

.button {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 800;
    padding: 9px 14px;
}

.button-inline {
    width: auto;
    min-height: 36px;
    padding: 7px 12px;
    white-space: nowrap;
}

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

.button-primary:hover {
    background: #2d2d2d;
}

.button-secondary {
    background: #ffffff;
    border-color: var(--color-line);
    color: var(--color-strong);
}

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

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #b9b9b9;
    border-radius: var(--radius);
    background: #f1f1f1;
    color: var(--color-strong);
}

.alert-success {
    border-color: #a5a5a5;
    background: #f7f7f7;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.user-chip {
    display: grid;
    justify-items: end;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    background: var(--color-surface);
    white-space: nowrap;
}

.user-chip span {
    color: var(--color-strong);
    font-weight: 800;
}

.user-chip small {
    color: var(--color-muted);
}

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

.metric {
    min-height: 112px;
    padding: 18px;
    display: grid;
    align-content: space-between;
}

.metric span {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 800;
}

.metric strong {
    color: var(--color-strong);
    font-size: 28px;
    line-height: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
    gap: 16px;
    align-items: start;
}

.panel {
    overflow: hidden;
}

.panel-header {
    padding: 18px 18px 0;
}

.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.table-wrap {
    overflow-x: auto;
}

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

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

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

td a {
    color: var(--color-strong);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

tbody tr.is-selected {
    background: #f1f1f1;
}

.orders-grid {
    display: grid;
    grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
    gap: 16px;
    align-items: start;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    color: var(--color-strong);
    background: #ffffff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pending {
    background: #ffffff;
}

.status-requested {
    background: #ededed;
}

.status-received {
    background: #101010;
    color: #ffffff;
    border-color: #101010;
}

.detail-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
    border-bottom: 1px solid var(--color-line);
}

.detail-summary div {
    display: grid;
    gap: 4px;
}

.detail-summary span {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-summary strong {
    color: var(--color-strong);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.detail-summary-full {
    grid-column: 1 / -1;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 18px 18px;
}

.action-row form {
    margin: 0;
}

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

.empty-state {
    margin: 0;
    padding: 18px;
    color: var(--color-muted);
}

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--color-line);
    }

    .content {
        padding: 24px;
    }

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

    .page-header {
        display: grid;
    }

    .user-chip {
        justify-items: start;
        white-space: normal;
    }
}

@media (max-width: 560px) {
    .auth-shell,
    .content {
        padding: 18px;
    }

    .login-panel {
        padding: 24px;
    }

    .sidebar {
        padding: 22px 18px;
    }

    h1 {
        font-size: 26px;
    }
}
