/* ==========================================================================
   RestaurantOS — Design System (Light)
   All colour, spacing and elevation comes from the tokens below.
   Templates must not hardcode colours; use these classes/variables instead.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg-body: #f6f7f9;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  /* Lines */
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --border-light: #f1f5f9;

  /* Text */
  --text-bright: #0f172a;
  --text-main: #1e293b;
  --text-dim: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Brand */
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --accent-border: #a7f3d0;
  --accent-glow: rgba(5, 150, 105, 0.16);
  --accent-contrast: #ffffff;

  /* Semantic */
  --error: #dc2626;
  --error-soft: #fef2f2;
  --error-border: #fecaca;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --purple-border: #ddd6fe;
  --teal: #0d9488;
  --teal-soft: #f0fdfa;
  --teal-border: #99f6e4;

  /* Status */
  --status-pending: #d97706;
  --status-preparing: #2563eb;
  --status-ready: #059669;
  --status-served: #7c3aed;
  --status-completed: #0d9488;
  --status-cancelled: #dc2626;

  --table-available: #059669;
  --table-occupied: #dc2626;
  --table-reserved: #d97706;
  --table-maintenance: #64748b;

  /* Geometry */
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --sidebar-w: 252px;
  --header-h: 64px;

  /* Motion & depth */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.16s var(--ease);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 6px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.18), 0 4px 12px -4px rgba(16, 24, 40, 0.08);
  --ring: 0 0 0 3px var(--accent-glow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.app-shell { display: flex; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: padding-box; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text-bright); letter-spacing: -0.018em; line-height: 1.3; }
a { color: inherit; text-decoration: none; transition: var(--transition); }
strong { color: var(--text-bright); font-weight: 600; }
small { font-size: 0.8125rem; }

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

/* --------------------------------------------------------------------------
   Icons
   Sized by class AND by width/height attributes in the markup, so a stale or
   failed stylesheet can never blow SVGs up to their natural size.
   -------------------------------------------------------------------------- */

.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.75; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
svg { max-width: 100%; }

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.26s var(--ease);
}

.brand {
  height: var(--header-h);
  padding: 0 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent) 0%, #0d9488 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px -1px rgba(5, 150, 105, 0.35);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-size: 0.9375rem; font-weight: 700; color: var(--text-bright); letter-spacing: -0.02em; white-space: nowrap; }
.brand-sub { font-size: 0.625rem; color: var(--text-faint); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; }

.nav-section { padding: 0 0.75rem; margin-top: 1.15rem; }

.nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 0 0.65rem;
  margin-bottom: 0.4rem;
}

.nav-menu {
  flex: 1;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover { background: var(--bg-hover); color: var(--text-bright); }

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

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-link.active .nav-badge { background: var(--accent); border-color: transparent; color: #fff; }

.nav-bottom { padding: 0.75rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.logout-link:hover { color: var(--error); background: var(--error-soft); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease);
}
.sidebar-backdrop.active { opacity: 1; pointer-events: all; }

/* ==========================================================================
   Main layout
   ========================================================================== */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  min-height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.header-title { font-size: 1.0625rem; font-weight: 700; color: var(--text-bright); }
.header-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 1px; }

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-toggle:hover { background: var(--bg-hover); }

.header-right { display: flex; align-items: center; gap: 0.65rem; }

.header-clock {
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.28rem 0.7rem 0.28rem 0.28rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.user-details { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.8125rem; font-weight: 600; color: var(--text-bright); }
.user-role { font-size: 0.6875rem; color: var(--text-muted); }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent) 0%, #0d9488 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

.content-wrapper { padding: 1.5rem; flex: 1; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.card-hoverable:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 0.9375rem; font-weight: 700; color: var(--text-bright); display: flex; align-items: center; gap: 0.5rem; }
.card-title .icon { color: var(--text-faint); }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header { padding: 1.1rem 1.25rem; margin-bottom: 0; }

/* ==========================================================================
   Stat cards
   ========================================================================== */

.stat-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  overflow: hidden;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stat-soft, var(--accent-soft));
  border: 1px solid var(--stat-border, var(--accent-border));
  color: var(--stat-accent, var(--accent));
  flex-shrink: 0;
}

