:root {
    --ink: #1f2937;
    --muted: #667085;
    --line: #d0d5dd;
    --panel: #ffffff;
    --bg: #f3f6f8;
    --nav: #12343b;
    --accent: #0f766e;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e7f0ed, #f6f3ec);
}

.login-card {
    width: min(380px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 18px 50px rgba(18, 52, 59, .12);
}

.login-card h1 {
    margin: 0 0 2px;
    font-size: 22px;
}

.login-sub {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--accent);
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 190px 1fr;
}

.sidebar {
    background: var(--nav);
    color: #fff;
    padding: 18px 14px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 4px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
    margin-bottom: 14px;
}

.brand span {
    display: block;
    color: rgba(255, 255, 255, .68);
    font-size: 12px;
    margin-top: 3px;
}

nav a, summary {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
}

nav a:hover, summary:hover {
    background: rgba(255, 255, 255, .12);
}

nav details {
    margin: 2px 0;
}

nav details a {
    padding-left: 22px;
    color: rgba(255, 255, 255, .86);
}

nav a.active {
    background: rgba(255, 255, 255, .18);
    font-weight: 700;
}

.content {
    min-width: 0;
}

.topbar {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
    font-weight: 700;
}

.userbar {
    font-size: 13px;
    font-weight: 400;
}

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

.message {
    padding: 10px 12px;
    margin: 14px 24px -8px;
    border-radius: 6px;
    background: #e7f7f3;
    color: #095b52;
    border: 1px solid #bfe6dd;
}

.message.error {
    background: #fee4e2;
    color: #912018;
    border-color: #f5b8b3;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 20px;
}

.tabs button {
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: #f0f3f6;
    color: var(--ink);
    padding: 10px 16px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.tabs button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ---- Cards / sections ---- */
.card-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 10px;
    background: #fafbfc;
}

.card-section h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 8px 12px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
}

.span-2 {
    grid-column: span 2;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 3px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 5px 7px;
    font: inherit;
    background: #fff;
}

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

.actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

button, .btn {
    border: 0;
    border-radius: 5px;
    padding: 6px 12px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-light {
    background: #e6eaee;
    color: var(--ink);
}

.btn-danger {
    background: var(--danger);
}

.btn-edit {
    background: #2563eb;
}

.btn-delete {
    background: #b42318;
}

.btn-small {
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 12px;
    line-height: 1;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.form-inline {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline label {
    margin-bottom: 0;
}

.form-inline input, .form-inline select {
    width: auto;
    min-width: 160px;
}

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
    margin-top: 2px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

th {
    background: #f7f9fb;
    white-space: nowrap;
}

tr:hover td {
    background: #fafcfd;
}

.empty {
    padding: 12px;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 6px;
    margin-top: 6px;
}

.hint {
    color: var(--muted);
    font-size: 13px;
    margin: 2px 0 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
}

.stat strong {
    display: block;
    font-size: 26px;
    margin-top: 8px;
}

/* ---- Print / receipt ---- */
.print-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.receipt {
    max-width: 760px;
    margin: 0 auto;
    color: #111827;
    font-size: 13px;
}

.receipt-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.receipt h1 {
    text-align: center;
    font-size: 20px;
    margin: 14px 0 10px;
}

@media print {
    .no-print {
        display: none !important;
    }
    .sidebar, .topbar {
        display: none !important;
    }
    .app {
        display: block;
        min-height: 0;
    }
    .content, .panel {
        margin: 0;
        border: 0;
        padding: 0;
        min-height: 0;
    }
    body {
        background: #fff;
        font-size: 12px;
    }
    table {
        margin-top: 8px;
    }
    th, td {
        padding: 4px 6px;
    }
}

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }
    .grid, .grid-2 {
        grid-template-columns: 1fr;
    }
    .span-2 {
        grid-column: auto;
    }
    .topbar {
        padding: 0 14px;
    }
    .panel {
        margin: 14px;
    }
}
