:root {
    --ink: #1f2937;
    --muted: #667085;
    --line: #d0d5dd;
    --panel: #ffffff;
    --bg: #f3f6f8;
    --nav: #be185d;
    --accent: #15803d;
    --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;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 10% 10%, rgba(21,128,61,.18), transparent 60%),
        radial-gradient(900px 500px at 90% 90%, rgba(190,24,93,.16), transparent 60%),
        linear-gradient(135deg, #f3f6f8 0%, #eef3f7 100%);
    padding: 24px;
}

.login-shell {
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 12px 30px rgba(18,52,59,.18);
    background: #fff;
}

.login-brand-text h1 {
    margin: 0;
    font-size: 24px;
    color: var(--ink);
    letter-spacing: .2px;
}

.login-brand-text p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.login-card {
    width: 100%;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(208,213,221,.7);
    border-radius: 16px;
    padding: 30px 28px 24px;
    box-shadow: 0 24px 60px rgba(18,52,59,.14);
}

.login-card h2 {
    margin: 0 0 2px;
    font-size: 20px;
    color: var(--ink);
}

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

.login-card .field {
    margin-bottom: 14px;
}

.login-card .field label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.login-card input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21,128,61,.15);
}

.login-btn {
    width: 100%;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #16a34a);
    box-shadow: 0 8px 20px rgba(21,128,61,.25);
}

.login-btn:hover {
    filter: brightness(1.05);
}

.login-foot {
    margin: 18px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
}

.login-page .message {
    margin: 0 0 14px;
}

.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));
}
.grid-5 {
    grid-template-columns: repeat(5, minmax(120px, 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-5 {
        grid-template-columns: 1fr;
    }
    .span-2 {
        grid-column: auto;
    }
    .topbar {
        padding: 0 14px;
    }
    .panel {
        margin: 14px;
    }
}