.stat-info { min-width: 0; }

.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }
.stat-meta.up { color: var(--accent); }
.stat-meta.down { color: var(--error); }

.meter { height: 6px; border-radius: var(--radius-pill); background: var(--bg-active); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--meter-color, var(--accent)); transition: width 0.5s var(--ease); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-responsive { overflow-x: auto; }

.styled-table { width: 100%; border-collapse: collapse; }

.styled-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 1.25rem;
  text-align: left;
  white-space: nowrap;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.styled-table td {
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.styled-table tbody tr { transition: background 0.14s var(--ease); }
.styled-table tbody tr:hover { background: var(--bg-subtle); }
.styled-table tbody tr:last-child td { border-bottom: none; }
.num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: inherit;
  font-size: 0.875rem;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
  appearance: none;
}

.form-control::placeholder { color: var(--text-faint); }
.form-control:hover, .form-select:hover { border-color: #9ca3af; }

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 15px;
  padding-right: 2rem;
  cursor: pointer;
}

textarea.form-control { min-height: 74px; resize: vertical; line-height: 1.5; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.input-icon .form-control { padding-left: 2.15rem; }

.input-prefix { position: relative; }
.input-prefix::before {
  content: attr(data-prefix);
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8125rem;
  color: var(--text-muted);
  pointer-events: none;
}
.input-prefix .form-control { padding-left: 2.5rem; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px;
  height: 21px;
  border-radius: var(--radius-pill);
  background: var(--bg-active);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }
.switch-label { font-size: 0.875rem; color: var(--text-main); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  position: relative;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8438rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  line-height: 1.25;
}

.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background: var(--accent); color: #ffffff; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-sm); }

.btn-outline { background: var(--bg-card); border-color: var(--border-strong); color: var(--text-dim); box-shadow: var(--shadow-xs); }
.btn-outline:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text-bright); border-color: #9ca3af; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-bright); }

.btn-danger { background: var(--bg-card); border-color: var(--error-border); color: var(--error); box-shadow: var(--shadow-xs); }
.btn-danger:hover:not(:disabled) { background: var(--error); border-color: var(--error); color: #fff; }

.btn-danger-solid { background: var(--error); color: #fff; box-shadow: var(--shadow-xs); }
.btn-danger-solid:hover:not(:disabled) { background: #b91c1c; }

.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.7812rem; }
.btn-block { width: 100%; }
.btn-lg { padding: 0.7rem 1.25rem; font-size: 0.9062rem; }

.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-icon.btn-lg { width: 36px; height: 36px; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after, .btn-danger.is-loading::after { border-color: var(--text-muted); border-top-color: transparent; }

/* Segmented filter control */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-active);
  border-radius: var(--radius);
  overflow-x: auto;
  max-width: 100%;
}

.segmented::-webkit-scrollbar { height: 0; }

.seg-btn {
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.seg-btn:hover { color: var(--text-bright); }
.seg-btn.active { background: var(--bg-card); color: var(--text-bright); box-shadow: var(--shadow-sm); }

.seg-count {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0 5px;
  min-width: 17px;
  height: 17px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.07);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.seg-btn.active .seg-count { background: var(--accent-soft); color: var(--accent-hover); }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.16rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge.no-dot::before { display: none; }

.badge.neutral { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border); }
.badge.price { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-border); font-variant-numeric: tabular-nums; }

.badge.pending { background: var(--warn-soft); color: var(--status-pending); border-color: var(--warn-border); }
.badge.preparing { background: var(--info-soft); color: var(--status-preparing); border-color: var(--info-border); }
.badge.ready { background: var(--accent-soft); color: var(--status-ready); border-color: var(--accent-border); }
.badge.served { background: var(--purple-soft); color: var(--status-served); border-color: var(--purple-border); }
.badge.completed { background: var(--teal-soft); color: var(--status-completed); border-color: var(--teal-border); }
.badge.cancelled { background: var(--error-soft); color: var(--status-cancelled); border-color: var(--error-border); }

