/* KasirKu POS Dashboard - tema emerald selaras aplikasi mobile */
:root {
    --emerald: #0F766E;
    --emerald-dark: #0B5A54;
    --emerald-soft: #CCFBF1;
    --ink: #0F172A;
    --text: #1E293B;
    --text-2: #64748B;
    --border: #E2E8F0;
    --bg: #F1F5F9;
    --card: #FFFFFF;
    --red: #DC2626;
    --red-soft: #FEE2E2;
    --green: #16A34A;
    --green-soft: #DCFCE7;
    --amber: #D97706;
    --amber-soft: #FEF3C7;
    --sidebar: #1E293B;
    --sidebar-2: #16213A;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

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

a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #CBD5E1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-logo {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--emerald); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 20px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 16px; }
.brand-text span { font-size: 11px; color: #94A3B8; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 16px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    color: #CBD5E1; padding: 9px 12px; border-radius: 10px;
    font-size: 13.5px; font-weight: 500;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--emerald); color: #fff; }
.sidebar-foot { padding: 14px 18px; font-size: 10.5px; color: #64748B; line-height: 1.5; border-top: 1px solid rgba(255,255,255,.06); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 16px 26px 12px;
}
.topbar h1 { margin: 0; font-size: 20px; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.admin-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--emerald-soft); color: var(--emerald-dark);
    font-weight: 600; font-size: 12.5px;
    padding: 5px 12px 5px 5px; border-radius: 999px;
}
.avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--emerald); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}

.page { padding: 4px 26px 34px; }

/* ---------- Flash ---------- */
.flash {
    margin: 0 26px 12px; padding: 11px 15px;
    border-radius: 10px; font-size: 13px; font-weight: 500;
}
.flash-success { background: var(--green-soft); color: #14532D; }
.flash-error { background: var(--red-soft); color: #7F1D1D; }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 15.5px; color: var(--ink); }
.card .sub { color: var(--text-2); font-size: 12.5px; margin-bottom: 14px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 18px;
}
.stat-card .label { color: var(--text-2); font-size: 12px; font-weight: 600; }
.stat-card .value { color: var(--ink); font-size: 21px; font-weight: 800; margin-top: 4px; }
.stat-card .value.small { font-size: 17px; }
.stat-card .extra { color: var(--text-2); font-size: 11.5px; margin-top: 3px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
    text-align: left; color: var(--text-2); font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .04em;
    padding: 9px 10px; border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: #F8FAFC; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
.table-actions { display: flex; gap: 6px; }
.empty { text-align: center; color: var(--text-2); padding: 30px 10px; font-size: 13px; }

/* ---------- Badge ---------- */
.badge {
    display: inline-block; padding: 2.5px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: #166534; }
.badge-red { background: var(--red-soft); color: #991B1B; }
.badge-amber { background: var(--amber-soft); color: #92400E; }
.badge-gray { background: #E2E8F0; color: #475569; }
.badge-emerald { background: var(--emerald-soft); color: var(--emerald-dark); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid transparent; border-radius: 10px;
    padding: 8px 15px; font-size: 13px; font-weight: 600;
    cursor: pointer; text-decoration: none; line-height: 1.2;
    font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #F8FAFC; }
.btn-danger { background: #fff; color: var(--red); border-color: #FECACA; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 13px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-label em { color: var(--red); font-style: normal; }
.input, select.input, textarea.input {
    width: 100%; border: 1.2px solid var(--border); border-radius: 10px;
    padding: 9px 12px; font-size: 13.5px; font-family: inherit;
    background: #fff; color: var(--text); outline: none;
}
.input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
textarea.input { resize: vertical; min-height: 70px; }
.field-hint { font-size: 11px; color: var(--text-2); }
.form-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--emerald); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form .input { width: 230px; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #0F766E 0%, #0B5A54 55%, #134E4A 100%);
    padding: 20px;
}
.login-card {
    width: 100%; max-width: 392px; background: #fff;
    border-radius: 20px; padding: 30px 28px;
    box-shadow: 0 20px 50px rgba(2, 44, 40, .35);
}
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.login-brand .brand-logo { width: 54px; height: 54px; font-size: 26px; border-radius: 16px; margin-bottom: 10px; }
.login-brand h1 { margin: 0; font-size: 21px; color: var(--ink); }
.login-brand p { margin: 3px 0 0; color: var(--text-2); font-size: 12.5px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; margin-top: 6px; }
.login-error { background: var(--red-soft); color: #7F1D1D; border-radius: 10px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 14px; }

/* ---------- Chart (bar sederhana) ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-track { width: 100%; height: 128px; display: flex; align-items: flex-end; }
.bar-fill {
    width: 100%; background: linear-gradient(180deg, #14B8A6, var(--emerald));
    border-radius: 7px 7px 3px 3px; min-height: 3px;
}
.bar-label { font-size: 10.5px; color: var(--text-2); white-space: nowrap; }

.hstack { display: flex; gap: 18px; flex-wrap: wrap; }
.hstack > .card { flex: 1; min-width: 300px; }

.muted { color: var(--text-2); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.token-box {
    display: flex; gap: 10px; align-items: center;
    background: #F8FAFC; border: 1px dashed var(--border);
    border-radius: 10px; padding: 10px 13px; word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; color: var(--ink);
}
.detail-list { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 13px; }
.detail-list dt { color: var(--text-2); font-weight: 600; }
.detail-list dd { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .nav { flex-direction: row; overflow-x: auto; padding-bottom: 10px; }
    .nav-item { white-space: nowrap; padding: 8px 12px; }
    .sidebar-foot { display: none; }
    .topbar, .page, .flash { padding-left: 16px; padding-right: 16px; }
    .flash { margin-left: 16px; margin-right: 16px; }
}
