/* ============================================================
DESIGN TOKENS
============================================================ */
:root {
  --bg:        #1a1814;
  --bg-card:   #242019;
  --bg-raised: #2e2a24;
  --border:    #3d3830;
  --text:      #e8e0d0;
  --text-dim:  #8a8070;
  --accent:    #c8943a;
  --accent-dim:#7a5a22;
  --danger:    #c84a3a;
  --success:   #4a8a5a;
  --font-ui:   'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --font-disp: 'Bebas Neue', sans-serif;
  --radius:    6px;
  --tap:       52px;
}


/* ============================================================
RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100dvh;
  overscroll-behavior: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font-ui);
  border: none;
  background: none;
}


/* ============================================================
UTILITIES
============================================================ */
.text-mono   { font-family: var(--font-mono); }
.text-dim    { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.dimmed { opacity: 0.5; }


/* ============================================================
LAYOUT
============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 12px;
  height: 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-family: var(--font-disp);
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-align: center;
}

.topbar-right {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.main {
  padding: 16px 12px 80px;
  max-width: 600px;
  margin: 0 auto;
}


/* ============================================================
CARDS
============================================================ */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: var(--tap);
  transition: border-color 0.15s;

  :active {
    border-color: var(--accent-dim);
  }
}

.card.has-variants {
  flex-direction: column;
  align-items: stretch;
}

.admin-item-card {
  flex-direction: column;
  align-items: stretch;
}

.card-name {
  font-size: 1rem;
  font-weight: 600;
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.card-total {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 500;
}

.item-view {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 0;
  font-size: 0.9rem;
}

.empty-icon {
  font-size: 7rem;
  margin-bottom: 12px;
  opacity: 0.4;
  display: flex;
  justify-content: center;
}


/* ============================================================
BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tap);
  padding: 0 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.15s;
  width: 100%;
  gap: 6px;

  :active { opacity: 0.8; }
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  margin-top: 16px;
}

.btn-sm {
  height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
  width: auto;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon.active {
  border-color: var(--success);
  color: var(--success);
}

.btn-icon.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon-sm.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 1.1rem;
  color: var(--text-dim);
  transition: color 0.15s, background 0.15s;

  :active {
    background: var(--bg-raised);
    color: var(--text);
  }
}

.fab {
  position: fixed;
  bottom: 72px;
  right: 20px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 52px;
  background: var(--accent);
  color: #1a1814;
  border-radius: 26px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(200,148,58,0.35);
  transition: transform 0.15s, box-shadow 0.15s;

  :active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(200,148,58,0.2);
  }
}

.fab-icon { font-size: 1.3rem; line-height: 1; }


/* ============================================================
FORMS & FIELDS
============================================================ */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  height: var(--tap);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 0 14px;
  appearance: none;

  :focus {
    outline: none;
    border-color: var(--accent-dim);
  }
}

.field-inline {
  flex: 1;
  height: var(--tap);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 0 14px;
  appearance: none;
  min-width: 0;

  :focus {
    outline: none;
    border-color: var(--accent-dim);
  }

  ::placeholder {
    color: var(--text-dim);
  }
}


.form-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}


/* ============================================================
MODAL
============================================================ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
  align-items: flex-end;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  padding: 20px 16px 36px;
}

.modal-title {
  font-family: var(--font-disp);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 16px;
}


/* ============================================================
TOAST
============================================================ */
.toast {
  position: fixed;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--success);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: bottom 0.25s ease, opacity 0.25s ease;
  white-space: nowrap;
  width: fit-content;
}

.toast.show {
  bottom: calc(var(--nav-height, 24px) + 24px);
  opacity: 1;
}


/* ============================================================
TABS PAGE
============================================================ */
.tab-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tab-header-name {
  font-family: var(--font-disp);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}

.tab-header-total {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--accent);
}


/* ============================================================
ROUND BLOCKS (tab detail)
============================================================ */
.round-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.round-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.round-subtotal {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
}

.round-subtotal.paid {
  color: var(--text-dim);
  text-decoration: line-through;
}

.round-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;

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

.round-item.paid {
  opacity: 0.45;
  text-decoration: line-through;
}

.round-item-qty {
  font-family: var(--font-mono);
  color: var(--text-dim);
  min-width: 28px;
}

.round-item-name {
  flex: 1;
  padding: 0 10px;
}

.round-item-price {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.badge-paid {
  display: inline-block;
  font-size: 0.65rem;
  background: var(--success);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ============================================================
ROUND PAGE (item picker)
============================================================ */
.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: 16px;

  ::-webkit-scrollbar { display: none; }
}

.cat-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  border-radius: 19px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1814;
  font-weight: 600;
}

.article-main {
  display: flex;
  align-items: center;
  width: 100%;
}

.article-main .article-name {
  flex: 1;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 120px;
}

.article-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: var(--tap);
}

.article-row.has-variants {
  flex-direction: column;
  align-items: stretch;
}

.article-name {
  font-size: 0.95rem;
  font-weight: 500;
  flex: 1;
}

.article-price {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0 14px;
}

.article-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;

  :active {
    background: var(--accent-dim);
    border-color: var(--accent);
  }
}

.qty-display {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  min-width: 20px;
  text-align: center;
  color: var(--accent);
}

.qty-display.zero { color: var(--text-dim); }

.basket-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 16px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.basket-bar.visible { transform: translateY(0); }

.basket-summary {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.basket-total {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 500;
  display: block;
}

.btn-send {
  background: var(--accent);
  color: #1a1814;
  font-weight: 700;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  white-space: nowrap;

  :disabled {
    background: var(--bg-raised);
    color: var(--text-dim);
  }
}


/* ============================================================
ADMIN
============================================================ */
.admin-btn {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.subcat-indent {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  margin-top: 4px;
}

.subcat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collapsible {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.collapsible-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: var(--font-ui);

  :active { background: var(--bg-card); }
}

.collapsible-icon {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.collapsible-body {
  display: none;
  padding: 16px;
}

.collapsible-body.open { display: block; }

/* ============================================================
BOTTOM NAV
============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  height: 60px;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  transition: color 0.15s;
  text-decoration: none;
}

.bottom-nav-item i {
  font-size: 1.4rem;
  line-height: 1;
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ============================================================
VARIANTS
============================================================ */
.variant-list {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 4px;
}

.variant-row {
  border-bottom: 1px solid var(--border);
}

.variant-row:last-child {
  border-bottom: none;
}

.variant-expand-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
  gap: 8px;
  border-top: 1px solid var(--border);
}

.variant-expand-row:first-child {
  margin-top: 4px;
}

.variant-expand-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-dim);
  padding-left: 8px;
}