.badge.available { background: var(--accent-soft); color: var(--table-available); border-color: var(--accent-border); }
.badge.occupied { background: var(--error-soft); color: var(--table-occupied); border-color: var(--error-border); }
.badge.reserved { background: var(--warn-soft); color: var(--table-reserved); border-color: var(--warn-border); }
.badge.maintenance { background: var(--bg-subtle); color: var(--table-maintenance); border-color: var(--border-strong); }

.legend-item { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; color: var(--text-dim); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-item strong { color: var(--text-bright); font-variant-numeric: tabular-nums; }

.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); position: relative; flex-shrink: 0; }
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.8s ease-out infinite;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: all 0.2s var(--ease);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); opacity: 1; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.modal-title { font-size: 1.0625rem; font-weight: 700; }
.modal-desc { font-size: 0.8125rem; color: var(--text-muted); margin-top: 2px; }

.modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-faint);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-bright); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.confirm-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--error-soft);
  border: 1px solid var(--error-border);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

#toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 36px);
}

.toast {
  min-width: 260px;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  animation: slideIn 0.26s var(--ease) forwards;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
  color: var(--text-main);
}

.toast-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast.success .toast-icon { background: var(--accent-soft); color: var(--accent); }
.toast.error .toast-icon { background: var(--error-soft); color: var(--error); }
.toast.warning .toast-icon { background: var(--warn-soft); color: var(--warn); }

.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warn); }
.toast.fade-out { animation: slideOut 0.22s var(--ease) forwards; }

/* ==========================================================================
   Menu items
   ========================================================================== */

.menu-item-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

.menu-thumb {
  height: 92px;
  background: linear-gradient(140deg, #f0fdf4 0%, #ecfeff 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  position: relative;
}

.menu-thumb .icon { width: 32px; height: 32px; opacity: 0.55; }

.menu-thumb-price {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-xs);
}

.menu-body { padding: 1rem 1.05rem; display: flex; flex-direction: column; flex: 1; }
.menu-name { font-size: 0.9375rem; font-weight: 700; margin-bottom: 0.3rem; }

.menu-desc {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.35rem;
}

.menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-light);
}

.menu-item-card.is-unavailable .menu-thumb { filter: grayscale(1); opacity: 0.7; }

/* ==========================================================================
   Orders
   ========================================================================== */

.order-card { position: relative; padding-left: 1.25rem; }

.order-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--order-accent, var(--border-strong));
}

.order-card[data-status="pending"] { --order-accent: var(--status-pending); }
.order-card[data-status="preparing"] { --order-accent: var(--status-preparing); }
.order-card[data-status="ready"] { --order-accent: var(--status-ready); }
.order-card[data-status="served"] { --order-accent: var(--status-served); }
.order-card[data-status="completed"] { --order-accent: var(--status-completed); }
.order-card[data-status="cancelled"] { --order-accent: var(--status-cancelled); opacity: 0.7; }

.order-id { font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.order-meta { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; font-size: 0.8125rem; color: var(--text-muted); }
.order-meta-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.order-meta-item .icon { color: var(--text-faint); }

.order-lines {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  margin: 0.9rem 0;
}

.order-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8438rem;
  color: var(--text-dim);
  padding: 0.18rem 0;
}

.order-line .qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 19px;
  padding: 0 5px;
  margin-right: 0.45rem;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-bright);
  font-size: 0.7188rem;
  font-weight: 700;
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border-strong);
  font-weight: 700;
  color: var(--text-bright);
  font-size: 0.9375rem;
}

.order-note {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #92400e;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.9rem;
}
.order-note .icon { color: var(--warn); }

.order-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }

/* Order builder (right rail) */
.builder { position: sticky; top: calc(var(--header-h) + 1.5rem); }

.picker-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem;
  background: var(--bg-subtle);
}

.picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: pointer;
}

.picker-row:hover { background: var(--bg-card); border-color: var(--border); box-shadow: var(--shadow-xs); }
.picker-name { font-size: 0.8438rem; font-weight: 600; color: var(--text-bright); }
.picker-price { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.cart {
  min-height: 68px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 230px;
  overflow-y: auto;
}

.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  animation: popIn 0.16s var(--ease);
}

