:root {
  --dark: #0b4f52;
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --bg: #f1f5f9;
  --text: #334155;
  --text-soft: #475569;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --border: #cbd5e1;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --pending-bg: #fef3c7;
  --pending-text: #92400e;
  --success-bg: #dcfce7;
  --success-text: #166534;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Sarabun', sans-serif;
}
h1, h2, h3, .stat-num, .font-prompt { font-family: 'Prompt', sans-serif; }
.muted { color: var(--muted); font-size: 13.5px; }
[hidden] { display: none !important; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--dark); color: #fff; }
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; flex-wrap: wrap; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #d97706, #b45309); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: 'Prompt', sans-serif; }
.brand-title { font-family: 'Prompt', sans-serif; font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 11.5px; color: #b2d9d6; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn { background: transparent; border: none; color: #fff; padding: 8px 14px; border-radius: 9px; font-size: 13.5px; }
.tab-btn.active { background: rgba(255,255,255,.16); }

/* Hero */
.hero { background: linear-gradient(120deg, #0d7377, #11999e, #14b8a6); color: #fff; padding: 40px 20px; }
.hero-inner { max-width: 1180px; margin: 0 auto; }
.hero h1 { font-size: 34px; font-weight: 700; margin: 0 0 8px; }
.hero p { max-width: 640px; opacity: .92; margin: 0 0 18px; }
.btn-cta { background: #fff; color: var(--dark); border: none; padding: 12px 22px; border-radius: 12px; font-weight: 600; font-size: 15px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.hero-stats { display: flex; gap: 32px; margin-top: 28px; flex-wrap: wrap; }
.stat-num { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; opacity: .9; }

/* Content */
.content { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.card { background: #fff; border-radius: 14px; box-shadow: 0 1px 4px rgba(15,23,42,.08); padding: 20px; margin-bottom: 18px; }
.card h3 { margin-top: 0; }

/* Accounts grid */
.grid-accounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
@media (max-width: 1024px) { .grid-accounts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-accounts { grid-template-columns: 1fr; } }
.account-card { border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.account-card .stripe { height: 8px; }
.account-card .body { padding: 16px; }
.account-card .name { font-family: 'Prompt', sans-serif; font-weight: 700; text-transform: uppercase; font-size: 17px; }
.account-card .status { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 8px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.free { background: #16a34a; }
.dot.busy { background: #dc2626; }
.account-card.inactive { opacity: .5; }

/* Buttons */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 10px; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: #e2e8f0; color: var(--text); border: none; padding: 9px 16px; border-radius: 8px; font-weight: 500; text-decoration: none; display: inline-block; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 9px 16px; border-radius: 8px; font-weight: 600; }
.btn-block { width: 100%; margin-top: 12px; padding: 12px; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 6px; }

/* Calendar */
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.segmented { background: #e2e8f0; border-radius: 10px; padding: 3px; display: inline-flex; }
.segmented button { border: none; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 13.5px; color: var(--text-soft); }
.segmented button.active { background: #fff; color: #0f766e; font-weight: 600; }
.calendar-nav { display: flex; gap: 8px; align-items: center; }
.calendar-nav button { border: 1px solid var(--border); background: #fff; padding: 7px 12px; border-radius: 8px; font-size: 13px; }
.calendar-nav input[type=date] { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.calendar-wrap { overflow-x: auto; }
#calendarBody { min-width: 760px; }

.cal-day-grid { display: grid; grid-template-columns: 60px repeat(var(--n-accounts, 4), 1fr); border-top: 1px solid #e2e8f0; border-left: 1px solid #e2e8f0; }
.cal-head-cell { padding: 8px; font-weight: 600; font-size: 13px; text-align: center; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.cal-time-cell { padding: 4px 6px; font-size: 11.5px; color: var(--muted); border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; text-align: right; }
.cal-cell { position: relative; min-height: 30px; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.booking-chip { border-left: 4px solid; border-radius: 6px; padding: 4px 6px; font-size: 11.5px; margin: 2px; cursor: pointer; line-height: 1.4; }

.cal-week-table, .cal-month-table { width: 100%; border-collapse: collapse; }
.cal-week-table th, .cal-week-table td, .cal-month-table th, .cal-month-table td { border: 1px solid #e2e8f0; padding: 6px; vertical-align: top; font-size: 12.5px; }
.cal-week-table th, .cal-month-table th { background: #f8fafc; }
.cal-month-table td { height: 90px; width: 14.28%; }
.cal-month-table td.today { background: #f0fdfa; }
.cal-month-table td.other-month { opacity: .4; }
.day-num { font-weight: 600; font-size: 12px; margin-bottom: 4px; }

/* Status badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.confirmed { background: var(--success-bg); color: var(--success-text); }
.badge.cancel_requested { background: var(--pending-bg); color: var(--pending-text); }
.badge.cancelled { background: #e2e8f0; color: var(--muted); }

/* My requests */
.my-search { display: flex; gap: 8px; margin-bottom: 14px; }
.my-search input { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.my-search button { border: none; background: var(--primary); color: #fff; border-radius: 10px; padding: 0 18px; }
.request-card { border-left: 4px solid var(--primary); background: #f8fafc; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.request-card .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.zoom-code-box { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 13px; }

/* Forms / modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-head { background: linear-gradient(120deg, #0d7377, #14b8a6); color: #fff; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; border-radius: 14px 14px 0 0; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { background: transparent; border: none; color: #fff; font-size: 18px; }
.modal-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-soft); font-weight: 500; }
input, select, textarea { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 14px; color: var(--text); }
.inline-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; }
@media (max-width: 900px) { .inline-form { grid-template-columns: 1fr 1fr; } }
.form-error { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-border); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 10px 0 0; }
.detail-box { background: #f8fafc; border-radius: 10px; padding: 14px; margin: 12px 0; font-size: 14px; line-height: 1.9; }

/* Admin */
.admin-login-box { max-width: 380px; margin: 40px auto; }
.admin-login-box form { display: flex; flex-direction: column; gap: 12px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.admin-subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-subnav button { border: 1px solid var(--border); background: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.admin-subnav button.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 720px) { .stat-cards { grid-template-columns: 1fr 1fr; } }
.stat-card { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.stat-card .num { font-family: 'Prompt', sans-serif; font-size: 26px; font-weight: 700; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1024px) { .admin-grid-2, .admin-grid-3 { grid-template-columns: 1fr; } }

.hbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.hbar-label { width: 110px; flex-shrink: 0; }
.hbar-track { flex: 1; background: #e2e8f0; border-radius: 6px; height: 14px; overflow: hidden; }
.hbar-fill { height: 100%; }
.hbar-val { width: 30px; text-align: right; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table th, table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e2e8f0; }
table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.filled-at { color: #0f766e; font-weight: 500; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
input:checked + .slider { background: var(--primary); }
input:checked + .slider::before { transform: translateX(16px); }
.row-inactive { opacity: .5; }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; margin: 16px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column-reverse; align-items: stretch; height: 100%; border-radius: 4px 4px 0 0; overflow: hidden; }
.bar-chart .bar-seg { width: 100%; }
.bar-chart .bar-month-label { text-align: center; font-size: 11px; color: var(--muted); margin-top: 4px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12.5px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

.standalone-page { max-width: 1180px; margin: 60px auto; padding: 0 20px; }

.account-name-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
