:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-muted: #f3f3f1;
  --text: #1c1c1a;
  --text-secondary: #5c5c58;
  --text-muted: #8a8a85;
  --border: #e8e8e4;
  --border-strong: #d4d4cf;
  --primary: #1c1c1a;
  --primary-hover: #000000;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning-soft: #fffaeb;
  --shadow-sm: 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow-md: 0 8px 24px rgba(28, 28, 26, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --transition: 0.15s ease;
  --control-height: 42px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
}

.subtle {
  color: var(--text-muted);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  justify-self: start;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  justify-self: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar {
  display: none;
}

.admin-nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.admin-nav-link:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.admin-nav-link.is-active {
  color: var(--text);
  background: var(--surface-muted);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  flex-shrink: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Footer */
.site-footer {
  margin-top: 48px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--border);
}

.footer-inner p {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* Page layout */
.page-content {
  padding: 32px 0 40px;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-heading p {
  margin: 0;
  font-size: 15px;
}

.page-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.page-section {
  margin-bottom: 36px;
}

.page-section:last-child {
  margin-bottom: 0;
}

.locations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 20px;
  align-items: start;
}

.locations-column {
  margin-bottom: 0;
  min-width: 0;
}

.locations-column .filter-bar-compact {
  padding: 12px 14px;
}

.locations-column .filter-bar-compact .filter-fields {
  flex-wrap: wrap;
}

.locations-column .panel {
  margin-bottom: 0;
}

.locations-column .actions {
  flex-wrap: wrap;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 0;
  font-size: 13px;
}

.filter-bar-compact {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.filter-bar-compact .filter-bar-head {
  display: none;
}

.filter-bar-compact .filter-fields {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 12px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter-bar-compact .filter-field {
  flex: 0 0 auto;
  min-width: 150px;
}

.filter-bar-compact .filter-field-wide {
  flex: 1 1 180px;
  min-width: 140px;
}

.filter-bar-compact .filter-field select,
.filter-bar-compact .filter-field input[type="search"],
.filter-bar-compact .filter-field input[type="text"],
.filter-bar-compact .filter-field input[type="email"],
.filter-bar-compact .filter-field input[type="date"] {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 12px;
  line-height: 1.2;
}

.filter-bar-compact .filter-field select {
  min-width: 140px;
  padding: 0 36px 0 12px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

.filter-bar-compact .filter-field:not(.filter-field-wide) select {
  min-width: 140px;
}

.filter-bar-compact .filter-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  align-items: flex-end;
  white-space: nowrap;
  padding-bottom: 0;
  margin-left: 4px;
}

.filter-bar-compact .filter-actions .btn {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
}

.filter-form.filter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.per-page-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.per-page-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.per-page-select {
  width: auto;
  min-width: 80px;
  height: 36px;
  min-height: 36px;
  padding: 0 32px 0 10px;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  cursor: pointer;
}

/* Auth */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.auth-card-wide {
  width: min(460px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-brand .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  /* background: var(--primary); */
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.auth-brand .brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-card > .subtle {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.6;
}

.auth-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.qr-image {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-sm);
  background: #fff;
}

.manual-key {
  margin: 0 0 20px;
  font-size: 13px;
}

.manual-key code {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 12px;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.auth-footer-link {
  margin: 20px 0 0;
  text-align: center;
  font-size: 14px;
}

.auth-footer-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
}

.auth-footer-link a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Dashboard */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-arrow {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.stat-card:hover .stat-arrow {
  transform: translateX(2px);
}

.stat-value {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* Filters */
.filter-bar {
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.filter-bar-head {
  margin-bottom: 16px;
}

.filter-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.filter-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 132px;
}

.filter-field-wide {
  min-width: 220px;
  flex: 1;
}

.filter-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
  margin-bottom: 2px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Panel & table */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

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

thead th {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fcfcfb;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 18px !important;
  font-size: 14px;
}

.balance-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.table-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.actions form {
  margin: 0;
}

.table-footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  overflow-x: auto;
  scrollbar-width: thin;
}

.pagination-info {
  margin: 0 auto 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.pagination-info strong {
  color: var(--text);
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  width: 100%;
}

.pagination-controls .btn-sm {
  flex-shrink: 0;
  white-space: nowrap;
}

.pagination-page {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Forms */
.form-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.form-stack label,
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

.filter-bar-compact select,
.filter-bar select,
.per-page-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

input::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 28, 26, 0.08);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.btn:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(28, 28, 26, 0.12);
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-muted);
}

.btn-secondary {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.btn-secondary:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

.btn-sm {
  padding: 7px 11px;
  font-size: 13px;
}

.btn-icon {
  padding: 9px;
  gap: 0;
}

.btn-sm.btn-icon {
  padding: 7px;
}

.btn-danger {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger:hover {
  background: #fee4e2;
  border-color: #fda29b;
}

.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Pills & alerts */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.pill-active {
  background: var(--success-soft);
  color: var(--success);
}

.pill-inactive {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.pill-status-preparing {
  background: #e0e7ff;
  color: #3730a3;
}

.pill-status-prepared {
  background: #d1fae5;
  color: #065f46;
}

.prepared-countdown {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  color: #065f46;
  white-space: nowrap;
}

.pill-status-proccesing {
  background: #dbeafe;
  color: #1e40af;
}

.pill-status-completed {
  background: var(--success-soft);
  color: var(--success);
}

.pill-status-Canceled {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-grid-single {
  grid-template-columns: minmax(0, 320px);
}

.stat-grid-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .stat-grid-row {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .stat-grid-row .stat-card {
    flex: 0 0 min(220px, 78vw);
    min-width: 180px;
  }
}

.stat-card-static {
  cursor: default;
  pointer-events: none;
}

.stat-card-static:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.table-link {
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
}

.table-single-line {
  table-layout: fixed;
}

.table-single-line tbody td {
  max-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-single-line tbody td.actions,
.table-single-line tbody td.empty-cell {
  max-width: none;
  overflow: visible;
  white-space: nowrap;
}

.table-single-line .table-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.table-link:hover {
  text-decoration: underline;
}

.alert {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px 14px;
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
  margin: 0 0 20px;
  font-size: 14px;
}

.alert-success {
  background: #ecfdf3;
  color: #027a48;
  border-color: #abefc6;
}

/* Gmail admin */
.gmail-page .page-heading {
  margin-bottom: 20px;
}

.gmail-alerts {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.gmail-alerts .alert {
  margin: 0;
}

.gmail-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.gmail-sidebar,
.gmail-main,
.gmail-setup-panel,
.gmail-empty-panel,
.gmail-message-panel {
  padding: 20px;
}

.gmail-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.gmail-sidebar-head h2,
.gmail-main-title h2,
.gmail-setup-panel h2,
.gmail-empty-panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.gmail-count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.gmail-account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.gmail-account-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.gmail-account-item:hover {
  border-color: var(--border-strong);
}

.gmail-account-item.is-active {
  border-color: #c7d7fe;
  background: #f5f8ff;
  box-shadow: inset 0 0 0 1px #eef4ff;
}

.gmail-account-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.gmail-account-avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.gmail-account-item.is-active .gmail-account-avatar {
  background: #dbeafe;
  color: #1d4ed8;
}

.gmail-account-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.gmail-account-email {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmail-account-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.gmail-account-meta.is-expired {
  color: var(--danger);
}

.gmail-account-meta.is-refresh-expired {
  color: var(--danger);
  font-weight: 600;
}

.gmail-account-item.is-refresh-expired {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.gmail-refresh-expired-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gmail-reconnect-btn {
  flex-shrink: 0;
}

.gmail-account-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gmail-account-actions form {
  display: inline-flex;
}

.gmail-account-actions .btn-icon.is-selected {
  background: var(--surface-muted);
  color: var(--text);
}

.gmail-main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.gmail-main-title p {
  margin: 6px 0 0;
}

.gmail-folder-tabs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.gmail-folder-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.gmail-folder-tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.gmail-folder-tab.is-active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.gmail-folder-tab .lucide-icon {
  width: 15px;
  height: 15px;
}

.gmail-main-alert {
  margin: 0 0 16px;
}

.gmail-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.gmail-table-wrap thead th:first-child,
.gmail-table-wrap tbody td:first-child {
  padding-left: 16px;
}

.gmail-table-wrap thead th:last-child,
.gmail-table-wrap tbody td:last-child {
  padding-right: 16px;
}

.gmail-load-more {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  padding-top: 4px;
}

.gmail-setup-panel,
.gmail-empty-panel {
  display: grid;
  justify-items: start;
  gap: 12px;
  max-width: 560px;
}

.gmail-empty-panel-inline {
  justify-items: center;
  text-align: center;
  max-width: none;
  padding: 48px 24px;
}

.gmail-setup-icon,
.gmail-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.gmail-empty-icon .lucide-icon,
.gmail-setup-icon .lucide-icon {
  width: 22px;
  height: 22px;
}

.gmail-setup-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.gmail-setup-list li + li {
  margin-top: 6px;
}

.gmail-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.gmail-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.gmail-breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

.gmail-message-panel .mail-meta {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mail-meta {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
}

.mail-meta div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
}

.mail-meta dt {
  margin: 0;
  font-weight: 600;
  color: var(--text-secondary);
}

.mail-meta dd {
  margin: 0;
  word-break: break-word;
}

.slip-detail-meta {
  margin-top: 4px;
}

.slip-detail-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.slip-detail-approved {
  font-weight: 600;
}

.mail-body-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-muted);
}

.mail-body-frame {
  width: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
}

.mail-body-text {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.modal-subtext {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 26, 0.32);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal.is-open {
  display: flex;
}

.modal .modal.is-open {
  z-index: 1010;
}

body.modal-open {
  overflow: hidden;
}

.modal-content {
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.modal-content-wide {
  width: min(560px, 100%);
}

.modal-content-full {
  width: min(1120px, 100%);
}

.modal-slot-view {
  overflow: hidden;
  max-height: calc(100vh - 40px);
}

.modal-slot-view .modal-body-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-slot-view .modal-header,
.modal-slot-view .modal-subtext,
.modal-slot-view .slip-pay-error,
.modal-slot-view .modal-footer {
  flex-shrink: 0;
}

.modal-slot-view .modal-subtext {
  margin-bottom: 12px;
}

.modal-slot-view .slip-pay-error:not([hidden]) {
  margin-bottom: 12px;
}

.modal-slot-view .panel-flat {
  margin: 0;
}

.modal-slot-view .panel-flat .table-wrap {
  overflow: visible;
  border: none;
  border-radius: 0;
}

.modal-slot-view .modal-body-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--border);
}

.modal-slot-view .modal-header {
  position: static;
  margin-bottom: 12px;
  padding-bottom: 0;
}

.modal-slot-view .modal-footer {
  margin-top: 0;
  position: static;
}

.panel-flat {
  border: none;
  box-shadow: none;
  background: transparent;
}

.panel-flat .table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.slot-slip-panel {
  display: grid;
  gap: 10px;
}

.slot-slip-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.slot-slip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-height: 48px;
}

.slot-slip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  cursor: grab;
}

.slot-slip-item.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.slot-slip-grip {
  display: inline-flex;
  color: var(--text-muted);
  flex-shrink: 0;
}

.slot-slip-label {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.slot-slip-details {
  flex: 1;
  min-width: 0;
}

.slot-slip-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-slip-remove {
  flex-shrink: 0;
}

.slot-slip-empty {
  margin: 0;
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.slot-slip-empty.is-hidden {
  display: none;
}

.slot-add-slip-field {
  display: block;
}

.slot-add-slip-field label {
  margin: 0 0 8px;
}

.slot-slip-dropdown {
  position: relative;
}

.slot-slip-dropdown input[type='search'] {
  width: 100%;
}

.slot-slip-dropdown.is-open .slot-slip-dropdown-menu {
  display: block;
}

.slot-slip-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.slot-slip-dropdown-menu[hidden] {
  display: none;
}

.slot-slip-dropdown-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.slot-slip-dropdown-option:last-of-type {
  border-bottom: none;
}

.slot-slip-dropdown-option:hover:not(:disabled),
.slot-slip-dropdown-option:focus-visible {
  background: var(--row-alt);
  outline: none;
}

.slot-slip-dropdown-option.is-hidden {
  display: none;
}

.slot-slip-dropdown-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.slot-slip-dropdown-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.slot-slip-dropdown-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.slot-slip-dropdown-empty {
  margin: 0;
  padding: 14px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.slot-slip-dropdown-no-match[hidden] {
  display: none;
}

.slot-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  padding-bottom: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--surface);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.lucide-icon {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
  flex-shrink: 0;
}

.btn-sm .lucide-icon {
  width: 14px;
  height: 14px;
}

.icon-btn .lucide-icon {
  width: 18px;
  height: 18px;
}

.actions .table-subtext {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.slip-processing .lucide-icon {
  animation: slip-spin 0.9s linear infinite;
}

@keyframes slip-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.icon-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

/* Error page */
.error-page {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.error-card {
  width: min(420px, 100%);
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.error-card h1 {
  margin: 0 0 8px;
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.error-card p {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 15px;
}

/* Responsive */
@media (max-width: 1024px) {
  .locations-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .locations-column {
    margin-bottom: 0;
  }
}

@media (max-width: 860px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    padding: 12px 0;
    min-height: auto;
  }

  .admin-nav {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    padding-bottom: 4px;
  }

  .header-actions {
    justify-self: end;
  }

  .user-name {
    display: none;
  }

  .page-heading-row {
    flex-direction: column;
    align-items: stretch;
  }

  .gmail-layout {
    grid-template-columns: 1fr;
  }

  .gmail-main-head {
    flex-direction: column;
    align-items: stretch;
  }

  .gmail-folder-tabs {
    width: 100%;
  }

  .gmail-folder-tab {
    flex: 1;
    justify-content: center;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .page-content {
    padding: 24px 0 32px;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .auth-card {
    padding: 24px;
  }

  thead th,
  tbody td {
    padding: 12px 14px;
  }

  .actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

.slot-view-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.slot-book-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 36px;
}

.slot-book-countdown {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 8px 14px;
}

.pill-book-held {
  background: #eff8ff;
  color: #175cd3;
}
