/* WASHVERA ADMIN — only the WashVera owner uses this page */
:root {
    --navy: #0b1730;
    --navy-2: #13233f;
    --navy-3: #1b2f52;
    --line: #2a4068;
    --text: #e8eef8;
    --muted: #93a4c0;
    --teal: #14b8a6;
    --teal-dark: #0f8f82;
    --red: #ef4444;
    --amber: #f59e0b;
    --green: #22c55e;
    --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--navy);
    color: var(--text);
    font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; margin-top: 40px; }
.error { color: var(--red); min-height: 1.2em; margin: 8px 0 0; }
.warn { color: var(--amber); }
code { background: var(--navy-3); padding: 1px 6px; border-radius: 6px; }
h2 { margin: 0 0 10px; font-size: 19px; }
h3 { margin: 18px 0 8px; font-size: 16px; }

.brand { font-weight: 800; font-size: 22px; letter-spacing: .2px; }
.brand span { color: var(--teal); }
.brand small { font-weight: 600; font-size: 13px; color: var(--muted); margin-left: 6px; }

button {
    font: inherit; border: 1px solid var(--line); background: var(--navy-3); color: var(--text);
    padding: 8px 14px; border-radius: 10px; cursor: pointer;
}
button:hover { border-color: var(--teal); }
button.primary { background: var(--teal); border-color: var(--teal); color: #04231f; font-weight: 700; }
button.primary:hover { background: var(--teal-dark); }
button.danger { border-color: var(--red); color: #fecaca; background: transparent; }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: 13px; }
button.wide { width: 100%; }
button.chip { border-radius: 999px; padding: 6px 14px; }
button.chip.on { background: var(--teal); border-color: var(--teal); color: #04231f; font-weight: 700; }

input, textarea {
    font: inherit; width: 100%; padding: 9px 11px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--navy); color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
label input, label textarea { margin-top: 4px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--navy-2); padding: 28px; border-radius: 16px; border: 1px solid var(--line); }
.login-card .brand { margin-bottom: 14px; }

/* ---------- top bar ---------- */
.top {
    display: flex; align-items: center; gap: 18px; padding: 12px 20px;
    background: var(--navy-2); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.top nav { display: flex; gap: 6px; flex: 1; }
.tab { background: transparent; border-color: transparent; }
.tab.active { background: var(--navy-3); border-color: var(--line); color: var(--teal); font-weight: 700; }
.who { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }

main { padding: 18px 20px 40px; max-width: 1500px; margin: 0 auto; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile b { display: block; font-size: 24px; }
.tile span { color: var(--muted); font-size: 13px; }

/* ---------- panels ---------- */
.panel { background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.panel-head input { flex: 1; min-width: 160px; }
.split { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.shop-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 260px); overflow: auto; }
.shop {
    text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px;
    background: var(--navy); border-radius: 10px;
}
.shop.selected { border-color: var(--teal); }
.shop .name { font-weight: 700; }
.shop .sub { color: var(--muted); font-size: 13px; grid-column: 1 / -1; }

.badge { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; align-self: start; }
.badge.active { background: rgba(34, 197, 94, .15); color: var(--green); }
.badge.trial { background: rgba(20, 184, 166, .15); color: var(--teal); }
.badge.expired, .badge.cancelled { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.badge.suspended { background: rgba(245, 158, 11, .15); color: var(--amber); }

/* ---------- shop detail ---------- */
.detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; margin: 10px 0; }
.facts div span { display: block; color: var(--muted); font-size: 12px; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr.revoked td { color: var(--muted); text-decoration: line-through; }

.code-box {
    display: inline-block; font: 700 22px/1.2 Consolas, "Courier New", monospace; letter-spacing: 2px;
    background: var(--navy); border: 1px dashed var(--teal); color: var(--teal); padding: 6px 12px; border-radius: 10px;
}

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.plan { background: var(--navy); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.plan .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.key { white-space: pre-wrap; word-break: break-all; background: var(--navy); padding: 12px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- dialog & toast ---------- */
dialog {
    border: 1px solid var(--line); background: var(--navy-2); color: var(--text);
    border-radius: 16px; padding: 0; width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 32px); overflow: hidden;
}
/* the form fills the dialog: title on top, fields scroll, buttons always visible at the bottom */
dialog[open] #dialogForm { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
#dialogTitle { padding: 18px 20px 0; }
#dialogBody { padding: 0 20px; overflow-y: auto; flex: 1 1 auto; }
#dialogError { padding: 0 20px; }
.dialog-buttons { padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--navy-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid2 .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h3 { margin-top: 0; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

.toast {
    position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
    background: var(--teal); color: #04231f; font-weight: 700; padding: 10px 18px; border-radius: 999px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}
.toast.bad { background: var(--red); color: white; }

/* ---------- compact: the whole shop fits on one screen ---------- */
main { padding: 12px 18px 24px; }
.top { padding: 8px 18px; }
.tiles { grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 10px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { padding: 7px 12px; display: flex; align-items: baseline; gap: 8px; }
.tile b { display: inline; font-size: 20px; }
.panel { padding: 12px 14px; }
.facts { margin: 6px 0; gap: 4px 16px; }
.row-buttons { margin: 6px 0; }
.row-buttons button { padding: 6px 12px; font-size: 14px; }
h3 { margin: 10px 0 4px; font-size: 15px; }
th, td { padding: 5px 6px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }
.code-box.small { font-size: 15px; padding: 3px 8px; letter-spacing: 1px; }
.shop-list { max-height: calc(100vh - 190px); }

/* ---------- full screen: the page always fills the whole window ---------- */
#app { display: flex; flex-direction: column; height: 100vh; }
main { flex: 1 1 auto; min-height: 0; max-width: none; width: 100%; display: flex; flex-direction: column; }
#tab-shops { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#tab-plans, #tab-keys { flex: 1 1 auto; overflow: auto; }
.split { flex: 1 1 auto; min-height: 0; align-items: stretch; grid-template-columns: minmax(320px, 26%) 1fr; }
.list-panel { display: flex; flex-direction: column; min-height: 0; }
.shop-list { flex: 1 1 auto; max-height: none; min-height: 0; }
.detail-panel { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
@media (max-width: 900px) {
    #app { height: auto; min-height: 100vh; }
    .split { grid-template-columns: 1fr; }
}

/* ---------- shop list: smaller cards, dark thin scroll bar (no white bar with arrows) ---------- */
.shop-list { gap: 4px; padding-right: 2px; }
.shop { padding: 6px 10px; gap: 0 8px; }
.shop .name { font-size: 14px; }
.shop .sub { font-size: 12px; }
.shop .badge { font-size: 11px; padding: 1px 8px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal); }
::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
