/* ============================================================
   SatSoft - stylesheet
   One shared palette drives every surface so the app reads as a
   single system. Change a value here, it changes everywhere.
   ============================================================ */

:root {
    /* Brand — deep navy, matches the Deckhouse letterhead */
    --brand-900: #08243F;
    --brand-800: #0C3055;
    --brand-700: #12406E;
    --brand-600: #1B5488;

    /* Accent — used sparingly: links, focus rings, active marks */
    --accent-600: #1F7A9E;
    --accent-500: #2A93BC;
    --accent-100: #E3F1F7;

    /* Neutrals */
    --bg: #F4F6F9;
    --surface: #FFFFFF;
    --surface-alt: #FAFBFC;
    --border: #E2E7EE;
    --border-strong: #CBD5E1;

    /* Text */
    --text: #16212E;
    --text-soft: #4B5A6B;
    --text-muted: #7C8B9C;
    --text-invert: #FFFFFF;

    /* Status */
    --danger-bg: #FDECEC;
    --danger-fg: #B42318;
    --ok-bg: #E7F5EC;
    --ok-fg: #16794C;

    --radius-sm: 6px;
    --radius: 9px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(16, 33, 51, .06);
    --shadow: 0 2px 8px rgba(16, 33, 51, .08);
    --shadow-lg: 0 12px 32px rgba(8, 36, 63, .18);

    --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

a { color: var(--accent-600); }

:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

/* ---------- Top bar ---------- */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, var(--brand-800), var(--brand-900));
    color: var(--text-invert);
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow);
}
.topbar-brand {
    display: flex;
    align-items: baseline;
    gap: 9px;
    font-size: 17px;
    font-weight: 680;
    letter-spacing: .2px;
}
.topbar-brand .brand-sub {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, .62);
    letter-spacing: .3px;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
}
.topbar-username {
    color: rgba(255, 255, 255, .9);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inline-form { display: inline; margin: 0; }
.link-button {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .28);
    color: var(--text-invert);
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.link-button:hover {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .5);
}

/* ---------- Shell: sidebar + content ---------- */
.layout {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
    flex: 0 0 232px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px 10px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 550;
    border-left: 3px solid transparent;
    transition: background .14s, color .14s, border-color .14s;
}
.sidebar-link:hover {
    background: var(--surface-alt);
    color: var(--brand-700);
}
.sidebar-link.is-active {
    background: var(--accent-100);
    color: var(--brand-800);
    border-left-color: var(--accent-600);
    font-weight: 650;
}
.sidebar-icon {
    width: 18px;
    display: inline-flex;
    justify-content: center;
    opacity: .8;
    flex: none;
}
.sidebar-link.is-active .sidebar-icon { opacity: 1; }

.content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 26px 28px 44px;
    max-width: 1240px;
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-header h1 {
    font-size: 22px;
    color: var(--brand-900);
}
.badge {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.badge-staff {
    background: var(--accent-100);
    color: var(--accent-600);
    border-color: #C4E2EE;
}
.badge-customer {
    background: var(--ok-bg);
    color: var(--ok-fg);
    border-color: #C6E7D4;
}

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.filter-bar .field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.filter-bar .field-grow { flex: 1 1 240px; min-width: 200px; }
.filter-bar label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .02em;
}
.filter-bar input {
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .14s, box-shadow .14s;
}
.filter-bar input:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px var(--accent-100);
    outline: none;
}
.btn-primary {
    padding: 9px 20px;
    background: var(--brand-700);
    color: var(--text-invert);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .14s;
}
.btn-primary:hover { background: var(--brand-600); }

.result-count {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px 2px;
}

/* ---------- Table ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table thead th {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: left;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--surface-alt); }
.data-table .cell-strong {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.text-right { text-align: right; }
.cell-amount { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); font-weight: 600; }
.cell-date { white-space: nowrap; font-variant-numeric: tabular-nums; }

.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--brand-700);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .14s, border-color .14s, color .14s;
}
.pdf-link:hover {
    background: var(--accent-100);
    border-color: var(--accent-500);
    color: var(--accent-600);
}

/* ---------- Empty / prompt states ---------- */
.empty-state,
.choose-prompt {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 52px 32px;
    text-align: center;
    color: var(--text-soft);
    box-shadow: var(--shadow-sm);
}
.choose-prompt { border-style: dashed; border-color: var(--border-strong); }
.choose-prompt-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--accent-100);
    color: var(--accent-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}
.choose-prompt h2 { font-size: 17px; color: var(--brand-800); margin-bottom: 7px; }
.choose-prompt p,
.empty-state p { margin: 0; font-size: 14px; }
.empty-state { color: var(--text-muted); font-size: 14.5px; }

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(1100px 520px at 15% -10%, #1B5488 0%, transparent 60%),
        linear-gradient(160deg, var(--brand-800) 0%, var(--brand-900) 100%);
}
.login-box {
    background: var(--surface);
    padding: 40px 36px 34px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 392px;
}
.login-brand {
    text-align: center;
    margin-bottom: 26px;
}
.login-brand h1 {
    font-size: 25px;
    color: var(--brand-900);
    letter-spacing: -.02em;
}
.login-brand p {
    margin: 5px 0 0;
    font-size: 13.5px;
    color: var(--text-muted);
}
.login-box label {
    display: block;
    margin: 0 0 6px;
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text-soft);
}
.login-field { margin-bottom: 16px; }
.login-box input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    transition: border-color .14s, box-shadow .14s;
}
.login-box input:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px var(--accent-100);
    outline: none;
}
.login-box button {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: var(--brand-700);
    color: var(--text-invert);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
    transition: background .14s;
}
.login-box button:hover { background: var(--brand-600); }

.error-message {
    background: var(--danger-bg);
    color: var(--danger-fg);
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 18px;
    border: 1px solid #F5C9C4;
}

/* ---------- Error page ---------- */
.error-page {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 34px;
    box-shadow: var(--shadow-sm);
}
.error-page h1 { font-size: 20px; color: var(--brand-900); margin-bottom: 10px; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ---------- Responsive: table collapses to cards ---------- */
@media (max-width: 860px) {
    .layout { flex-direction: column; min-height: auto; }
    .sidebar {
        flex: none;
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px;
        overflow-x: auto;
    }
    .sidebar-heading { display: none; }
    .sidebar-link {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    }
    .sidebar-link.is-active { border-left: none; border-bottom-color: var(--accent-600); }
    .content { padding: 20px 16px 36px; max-width: 100%; }
}

@media (max-width: 720px) {
    .table-wrap { background: transparent; border: none; box-shadow: none; }
    .data-table, .data-table thead, .data-table tbody,
    .data-table th, .data-table td, .data-table tr { display: block; }
    .data-table thead { display: none; }
    .data-table tbody tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 12px;
        padding: 12px 15px;
        box-shadow: var(--shadow-sm);
    }
    .data-table tbody td {
        border: none;
        padding: 6px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        text-align: right;
    }
    .data-table tbody td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--text-muted);
        text-align: left;
        flex: none;
    }
    .filter-bar { padding: 14px; }
    .filter-bar .btn-primary { width: 100%; }
}
