/* Ol' Tees Shop — Light / Dark / LCARS
   Accent text is pink. Green is never used. */

:root {
  --pink: #e84d9a;
  --pink-soft: #ff7eb6;
  --gold: #d4b04a;
  --copper: #c47a42;
  --danger: #e05a4f;
  --ok: #4c8dff;
  --font: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  --display: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --radius: 14px;
  --header-h: 64px;
}

html[data-theme="light"] {
  --bg: #e7ecf4;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --text: #1c2333;
  --muted: #5c6578;
  --line: #d5dce8;
  --header: #162033;
  --header-text: #f7c6de;
  --accent: #d63384;
  --shadow: 0 10px 30px rgba(22, 32, 51, .08);
  --input: #f4f7fb;
}

html[data-theme="dark"] {
  --bg: #0d1118;
  --bg-2: #121826;
  --panel: #171e2b;
  --text: #e8edf7;
  --muted: #9aa6bd;
  --line: #2a3346;
  --header: #0a0e16;
  --header-text: #ff8ec4;
  --accent: #ff7eb6;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  --input: #101623;
}

html[data-theme="lcars"] {
  --bg: #050508;
  --bg-2: #0b0b12;
  --panel: #0e0e16;
  --text: #ffb6d9;
  --muted: #c9a0de;
  --line: #ff9900;
  --header: #000000;
  --header-text: #ffcc66;
  --accent: #ff86c8;
  --shadow: none;
  --input: #000;
  --radius: 24px 8px 8px 24px;
  --gold: #ffcc66;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, .brand-name { font-family: var(--display); color: var(--accent); letter-spacing: .02em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0 0 .4rem; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
p { line-height: 1.55; }

/* Header */
.site-header {
  height: var(--header-h);
  background: var(--header);
  color: var(--header-text);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.1rem;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--header-text);
  text-decoration: none;
  white-space: nowrap;
}
.brand img {
  height: 40px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
  background: rgba(255,255,255,.06);
  border-radius: 6px;
}
.brand-name { font-size: 1.15rem; color: var(--header-text); margin: 0; }
.nav-main {
  display: flex;
  align-items: center;
  gap: .15rem;
  flex: 1;
  overflow-x: auto;
}
.nav-main a {
  color: var(--header-text);
  padding: .45rem .75rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: .92rem;
  opacity: .88;
}
.nav-main a:hover, .nav-main a.is-active { background: color-mix(in srgb, var(--accent) 22%, transparent); opacity: 1; }
.header-tools { display: flex; align-items: center; gap: .6rem; }
.theme-select, select, input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .45rem .65rem;
}
.theme-select { color: var(--header-text); background: transparent; border-color: color-mix(in srgb, var(--header-text) 35%, transparent); }
.user-chip { font-size: .85rem; color: var(--header-text); opacity: .85; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--accent);
  color: #1a1020;
  font-weight: 650;
  border: 0;
  border-radius: 999px;
  padding: .5rem 1rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--header-text);
  border: 1px solid color-mix(in srgb, var(--header-text) 35%, transparent);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }

/* Layout */
.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.1rem 2rem;
}
.page-shell {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}
.hero-panel { padding: 1.6rem 1.6rem 1.8rem; }
.lede { color: var(--muted); margin-top: 0; }

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Admin */
.admin-body { display: flex; flex-direction: column; min-height: 100vh; }
.admin-frame { display: flex; flex: 1; min-height: 0; }
.admin-side {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: .8rem .7rem 1.4rem;
  overflow-y: auto;
}
.side-cat { margin: .85rem .4rem .35rem; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.admin-side a {
  display: block;
  color: var(--text);
  padding: .45rem .7rem;
  border-radius: 10px;
  text-decoration: none;
}
.admin-side a:hover, .admin-side a.is-active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.admin-main { flex: 1; min-width: 0; overflow: auto; padding: 1.1rem 1.2rem 2rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.head-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.sort-inline { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.sort-inline input[type="number"],
.sort-inline-input { width: 4.5rem; min-width: 4.5rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .94rem;
}
table.data th, table.data td {
  text-align: left;
  padding: .65rem .55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th { color: var(--accent); font-weight: 650; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
table.data tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
table.data th:last-child,
table.data td:last-child {
  text-align: right;
  white-space: nowrap;
}
table.data th.col-num,
table.data td.col-num {
  text-align: right;
  white-space: nowrap;
  width: 4rem;
}
table.data th.col-money,
table.data td.col-money {
  text-align: right;
  white-space: nowrap;
  min-width: 9rem;
  vertical-align: middle;
}
table.data td.col-money .money {
  justify-content: flex-end;
}
.disc-note { margin-right: .35rem; color: var(--muted); }
.thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--input);
  border: 1px solid var(--line);
  display: block;
}
.actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  align-items: center;
}
td.actions {
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
}
td.actions form {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: middle;
}
td.actions .btn { vertical-align: middle; }
.badge {
  display: inline-block;
  font: inherit;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
span.badge { cursor: default; }
.badge-on { color: var(--accent); border-color: var(--accent); }
.badge-off { color: var(--muted); }
.badge-hide { color: var(--danger); border-color: var(--danger); }
table.data td form { margin: 0; }
input[type="hidden"] {
  display: none !important;
  width: auto !important;
  padding: 0 !important;
  border: 0 !important;
}

/* Forms */
.form-grid { display: grid; gap: .85rem; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
label.fld { display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; color: var(--accent); }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="date"], input[type="week"], input[type="month"], input[type="search"], textarea, select {
  width: 100%;
}
textarea { min-height: 160px; resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; }
.md-help { font-size: .8rem; color: var(--muted); }

/* Auth */
.auth-body { display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
}

/* Flash */
.flash { padding: .7rem .9rem; border-radius: 10px; margin-bottom: 1rem; }
.flash-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.flash-error { background: color-mix(in srgb, var(--danger) 18%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }

/* Money / coins */
.money {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.coin { flex: 0 0 auto; white-space: nowrap; }
.coin { display: inline-flex; align-items: center; gap: .25rem; color: var(--text); font-variant-numeric: tabular-nums; }
.coin img { width: 22px; height: 22px; }
.coin-sm img { width: 16px; height: 16px; }

/* Shop grid */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.item-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.item-card .pic {
  aspect-ratio: 1;
  background: var(--input);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.item-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.item-card .body { padding: .85rem .95rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.item-card h3 { margin: 0; font-size: 1.05rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag {
  font-size: .72rem;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: .1rem .5rem;
}
.search-bar { margin-bottom: 1rem; }

/* News */
.news-list { display: grid; gap: 1rem; }
.news-card h2 { margin-bottom: .2rem; }
.meta { color: var(--muted); font-size: .85rem; }

/* Markdown */
.md-body h1, .md-body h2, .md-body h3 { color: var(--accent); }
.md-body ul { padding-left: 1.2rem; }
.md-body ul ul { margin-top: .2rem; }
.md-body ul ul ul { list-style-type: square; }
.md-center { text-align: center; }
.md-center img { display: inline-block; margin: .3rem auto; }
.md-right { text-align: right; }
.md-right img { display: inline-block; }

/* Cash register */
.register { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; }
.register-list { max-height: 62vh; overflow: auto; }
.cart-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.cart-line { padding: .55rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .4rem; }
.cart-line-top { display: grid; grid-template-columns: 1fr 70px auto; gap: .5rem; align-items: center; }
.disc-row { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.sale-disc { margin-top: .85rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.total-line { display: flex; justify-content: space-between; align-items: center; margin-top: .55rem; font-size: 1.05rem; gap: 1rem; }
.total-line .money { flex-shrink: 0; }
.receipt-totals { margin-top: 1rem; max-width: 28rem; margin-left: auto; }

/* LCARS extras */
html[data-theme="lcars"] .site-header {
  border-bottom: 8px solid #ff9900;
  border-radius: 0 0 0 28px;
}
html[data-theme="lcars"] .admin-side {
  background: #000;
  border-right: 10px solid #cc99ff;
  border-radius: 0 28px 28px 0;
}
html[data-theme="lcars"] .panel {
  border: 3px solid #ff9900;
  border-radius: 0 24px 24px 0;
}
html[data-theme="lcars"] .btn {
  background: #ff9900;
  color: #000;
  border-radius: 20px 6px 6px 20px;
}
html[data-theme="lcars"] .btn-danger { background: #cc6666; color: #000; }
html[data-theme="lcars"] .btn-ok { background: #9999ff; color: #000; }
html[data-theme="lcars"] table.data th { color: #ffcc66; }

.hamburger { display: none; background: none; border: 0; color: var(--header-text); font-size: 1.4rem; cursor: pointer; }

@media (max-width: 860px) {
  .form-grid.two, .register { grid-template-columns: 1fr; }
  .admin-frame { flex-direction: column; }
  .admin-side { width: 100%; display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-side.open { display: block; }
  .hamburger { display: inline-block; }
  .nav-main { display: none; }
  .nav-main.open { display: flex; position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--header); flex-direction: column; padding: .5rem; }
}

@media print {
  .site-header, .site-footer, .admin-side, .no-print { display: none !important; }
  body { background: #fff; color: #111; }
}
