/* ==========================================================================
   Hotel Manager — admin design system
   One stylesheet, reused by every module. Edit tokens here, not per page.
   ========================================================================== */

:root {
  /* Palette */
  --ink:            #0f1f3d;   /* sidebar / darkest */
  --ink-2:          #16294a;   /* sidebar raised */
  --canvas:         #f4f6f9;   /* app background */
  --surface:        #ffffff;   /* cards, topbar */
  --line:           #e4e8ee;   /* borders */
  --line-strong:    #d4dae3;
  --text:           #16202e;   /* primary text */
  --muted:          #64748b;   /* secondary text */
  --faint:          #94a3b8;   /* tertiary text */

  --primary:        #0b5cab;   /* actions, links */
  --primary-600:    #094b8c;
  --primary-tint:   #e8f1fb;   /* primary backgrounds */
  --brass:          #e0a02e;   /* the one accent: active marker, highlights */

  --good:           #11835b;
  --good-tint:      #e3f3ec;
  --warn:           #b7791f;
  --warn-tint:      #fbf0da;
  --crit:           #c0392b;
  --crit-tint:      #fbe9e7;

  /* Shape */
  --r-sm: 7px;
  --r:    11px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(15,31,61,.06), 0 1px 3px rgba(15,31,61,.04);
  --shadow-pop: 0 10px 30px rgba(15,31,61,.14);

  --sidebar-w: 250px;
  --topbar-h: 62px;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* ---- Shell --------------------------------------------------------------- */
.app { display: flex; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: #c7d2e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -0.02em;
}
.sidebar .brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(140deg, var(--primary) 0%, #1a79d0 100%);
  display: grid; place-items: center; color: #fff; flex: 0 0 auto;
}
.sidebar .brand .mark svg { width: 18px; height: 18px; }

.nav { padding: 6px 10px 20px; }
.nav .group { margin-top: 14px; }
.nav .group > .label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: #6b7b96; text-transform: none;
  padding: 6px 12px 4px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: #c7d2e4; font-weight: 500; font-size: 13.5px;
  position: relative;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: .85; }
.nav a.active {
  background: var(--ink-2); color: #fff;
}
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brass);
}
.nav a.active svg { opacity: 1; color: var(--brass); }

.sidebar .foot {
  margin-top: auto; padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: #6b7b96;
}

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 16px; font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .who { display: flex; align-items: center; gap: 10px; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-tint); color: var(--primary-600);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.topbar .who .name { font-weight: 600; font-size: 13px; }
.topbar .who .role { color: var(--muted); font-size: 12px; }
.hamburger { display: none; background: none; border: 0; cursor: pointer; color: var(--text); padding: 6px; }
.hamburger svg { width: 22px; height: 22px; }

.content { padding: 24px; max-width: 1240px; width: 100%; }

/* ---- Page header --------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); margin-top: 3px; font-size: 14px; }
.page-head .actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.card .card-head h3 { font-size: 15px; }
.card .card-body { padding: 18px; }
.card .card-body.tight { padding: 0; }

/* ---- Stat tiles ---------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .k svg { width: 16px; height: 16px; color: var(--primary); }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 7px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; margin-top: 2px; color: var(--muted); }

/* ---- Tables -------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.table thead th {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: #fafbfc; border-bottom: 1px solid var(--line-strong);
}
.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { background: #f7f9fc; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-tint); text-decoration: none; }
.btn-danger { background: var(--crit); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---- Forms --------------------------------------------------------------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: #fff;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11,92,171,.14);
}
.help { color: var(--muted); font-size: 12px; margin-top: 5px; }

/* ---- Badges -------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-success { background: var(--good-tint); color: var(--good); }
.badge-warning { background: var(--warn-tint); color: var(--warn); }
.badge-critical{ background: var(--crit-tint); color: var(--crit); }
.badge-info    { background: var(--primary-tint); color: var(--primary-600); }
.badge-neutral { background: #eef1f5; color: var(--muted); }

/* ---- Alerts / flash ------------------------------------------------------ */
.alert { padding: 11px 14px; border-radius: var(--r-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: var(--crit-tint); color: var(--crit); border-color: #f3c7c1; }
.alert-success { background: var(--good-tint); color: var(--good); border-color: #bfe3d2; }
.alert-info { background: var(--primary-tint); color: var(--primary-600); border-color: #cfe2f6; }

/* ---- Empty state --------------------------------------------------------- */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---- Auth (login) -------------------------------------------------------- */
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1fr; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 32px 30px; }
.auth-card .brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-card .brand .mark { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(140deg, var(--primary), #1a79d0); display: grid; place-items: center; color: #fff; }
.auth-card .brand .mark svg { width: 21px; height: 21px; }
.auth-card .brand .name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 12px; margin-top: 4px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; height: 100dvh;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(15,31,61,.45); z-index: 50;
  }
  .hamburger { display: inline-flex; }
  .content { padding: 18px 16px; }
  .page-head { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Layout helpers ------------------------------------------------------ */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* ---- Row actions --------------------------------------------------------- */
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: #f7f9fc; color: var(--text); text-decoration: none; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--crit); border-color: #f3c7c1; background: var(--crit-tint); }

/* ---- Utilities ----------------------------------------------------------- */
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.strong { color: var(--text); font-weight: 600; }
