/* MassageBooking Portal — warm editorial dark */
:root {
  --bg: rgb(38,38,36);
  --cream: #d4c8b8;
  --warm: #b8a892;
  --sand: #8a7a66;
  --gold: #c8a455;
  --gold-light: #d4b87a;
  --sage: #8a9c7e;
  --ok: #7fc95e;                 /* clear green — online state must be unmistakable */
  --espresso: #e8ddd0;
  --card-bg: rgba(255,255,255,.07);
  --card-border: rgba(255,255,255,.08);
  --input-bg: rgba(255,255,255,.05);
  --input-border: rgba(255,255,255,.12);
  --error: #d47070;
}

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

/* the hidden attribute must always win — class display rules (e.g. .divider's
   flex) otherwise override the UA stylesheet and leak hidden sections */
[hidden] { display: none !important; }

html { font-size: 16px; }

body {
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(200,164,85,.08), transparent),
                    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(138,156,126,.06), transparent);
  color: var(--cream);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--espresso); font-weight: normal; letter-spacing: .01em; }

a { color: var(--gold-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 18px 60px; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: baseline; gap: 10px;
  padding: 22px 0 14px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 26px;
}
.topbar .brand { font-size: 20px; color: var(--espresso); letter-spacing: .04em; }
.brand-mark {
  display: inline-block; width: 9px; height: 9px; margin-right: 10px;
  background: var(--gold); transform: rotate(45deg); border-radius: 2px;
  vertical-align: 1px;
}
.topbar nav { margin-left: auto; display: flex; gap: 18px; align-items: baseline; }
.topbar nav a { color: var(--sand); font-size: 16px; }
.topbar nav a:hover { color: var(--gold-light); text-decoration: none; }

/* ---- cards ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card.accent { border-left: 3px solid var(--gold); }

.device-card { display: block; color: inherit; transition: border-color .18s, transform .18s; }
.device-card:hover { text-decoration: none; border-color: rgba(200,164,85,.45); transform: translateY(-1px); }
.device-card .row1 { display: flex; align-items: baseline; gap: 12px; }
.device-card .name { font-size: 19px; color: var(--espresso); }
.device-card .meta { color: var(--sand); font-size: 16px; margin-top: 6px; }

/* ---- badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 16px; letter-spacing: .06em;
  padding: 2px 10px; border-radius: 20px;
}
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.online  { color: var(--ok); border: 1px solid rgba(127,201,94,.5); background: rgba(127,201,94,.08); }
.badge.offline { color: var(--error); border: 1px solid rgba(212,112,112,.5); background: rgba(212,112,112,.08); }
.badge.offline::before { animation: none; }
.badge.online::before  { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.count-badge {
  margin-left: auto;
  background: rgba(200,164,85,.16); color: var(--gold-light);
  border: 1px solid rgba(200,164,85,.4);
  border-radius: 20px; padding: 2px 12px; font-size: 16px;
}

/* ---- status chips for bookings/commands ---- */
.chip { font-size: 16px; padding: 1px 10px; border-radius: 4px; letter-spacing: .05em; }
.chip.pending   { color: var(--gold-light); background: rgba(200,164,85,.14); }
.chip.confirmed { color: var(--sage); background: rgba(138,156,126,.14); }
.chip.rejected  { color: var(--error); background: rgba(212,112,112,.12); }
.chip.failed    { color: var(--error); background: rgba(212,112,112,.12); }
.chip.sent, .chip.queued { color: var(--warm); background: rgba(184,168,146,.12); }
.chip.expired   { color: var(--sand); background: rgba(138,122,102,.14); }

/* ---- buttons ---- */
button, .btn {
  font-family: inherit; font-size: 16px;
  border: 1px solid var(--gold); border-radius: 7px;
  background: rgba(200,164,85,.12); color: var(--gold-light);
  padding: 9px 20px; cursor: pointer;
  transition: background .15s, opacity .15s;
}
button:hover, .btn:hover { background: rgba(200,164,85,.22); }
button:disabled { opacity: .45; cursor: default; }
button.danger {
  border-color: rgba(212,112,112,.6); color: var(--error);
  background: rgba(212,112,112,.08);
}
button.danger:hover { background: rgba(212,112,112,.16); }
button.icon {
  padding: 8px 10px; display: inline-flex; align-items: center;
  border-color: var(--input-border); background: var(--input-bg); color: var(--cream);
}
button.icon:hover { border-color: var(--gold); color: var(--gold-light); }

/* ---- forms ---- */
label { display: block; color: var(--sand); font-size: 16px; margin: 14px 0 5px; letter-spacing: .04em; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; font-family: inherit; font-size: 16px;
  background: var(--input-bg); color: var(--espresso);
  border: 1px solid var(--input-border); border-radius: 7px;
  padding: 10px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--sand) 50%), linear-gradient(135deg, var(--sand) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.toggle { display: flex; align-items: center; gap: 12px; margin: 12px 0; cursor: pointer; color: var(--cream); }
.toggle input { display: none; }
.toggle .track {
  width: 42px; height: 24px; border-radius: 14px; flex: none;
  background: var(--input-bg); border: 1px solid var(--input-border);
  position: relative; transition: background .18s, border-color .18s;
}
.toggle .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--sand); transition: transform .18s, background .18s;
}
.toggle input:checked + .track { background: rgba(200,164,85,.25); border-color: var(--gold); }
.toggle input:checked + .track::after { transform: translateX(18px); background: var(--gold-light); }

/* ---- section headers with divider ---- */
.divider {
  display: flex; align-items: center; gap: 14px;
  margin: 34px 0 16px;
  color: var(--sand); font-size: 16px;
  letter-spacing: .18em; text-transform: uppercase;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }

/* ---- booking cards ---- */
.booking { padding: 15px 18px; }
.booking .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.booking .guest { font-size: 18px; color: var(--espresso); }
.booking .slot { color: var(--gold-light); }
.booking .detail { color: var(--warm); font-size: 16px; margin-top: 4px; }
.booking .detail .phone { display: inline-flex; align-items: center; gap: 10px; }
.booking .actions { display: flex; gap: 12px; margin-top: 12px; }
.booking .actions .spacer { flex: 1; }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th { text-align: left; color: var(--sand); font-weight: normal; letter-spacing: .08em; font-size: 16px;
     padding: 8px 12px; border-bottom: 1px solid var(--card-border); }
td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--cream); }

/* ---- login ---- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 40px 34px 34px; }
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-card .sub { color: var(--sand); margin-bottom: 22px; font-size: 16px; }
.login-card button { width: 100%; margin-top: 22px; padding: 12px; }

/* ---- toast ---- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(80px);
  background: rgb(50,49,45); border: 1px solid var(--gold); color: var(--espresso);
  padding: 12px 22px; border-radius: 8px; font-size: 16px;
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
  max-width: 90vw; text-align: center; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--error); }

.muted { color: var(--sand); }
.empty { color: var(--sand); text-align: center; padding: 30px 0; font-style: italic; }
.error-text { color: var(--error); font-size: 16px; margin-top: 10px; min-height: 22px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.fade-in { animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
