@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Kassir brand */
    --yellow: #FFC733;
    --yellow-dark: #E6AA00;
    --yellow-light: #FFF3C4;
    --yellow-pale: #FFFBEC;
    --yellow-hover: #FFD966;
    --yellow-glow: rgba(255, 199, 51, 0.35);

    /* Neutrals */
    --bg: #f5f5f7;
    --bg2: #ffffff;
    --bg3: #f9f9fb;
    --bg4: #f0f0f4;
    --border: #e8e8ee;
    --border-hover: #d0d0dc;

    /* Text */
    --text: #111111;
    --text2: #555566;
    --text3: #9999aa;

    /* Status */
    --success: #22c55e;
    --danger: #ef4444;

    /* Misc */
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ——— LOGIN ——— */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image: radial-gradient(ellipse 70% 50% at 50% -10%, rgba(255, 199, 51, 0.18), transparent);
}

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 199, 51, 0.08);
    animation: fadeUp 0.4s ease;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px var(--yellow-glow);
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.login-logo span {
    font-size: 12px;
    color: var(--text3);
    display: block;
    font-weight: 400;
}

/* ——— LAYOUT ——— */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--yellow-glow);
}

.sidebar-logo .logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.sidebar-logo .logo-sub {
    font-size: 11px;
    color: var(--text3);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--yellow-pale);
    color: var(--text);
}

.nav-link.active {
    background: var(--yellow-light);
    color: #8a5700;
    font-weight: 600;
}

.nav-link .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--yellow-pale);
    border: 1px solid rgba(255, 199, 51, 0.3);
}

.user-pill .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    color: #5a3a00;
}

.user-pill .user-info {
    flex: 1;
    overflow: hidden;
}

.user-pill .user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.user-pill .user-role {
    font-size: 11px;
    color: var(--text3);
}

.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.topbar {
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg2);
}

.topbar h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.topbar .topbar-sub {
    font-size: 13px;
    color: var(--text3);
    margin-top: 2px;
}

.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

/* ——— FORMS ——— */
.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    margin-bottom: 6px;
}

input[type=text],
input[type=password],
input[type=date] {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus {
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow-glow);
    background: #fff;
}

input::placeholder {
    color: var(--text3);
}

/* ——— BUTTONS ——— */
.btn {
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--yellow);
    color: #111;
    box-shadow: 0 4px 14px var(--yellow-glow);
}

.btn-primary:hover {
    background: var(--yellow-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--yellow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.07);
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.14);
}

.btn-ghost {
    background: var(--bg2);
    border: 1.5px solid var(--border);
    color: var(--text2);
}

.btn-ghost:hover {
    background: var(--bg4);
    border-color: var(--border-hover);
    color: var(--text);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ——— CARDS ——— */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.card-sub {
    font-size: 13px;
    color: var(--text3);
    margin-top: 2px;
}

/* ——— TABLE ——— */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead tr {
    background: var(--yellow-pale);
}

th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8a5700;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 199, 51, 0.3);
}

td {
    padding: 13px 16px;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

tr:hover td {
    background: var(--yellow-pale);
}

.td-mono {
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-size: 12px;
    color: var(--text2);
}

.td-text {
    color: var(--text);
    word-break: break-word;
    max-width: 320px;
}

/* ——— BADGE ——— */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-admin {
    background: rgba(255, 199, 51, 0.25);
    color: #7a4d00;
}

.badge-viewer {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

/* ——— STAT CARDS ——— */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--yellow);
    opacity: 0.7;
}

.stat-icon {
    font-size: 22px;
    margin-bottom: 10px;
}

.stat-val {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 12px;
    color: var(--text3);
    margin-top: 2px;
}

/* ——— FILTERS ——— */
.filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text3);
    font-weight: 600;
}

.filter-group input {
    width: 180px;
}

/* ——— EMPTY / LOADING ——— */
.empty-state {
    text-align: center;
    padding: 44px 20px;
    color: var(--text3);
}

.empty-state .empty-icon {
    font-size: 34px;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--yellow-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ——— ALERTS ——— */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

.alert.show {
    display: block;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #b91c1c;
}

.alert-success {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #15803d;
}

/* ——— MODAL ——— */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 30px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    animation: fadeUp 0.25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: var(--bg4);
    color: var(--text);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

/* ——— TABS ——— */
.tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 20px;
    background: var(--bg2);
    padding: 4px;
    border-radius: 10px;
    width: fit-content;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text2);
    font-family: inherit;
    transition: all 0.15s;
}

.tab-btn:hover {
    background: var(--yellow-pale);
    color: #7a4d00;
}

.tab-btn.active {
    background: var(--yellow);
    color: #111;
    font-weight: 600;
    box-shadow: 0 2px 8px var(--yellow-glow);
}

.tab-panel {
    display: none;
}

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

/* ——— ANIMATIONS ——— */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}