:root {
    color-scheme: dark;
    --bg: #11110f;
    --surface: #1b1a17;
    --surface-2: #24221e;
    --line: #343128;
    --text: #f4efe3;
    --muted: #a9a293;
    --accent: #79b47a;
    --accent-hover: #65a166;
    --warn: #d7a449;
    --danger: #dd6b5c;
    --admin: #b184d8;
    --manager: #d7a449;
    --cashier: #79b47a;
    --radius: 8px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    background: #151411;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

.brand h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.1;
}

.brand span {
    color: var(--muted);
    white-space: nowrap;
}

.session-bar,
.actions,
.section-title,
.total-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-bar {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 24px;
    border-bottom: 1px solid var(--line);
    background: #171612;
}

.tab-button {
    min-width: 88px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
}

.tab-button:hover,
.tab-button.active {
    border-color: var(--line);
    background: var(--surface-2);
    color: var(--text);
}

.app-main {
    padding: 24px;
}

.tab-panel {
    display: none;
}

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

.grid {
    display: grid;
    gap: 18px;
}

.grid.two {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

.grid.form-list {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

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

.surface.wide {
    min-width: 0;
}

.section-title {
    justify-content: space-between;
    margin-bottom: 14px;
}

h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.stack {
    display: grid;
    gap: 14px;
}

.stack.compact {
    gap: 10px;
}

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

.form-grid.add-line {
    grid-template-columns: minmax(0, 1fr) 110px auto;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
}

label > span {
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #11100e;
    color: var(--text);
    padding: 8px 10px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.btn {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 14px;
    color: var(--text);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #091007;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    border-color: var(--line);
    background: var(--surface-2);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.btn-danger {
    border-color: rgba(221, 107, 92, 0.45);
    background: rgba(221, 107, 92, 0.1);
    color: #ffc1b8;
}

.btn-small {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 13px;
}

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

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

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

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    background: #151410;
}

tr:last-child td {
    border-bottom: none;
}

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

.total-row {
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.total-row strong {
    font-size: 24px;
    color: var(--accent);
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.summary-strip div {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #151410;
    padding: 12px;
}

.summary-strip span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.summary-strip strong {
    font-size: 18px;
}

.role-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    border: 1px solid var(--line);
}

.role-badge.cashier,
.status-pill.active {
    color: #c8f0c4;
    border-color: rgba(121, 180, 122, 0.55);
    background: rgba(121, 180, 122, 0.12);
}

.role-badge.manager {
    color: #ffe0a0;
    border-color: rgba(215, 164, 73, 0.55);
    background: rgba(215, 164, 73, 0.12);
}

.role-badge.admin {
    color: #e2c8f4;
    border-color: rgba(177, 132, 216, 0.55);
    background: rgba(177, 132, 216, 0.12);
}

.status-pill.inactive,
.status-pill.paid {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
}

.status-pill.low {
    color: #ffd0c8;
    border-color: rgba(221, 107, 92, 0.5);
    background: rgba(221, 107, 92, 0.12);
}

.detail-list {
    display: grid;
    gap: 4px;
    min-width: 260px;
}

.muted {
    color: var(--muted);
}

.mono {
    font-family: Consolas, "Courier New", monospace;
    word-break: break-all;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.62);
    padding: 20px;
    z-index: 20;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 20px;
}

.modal h2 {
    margin-bottom: 14px;
}

.form-error {
    color: #ffc1b8;
    margin: 10px 0 0;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(420px, calc(100vw - 36px));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #24221e;
    color: var(--text);
    padding: 12px 14px;
    box-shadow: var(--shadow);
    z-index: 30;
}

.toast.error {
    border-color: rgba(221, 107, 92, 0.6);
}

.role-hidden {
    display: none !important;
}

[hidden] {
    display: none !important;
}

@media (max-width: 980px) {
    .grid.two,
    .grid.form-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

    .brand {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .tabs,
    .app-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .form-grid,
    .form-grid.add-line,
    .summary-strip {
        grid-template-columns: 1fr;
    }

    .surface {
        padding: 14px;
    }
}

