:root {
  --bg: #0f1420;
  --panel: #171d2c;
  --panel2: #1f2637;
  --border: #2b3348;
  --gold: #d4af6a;
  --gold-dark: #a9823f;
  --text: #eef1f7;
  --muted: #93a0b8;
  --ok: #3fb87f;
  --warn: #e0a83c;
  --danger: #e2564f;
  --seat-free: #2b3348;
  --seat-selected: #d4af6a;
  --seat-taken: #4a3238;
  --status-empty: #3fb87f;
  --status-partial: #e0a83c;
  --status-full: #e2564f;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top, #1a2135 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--gold); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 32, 0.9);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.5px;
}
.topbar h1 span { color: var(--gold); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.card h2 { margin-top: 0; font-size: 16px; color: var(--gold); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  transition: transform .05s ease, background .15s ease;
}
.btn:hover { background: #262e44; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #241a05; border: none; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

input, select, textarea {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: rgba(63,184,127,0.15); color: var(--ok); }
.badge.warn { background: rgba(224,168,60,0.15); color: var(--warn); }
.badge.danger { background: rgba(226,86,79,0.15); color: var(--danger); }
.badge.muted { background: rgba(147,160,184,0.15); color: var(--muted); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 10px 0 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--border); color: var(--muted); background: var(--panel2);
}
.tab.active { background: var(--gold); color: #241a05; border-color: var(--gold); font-weight: 700; }

.floor {
  position: relative;
  background: #10141f;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  overflow: auto;
  min-height: 420px;
}
.floor-inner { position: relative; background-size: 100% 100%; background-repeat: no-repeat; }

.table-box {
  position: absolute;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--panel2);
  padding: 6px;
  width: 78px;   /* fallback if no inline width is set */
  height: 60px;  /* fallback if no inline height is set */
  text-align: center;
  font-size: 11px;
  cursor: default;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.resize-handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 14px;
  height: 14px;
  background: var(--gold);
  border: 1px solid var(--gold-dark);
  border-radius: 3px;
  cursor: nwse-resize;
}
.table-box.round { border-radius: 50%; }
.table-box .tcode { font-weight: 700; color: var(--gold); display: block; margin-bottom: 4px; }
.table-box.selected-here { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,106,0.4); }

/* table status colors: kosong / terisi sebagian / penuh */
.table-box.status-empty  { border-color: var(--status-empty); background: rgba(63,184,127,0.14); }
.table-box.status-partial { border-color: var(--status-partial); background: rgba(224,168,60,0.18); }
.table-box.status-full   { border-color: var(--status-full); background: rgba(226,86,79,0.20); }
.table-box.status-empty .tcode  { color: var(--status-empty); }
.table-box.status-partial .tcode { color: var(--status-partial); }
.table-box.status-full .tcode   { color: var(--status-full); }

.floor-upload {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 13px; color: var(--muted);
}
.floor-upload input[type=file] { flex: 1; min-width: 200px; padding: 6px; }
.floor-thumb { width: 46px; height: 34px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

.seats { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.seat {
  width: 16px; height: 16px; border-radius: 4px;
  background: var(--seat-free);
  font-size: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.05);
}
.seat.taken { background: var(--seat-taken); color: #7a5a5a; cursor: not-allowed; }
.seat.selected { background: var(--seat-selected); color: #241a05; font-weight: 700; }
.seat.mine { background: rgba(63,184,127,0.35); color: var(--ok); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.data tr:hover td { background: rgba(255,255,255,0.02); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border); padding: 12px 18px;
  border-radius: 10px; font-size: 14px; z-index: 100; max-width: 90vw;
}
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--danger); color: var(--danger); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; }
.stat { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat .num { font-size: 24px; font-weight: 700; color: var(--gold); }
.stat .lbl { font-size: 12px; color: var(--muted); }

.muted { color: var(--muted); }
.center { text-align: center; }
.mt8{margin-top:8px}.mt16{margin-top:16px}.mb0{margin-bottom:0}

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .wrap { padding: 12px; }
  table.data { font-size: 12px; }
}
