/* Shared styles for the tenant admin and platform (super admin) pages. */
:root {
  --sidebar-w: 250px;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --sidebar-bg: #171b26;
  --sidebar-text: #a8adb8;
  --sidebar-active-bg: #262b3a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; margin: 0; background: var(--bg); color: var(--text); }

/* ---- app shell: sidebar (checkbox-hack for the mobile overlay, no JS) ---- */
.app-shell { min-height: 100vh; }
.sidebar-toggle { display: none; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 100;
  transform: translateX(-100%); transition: transform .22s ease;
  overflow-y: auto;
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; }
.sidebar-toggle:checked ~ .sidebar { transform: translateX(0); }
.sidebar-toggle:checked ~ .sidebar-backdrop { display: block; }

.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px; }
.sidebar-brand .name { font-weight: 700; color: #fff; font-size: 15px; }
.sidebar-brand .sub { font-size: 11px; color: var(--sidebar-text); margin-top: 2px; }
.sidebar-close { background: none; border: none; color: var(--sidebar-text); cursor: pointer; padding: 4px; }
.sidebar-close svg { width: 20px; height: 20px; display: block; }

.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; padding: 16px 16px 6px; }
.sidebar-nav { flex: 1; padding-bottom: 12px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; margin: 2px 8px;
  border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-size: 14px;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--sidebar-active-bg); color: #fff; }

.sidebar-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who .u { font-size: 13px; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who .r { font-size: 11px; color: var(--sidebar-text); }
.sidebar-user form { margin: 0; }
.sidebar-user button { background: none; border: none; color: var(--sidebar-text); cursor: pointer; padding: 6px; }
.sidebar-user button svg { width: 17px; height: 17px; display: block; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.hamburger { display: flex; cursor: pointer; color: var(--text); }
.hamburger svg { width: 22px; height: 22px; }
.topbar-title { font-weight: 700; font-size: 16px; }

main.content { max-width: 1100px; margin: 0 auto; padding: 20px 20px 60px; }

@media (min-width: 900px) {
  .sidebar { transform: none; position: fixed; }
  .main { margin-left: var(--sidebar-w); }
  .hamburger, .sidebar-close { display: none; }
  .sidebar-backdrop { display: none !important; }
}

/* ---- content: cards, tables, forms, buttons, pills ---- */
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; }

input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 9px 10px; font-size: 15px; border: 1px solid #d1d5db; border-radius: 6px; margin-top: 4px;
}
label { display: block; font-size: 13px; color: #555; margin-top: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

button, .btn { padding: 9px 14px; font-size: 14px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
button.danger { background: #fff; color: #c0392b; border-color: #c0392b; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eee; }
.pill.new { background: #ffe6b3; }
.pill.cooking { background: #b3d9ff; }
.pill.served { background: #c6f0c2; }
.pill.done { background: #ddd; color: #888; }
.pill.paid { background: #c6f0c2; }
.pill.pending { background: #ffe6b3; }
.pill.active { background: #c6f0c2; }
.pill.suspended { background: #f5c6c6; }

.empty { color: #888; padding: 12px 0; }
.error { background: #fdecea; color: #c0392b; padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.success { background: #e8f7e6; color: #1e7a34; padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.tablewrap { overflow-x: auto; }
.mono { font-family: "Courier New", monospace; word-break: break-all; }

/* ---- stat cards (dashboard) ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.stat-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.bg-indigo { background: #eef0ff; color: #4f46e5; }
.bg-green { background: #e6f7ee; color: #0e9f6e; }
.bg-amber { background: #fef6e7; color: #c27803; }
.bg-red { background: #fdecea; color: #c0392b; }

/* ---- standalone pages: login ---- */
.loginwrap { max-width: 360px; margin: 60px auto; padding: 0 16px; }
.loginwrap h1 { font-size: 20px; margin: 0 0 4px; }
.loginwrap p.sub { color: #666; font-size: 13px; margin: 0 0 16px; }
.loginwrap button { width: 100%; margin-top: 20px; padding: 11px; font-size: 15px; }

@media (max-width: 600px) { main.content { padding: 14px 14px 60px; } }
