/* Desktop-first back office. Same accent as the ordering web app;
   light/dark follows the OS. */

:root {
  --accent: #c2410c;
  --accent-soft: #fff1ea;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --danger: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #fb923c;
    --accent-soft: #3b2417;
    --bg: #161412;
    --surface: #211e1b;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --border: #37322e;
    --danger: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Noto Sans Thai", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card h1 { margin: 0 0 8px; font-size: 22px; }

input {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input:focus { outline: 2px solid var(--accent); border-color: transparent; }

button {
  font: inherit;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

button:hover { border-color: var(--accent); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.error { color: var(--danger); margin: 4px 0 0; font-size: 14px; }
.muted { color: var(--muted); font-size: 14px; }

/* Shell */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand { font-weight: 800; font-size: 20px; color: var(--accent); }
.store-name { font-size: 14px; color: var(--muted); margin-bottom: 14px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}

.nav-item:hover { background: var(--accent-soft); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.content { flex: 1; padding: 28px 32px; max-width: 1100px; }

h1 { margin: 0 0 18px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 16px; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.page-head h1 { margin: 0; }

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

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

/* Stats */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  min-width: 150px;
}

.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat-alert { border-color: var(--accent); background: var(--accent-soft); }

/* Bars */
.bars { display: flex; align-items: flex-end; gap: 10px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar { width: 100%; max-width: 56px; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-label { font-size: 12px; color: var(--muted); }
.bar-value { font-size: 11px; color: var(--muted); }

/* Tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.list tr:last-child td { border-bottom: none; }
table.list .num { text-align: right; }
table.list tr.inactive td { color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 6px; padding: 4px 10px; font-size: 13px; }

/* Inline forms */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; }
.inline-form input { flex: 1; min-width: 140px; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; }
  .sidebar-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .content { padding: 18px; }
}