.cart-info { min-width: 0; }
.cart-name { font-size: 0.8125rem; font-weight: 600; color: var(--text-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-sub { font-size: 0.7188rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.stepper { display: flex; align-items: center; gap: 1px; background: var(--bg-subtle); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 2px; }

.stepper button {
  width: 21px;
  height: 21px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.stepper button:hover { background: var(--bg-card); color: var(--text-bright); box-shadow: var(--shadow-xs); }
.stepper .qty-value { min-width: 20px; text-align: center; font-size: 0.8125rem; font-weight: 700; color: var(--text-bright); font-variant-numeric: tabular-nums; }

.cart-empty { text-align: center; padding: 1rem 0.5rem; color: var(--text-faint); font-size: 0.8125rem; }

.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.8438rem; color: var(--text-muted); padding: 0.25rem 0; }
.summary-row.total { font-size: 1.0625rem; font-weight: 800; color: var(--text-bright); padding-top: 0.55rem; margin-top: 0.35rem; border-top: 1px solid var(--border); }
.summary-row .val { font-variant-numeric: tabular-nums; }
.summary-row.total .val { color: var(--accent); }

/* ==========================================================================
   Tables (restaurant floor)
   ========================================================================== */

.table-card { text-align: center; position: relative; padding: 1.35rem 1rem 1rem; overflow: hidden; }

.table-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--seat-color, var(--border-strong));
}

.table-card[data-status="available"] { --seat-color: var(--table-available); }
.table-card[data-status="occupied"] { --seat-color: var(--table-occupied); }
.table-card[data-status="reserved"] { --seat-color: var(--table-reserved); }
.table-card[data-status="maintenance"] { --seat-color: var(--table-maintenance); }

.table-delete { position: absolute; top: 0.55rem; right: 0.55rem; opacity: 0; transition: var(--transition); }
.table-card:hover .table-delete, .table-delete:focus-visible { opacity: 1; }

.table-number {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  color: var(--seat-color, var(--text-bright));
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.3rem;
}

.table-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); font-weight: 600; margin-bottom: 0.75rem; }
.table-capacity { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.table-capacity .icon { color: var(--text-faint); }

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.empty-state h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.15rem; }
.empty-state p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Login
   ========================================================================== */

.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 12% 12%, rgba(5, 150, 105, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 88% 88%, rgba(37, 99, 235, 0.06) 0%, transparent 40%),
    var(--bg-body);
}

.login-card {
  max-width: 396px;
  width: 100%;
  padding: 2.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.login-mark {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--accent) 0%, #0d9488 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.1rem;
  box-shadow: 0 8px 20px -8px rgba(5, 150, 105, 0.5);
}

.login-title { font-size: 1.3125rem; text-align: center; margin-bottom: 0.3rem; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.6rem; }

.alert {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 1.15rem;
}
.alert-error { background: var(--error-soft); border: 1px solid var(--error-border); color: #b91c1c; }

.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 2.5rem; }
.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  transition: var(--transition);
}
.password-toggle:hover { color: var(--text-dim); background: var(--bg-hover); }

/* Password strength meter (register) */
.strength { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.strength-bar { flex: 1; height: 4px; border-radius: var(--radius-pill); background: var(--bg-active); overflow: hidden; }
.strength-bar > span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 0.25s var(--ease), background 0.25s var(--ease); }
.strength-bar > span.weak { background: var(--error); }
.strength-bar > span.fair { background: var(--warn); }
.strength-bar > span.strong { background: var(--accent); }
.strength-text { font-size: 0.6875rem; font-weight: 600; white-space: nowrap; }
.strength-text.weak { color: var(--error); }
.strength-text.fair { color: var(--warn); }
.strength-text.strong { color: var(--accent); }

.form-hint.ok { color: var(--accent); font-weight: 600; }
.form-hint.bad { color: var(--error); font-weight: 600; }

.auth-switch {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}
.auth-switch:empty { display: none; }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-switch a:hover { color: var(--accent-hover); text-decoration: underline; }

.login-footer { text-align: center; font-size: 0.75rem; color: var(--text-faint); margin-top: 1rem; }

.hint-box {
  margin-top: 1.15rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}
