/* Fintech Den theme (Figma: Fintech Den Website UI Design).
   Navy ink #0A1F44, primary blue #1530A7, slate #424B5A, light blue #CAD7ED, grey #E4E7EC; Outfit. */
:root {
  --bg: #ffffff;
  --bg-glow: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --text: #0a1f44;
  --muted: #424b5a;
  --border: #cad7ed;
  --chip: #e4e7ec;
  --ink: #0a1f44;
  --brand: #1530a7;
  --brand-ink: #ffffff;
  --brand-text: var(--brand);
  --danger: #c2372b;
  --ok: #1f7a4d;
  --warn: #9a6400;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(10, 31, 68, .05), 0 8px 24px -12px rgba(10, 31, 68, .18);
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
/* White is the theme everywhere. Dark is only used when an embed explicitly asks for theme=dark. */
:root[data-theme="dark"] {
  --bg: #061430;
  --bg-glow: #10295c;
  --surface: #0a1f44;
  --surface-2: #112a57;
  --text: #eef2f9;
  --muted: #a9b6cf;
  --border: #1f3b70;
  --chip: #1a3263;
  --ink: #eef2f9;
  --brand-text: color-mix(in srgb, var(--brand) 40%, #ffffff);
  --danger: #ef6b5f;
  --ok: #4cc38a;
  --warn: #e0a740;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand-text); }
h1, h2, h3 { line-height: 1.227; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* Controls */
button, .btn {
  font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none;
}
button:hover { background: var(--surface-2); }
/* Fintech Den primary button: bold, solid blue, with a glow in its own colour. */
button.primary, .btn.primary {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700;
  box-shadow: 0 11px 23px -10px var(--brand);
}
button.primary:hover, .btn.primary:hover { background: var(--brand); filter: brightness(1.12); }
/* Secondary "Contact"-style button: solid navy. */
button.ink, .btn.ink { background: var(--ink); border-color: var(--ink); color: var(--surface); font-weight: 700; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--brand-text); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-weight: 550; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 4px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.stack > * + * { margin-top: 16px; }

.notice { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 14px; border: 1px solid; }
.notice.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.notice.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.notice.info { color: var(--muted); border-color: var(--border); background: var(--surface-2); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 2px; background: var(--chip); color: var(--muted); }
.badge.sent, .badge.confirmed { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge.failed, .badge.cancelled { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.badge.retrying, .badge.queued, .badge.sending { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.list th, table.list td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- Public booking layout */
.public { max-width: 920px; margin: 0 auto; padding: 32px 16px 64px; }
.brandbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brandbar img { height: 36px; }
.brandbar .mark { width: 36px; height: 36px; border-radius: var(--radius); background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.brandbar .name { font-weight: 650; font-size: 18px; }
.event-list { display: grid; gap: 12px; }
.event-link { display: block; text-decoration: none; color: inherit; border-left: 4px solid var(--brand); }
.event-link:hover { border-color: var(--brand); background: var(--surface-2); }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

.booker { display: grid; grid-template-columns: 260px 1fr; gap: 0; padding: 0; overflow: hidden; }
.booker > .info { padding: 24px; border-right: 1px solid var(--border); }
.booker > .main { padding: 24px; }
@media (max-width: 760px) {
  .booker { grid-template-columns: 1fr; }
  .booker > .info { border-right: 0; border-bottom: 1px solid var(--border); }
}
.picker { display: grid; grid-template-columns: 1fr 180px; gap: 24px; }
@media (max-width: 560px) { .picker { grid-template-columns: 1fr; } }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-head button { padding: 4px 10px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .dow { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal button {
  aspect-ratio: 1; padding: 0; justify-content: center; border-radius: var(--radius);
  border: 0; background: transparent; color: var(--muted); font-weight: 450;
}
.cal button.avail { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand-text); font-weight: 650; }
.cal button.avail:hover { background: color-mix(in srgb, var(--brand) 22%, transparent); }
.cal button.sel { background: var(--brand); color: var(--brand-ink); }
.cal button:disabled { cursor: default; opacity: .5; }
.slots { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.slots button { justify-content: center; border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); color: var(--brand-text); }
.slots button:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.tzline { margin-top: 16px; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.tzline select { width: auto; max-width: 260px; padding: 4px 8px; font-size: 13px; }

/* ---------- Admin */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .switcher { display: flex; align-items: center; gap: 10px; }
.topbar .switcher .mark { width: 30px; height: 30px; border-radius: var(--radius); background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.topbar select { width: auto; font-weight: 600; padding: 6px 10px; }
.topbar .spacer { flex: 1; }
.topbar a { white-space: nowrap; }
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 53px); }
.sidenav { padding: 16px 10px; border-right: 1px solid var(--border); }
.sidenav a { display: block; padding: 8px 12px; border-radius: var(--radius); color: var(--text); text-decoration: none; font-weight: 500; }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand-text); font-weight: 600; }
.content { padding: 24px; max-width: 1040px; width: 100%; }
.content-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 6px 12px; color: var(--muted); }
.tabs button.on { background: var(--surface-2); color: var(--text); }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidenav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; }
  .sidenav a { white-space: nowrap; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .topbar .spacer { display: none; }
  .topbar .who { display: none; }
}
.week { display: grid; gap: 10px; }
.week .day { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.week .day:last-child { border-bottom: 0; }
.week .spans { display: flex; flex-direction: column; gap: 6px; }
.week .span { display: flex; gap: 6px; align-items: center; }
.week .span input { width: 110px; }
.qrow { display: grid; grid-template-columns: 1fr 120px auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 560px) { .qrow { grid-template-columns: 1fr 1fr; } }

dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog form { padding: 22px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-wrap .card { width: min(380px, 100%); }

/* ---------- Embed mode (pages under /embed/ inside an iframe) */
html.embed, html.embed body { background: transparent; }
html.embed .public { padding: 8px; max-width: none; }
html.embed .booker { box-shadow: none; }
html.embed.hide-details .booker { grid-template-columns: 1fr; }
html.embed.hide-details .booker > .info { display: none; }
html.embed.hide-brand .brandbar { display: none; }

/* ---------- Admin embed builder */
.embed-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 960px) { .embed-grid { grid-template-columns: 1fr; } }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; padding: 6px 12px; font-weight: 500; }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 0;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
.preview-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; min-height: 200px; background: var(--bg); }

/* ---------- Avatars */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover;
  background: color-mix(in srgb, var(--brand) 18%, var(--surface-2)); color: var(--brand-text); font-weight: 650; }
.who-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.who-link:hover span { text-decoration: underline; }
.host-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

/* ---------- Fintech Den surfaces */
body { background: var(--bg); }
html.embed body { background: transparent; }
.card { border-color: var(--border); }
.topbar { box-shadow: 0 1px 0 var(--border); }
.topbar .switcher .mark, .brandbar .mark { border-radius: var(--radius); }
.sidenav a.active { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.brandbar .name { font-weight: 600; font-size: 20px; color: var(--ink); }
table.list th { font-weight: 600; letter-spacing: .04em; }
.event-link h3 { color: var(--brand-text); }
.cal button.avail { border-radius: var(--radius); }
.slots button { font-weight: 600; }