.hint-box code {
  color: var(--text-bright);
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ==========================================================================
   Grids & utilities
   ========================================================================== */

.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 1.25rem; }
.grid-half { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.font-weight-bold { font-weight: 700; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* An author `display` rule outranks the UA style for [hidden]; restore it. */
[hidden] { display: none !important; }

/* ==========================================================================
   Chat widget (RestaurantOS Assistant)
   Sits above page chrome but below #toast-container (1100) so toasts always win.
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px -8px rgba(5, 150, 105, 0.55), var(--shadow-sm);
  transition: var(--transition);
  z-index: 1040;
}

.chat-launcher:hover { background: var(--accent-hover); transform: translateY(-2px); }
.chat-launcher:active { transform: translateY(0); }
.chat-launcher-close { display: none; }
.chat-launcher.is-open .chat-launcher-icon { display: none; }
.chat-launcher.is-open .chat-launcher-close { display: block; }

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 540px;
  max-height: calc(100vh - 130px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
  animation: popIn 0.18s var(--ease);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  flex-shrink: 0;
}

.chat-identity { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent) 0%, #0d9488 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-identity-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-name { font-size: 0.8438rem; font-weight: 700; color: var(--text-bright); }
.chat-status { font-size: 0.6875rem; color: var(--accent-hover); display: inline-flex; align-items: center; gap: 0.3rem; }
.chat-header-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  scroll-behavior: smooth;
}

.chat-intro { display: flex; flex-direction: column; gap: 0.6rem; }

.chat-msg {
  max-width: 86%;
  padding: 0.55rem 0.75rem;
  font-size: 0.8438rem;
  line-height: 1.5;
  border-radius: var(--radius);
  animation: popIn 0.16s var(--ease);
  overflow-wrap: anywhere;
}

.chat-msg.is-bot {
  align-self: flex-start;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-msg.is-user {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-msg.is-user strong { color: #ffffff; }
.chat-msg strong { font-weight: 700; color: var(--text-bright); }
.chat-msg ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.chat-msg li { margin-bottom: 0.15rem; }

.chat-msg--error {
  background: var(--error-soft);
  border-color: var(--error-border);
  color: #b91c1c;
}

.chat-retry {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  font-size: 0.7812rem;
  color: var(--error);
  cursor: pointer;
  text-decoration: underline;
}
.chat-retry:hover { color: #991b1b; }

.chat-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.chat-chip {
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.chat-chip:hover { background: var(--accent); border-color: var(--accent); color: #ffffff; }

.chat-typing { padding: 0 0.9rem 0.5rem; flex-shrink: 0; }
.chat-dots { display: inline-flex; gap: 4px; align-items: center; padding: 0.5rem 0.7rem; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); }
.chat-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint); animation: chatDots 1.2s ease-in-out infinite; }
.chat-dots i:nth-child(2) { animation-delay: 0.18s; }
.chat-dots i:nth-child(3) { animation-delay: 0.36s; }

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem 0.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 110px;
  padding: 0.5rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: inherit;
  font-size: 0.8438rem;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
  transition: var(--transition);
}
.chat-input::placeholder { color: var(--text-faint); }
.chat-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

.chat-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.chat-send:hover:not(:disabled) { background: var(--accent-hover); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-foot {
  padding: 0 0.85rem 0.7rem;
  font-size: 0.6875rem;
  color: var(--text-faint);
  text-align: center;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .chat-panel {
    right: 0; bottom: 0; left: 0; top: 0;
    width: auto;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .chat-launcher { right: 18px; bottom: 18px; }
  .chat-launcher.is-open { display: none; }
  .chat-msg { max-width: 90%; }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideIn { to { transform: translateX(0); } }
@keyframes slideOut { to { transform: translateX(120%); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes chatDots { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.fade-in { animation: fadeIn 0.28s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .builder { position: static; }
}

@media (max-width: 900px) {
  .header-clock { display: none; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .content-wrapper { padding: 1.1rem; }
  .header { padding: 0 1.1rem; }
  .user-details { display: none; }
  .user-chip { padding: 0.25rem; border: none; background: transparent; }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .toolbar > * { width: 100%; }
  .toolbar .btn { flex: 1; }
  .header-title { font-size: 0.9375rem; }
  .stat-number { font-size: 1.375rem; }
  #toast-container { left: 12px; right: 12px; top: 12px; }
  .toast { min-width: 0; }
}
