:root {
  --bg: #f3f6fc;
  --surface: #fff;
  --ink: #182033;
  --muted: #65708a;
  --line: #e3e8f2;
  --accent: #1a73e8;
  --accent-dark: #0b57d0;
  --accent-soft: #eaf2fe;
  --green: #168944;
  --danger: #c5221f;
  --shadow: 0 22px 55px -34px rgba(29, 48, 90, .35);
  --display: "Figtree", sans-serif;
  --ui: "Inter", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font: 14px/1.5 var(--ui); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font: 800 17px var(--display); text-decoration: none; }
.wordmark { max-width: 100%; }
.wordmark img { display: block; width: 230px; max-width: 100%; height: auto; }
.confirmation-brand { margin-bottom: 24px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font: 700 14px var(--display); text-decoration: none; transition: .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.primary { color: #fff; background: var(--accent); }
.button.secondary { color: var(--accent-dark); border-color: #cbdcf8; background: var(--accent-soft); }
.button.ghost { color: var(--muted); border-color: var(--line); background: var(--surface); }
.button.compact { min-height: 36px; padding: 0 13px; font-size: 12px; }
.button.google { width: 100%; color: #33405b; border-color: var(--line); background: #fff; }
.google-mark { color: #4285f4; font: 800 17px Arial, sans-serif; }
.notice { margin: 14px 0; padding: 11px 13px; border-radius: 10px; color: #7a3814; background: #fff4e5; }
.notice.success { color: #126536; background: #e7f6ed; }

.auth-page { background: radial-gradient(circle at 15% 10%, #e7ddff, transparent 38%), radial-gradient(circle at 90% 85%, #d6e4ff, transparent 40%), #edf2fb; }
.auth-shell { display: grid; width: min(100% - 32px, 980px); min-height: 620px; margin: 7vh auto; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; background: rgba(255,255,255,.64); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-intro { display: flex; flex-direction: column; justify-content: center; padding: 64px; background: linear-gradient(145deg, rgba(255,255,255,.55), rgba(229,237,255,.55)); }
.auth-intro h1 { margin: 42px 0 18px; font: 800 clamp(38px, 5vw, 62px)/.98 var(--display); letter-spacing: -.045em; }
.auth-intro p { max-width: 510px; margin: 0; color: var(--muted); font-size: 16px; }
.auth-intro ul { display: grid; gap: 12px; margin: 36px 0 0; padding: 0; list-style: none; }
.auth-intro li::before { content: "✓"; display: inline-grid; width: 22px; height: 22px; margin-right: 10px; place-items: center; border-radius: 50%; color: var(--green); background: #dcf3e5; font-weight: 800; }
.auth-card { align-self: center; margin: 28px; padding: 32px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 15px 40px -32px rgba(20,40,80,.4); }
.auth-tabs { display: flex; gap: 5px; margin-bottom: 24px; padding: 5px; border-radius: 12px; background: var(--bg); }
.auth-tabs button { flex: 1; padding: 9px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 700; }
.auth-tabs button.is-active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(20,30,60,.08); }
.stack { display: grid; gap: 15px; }
label { display: grid; gap: 6px; color: #47526b; font-size: 12px; font-weight: 600; }
label small { color: #8791a6; font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fafbfe; outline: 0; }
input, select { height: 42px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.separator { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #9aa3b7; font-size: 11px; text-transform: uppercase; }
.separator::before, .separator::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.fine-print { margin: 16px 0 0; color: #8a94a9; font-size: 11px; text-align: center; }
.ical-note { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid #dce7f8; border-radius: 11px; color: var(--muted); background: #f6f9ff; font-size: 11px; }
.ical-note strong { color: var(--ink); }
.confirmation-card { width: min(100% - 32px, 520px); margin: 14vh auto; padding: 44px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.confirmation-card h1 { margin: 16px 0 9px; font: 800 28px var(--display); }
.confirmation-card p { color: var(--muted); }
.confirmation-mark { display: grid; width: 62px; height: 62px; margin: auto; place-items: center; border-radius: 50%; color: var(--green); background: #e4f6eb; font-size: 30px; font-weight: 800; }
.confirmation-mark.error { color: var(--danger); background: #fce8e6; }

.topbar { position: sticky; z-index: 5; top: 0; display: flex; height: 68px; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100% - 1160px)/2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(14px); }
.account-menu { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.dashboard { width: min(100% - 32px, 1160px); margin: 46px auto 80px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-head h1, .dialog-head h2 { margin: 0; font: 800 32px/1.1 var(--display); letter-spacing: -.03em; }
.page-head p:not(.eyebrow) { margin: 9px 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--accent-dark); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.connection-card { display: flex; align-items: center; gap: 14px; margin: 28px 0; padding: 16px 18px; border: 1px solid #f0d8ae; border-radius: 15px; background: #fffaf0; }
.connection-card.connected { border-color: #cce9d7; background: #f2fbf5; }
.connection-icon { display: grid; width: 38px; height: 38px; flex: none; place-items: center; border-radius: 11px; color: #4285f4; background: #fff; box-shadow: 0 2px 9px rgba(20,40,80,.1); font: 800 19px Arial; }
.connection-card div:nth-child(2) { flex: 1; }
.connection-card strong { font-family: var(--display); }
.connection-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.widget-card { display: grid; min-height: 210px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 12px 30px -28px rgba(20,40,80,.5); }
.widget-card-head { display: flex; align-items: start; gap: 12px; }
.widget-card-mark { display: grid; width: 42px; height: 42px; flex: none; place-items: center; overflow: hidden; border-radius: 12px; color: #fff; background: var(--card-accent, var(--accent)); font: 800 17px var(--display); }
.widget-card-mark img { width: 100%; height: 100%; object-fit: cover; }
.widget-card h3 { margin: 1px 0 2px; font: 700 17px var(--display); }
.widget-card p { margin: 0; color: var(--muted); font-size: 12px; }
.status { margin-left: auto; padding: 3px 8px; border-radius: 20px; color: #177345; background: #e8f6ed; font-size: 10px; font-weight: 700; }
.status.off { color: #737d91; background: #eef1f6; }
.widget-meta { display: flex; flex-wrap: wrap; gap: 6px; align-self: center; }
.widget-meta span { padding: 5px 8px; border-radius: 8px; color: #62708b; background: #f4f6fa; font-size: 11px; }
.widget-actions { display: flex; gap: 8px; align-self: end; padding-top: 15px; border-top: 1px solid var(--line); }
.empty-state { grid-column: 1/-1; padding: 60px 20px; border: 1px dashed #cbd4e4; border-radius: 18px; color: var(--muted); text-align: center; }

dialog { width: min(100% - 24px, 900px); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px -30px rgba(10,20,50,.55); }
dialog::backdrop { background: rgba(15,24,44,.48); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 23px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; cursor: pointer; font-size: 22px; }
.form-sections { display: grid; max-height: calc(100vh - 190px); padding: 24px; overflow-y: auto; gap: 24px; }
fieldset { margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
legend { padding: 0 8px; font: 700 14px var(--display); }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid .wide { grid-column: span 2; }
.asset-field { min-width: 0; }
.asset-field small { overflow-wrap: anywhere; }
.asset-preview { display: grid; height: 112px; min-width: 0; padding: 11px; place-items: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: #fff; text-align: center; font-weight: 400; }
.asset-preview img { display: block; width: 100%; height: 88px; min-width: 0; object-fit: contain; }
.asset-preview-avatar img { width: 88px; max-width: 100%; border-radius: 12px; object-fit: cover; }
.asset-field .is-error { color: var(--danger); }
.field-help { margin: -3px 0 15px; color: var(--muted); font-size: 12px; }
.week-editor { display: grid; gap: 8px; }
.week-row { display: grid; grid-template-columns: 28px 110px 1fr 18px 1fr; align-items: center; gap: 10px; }
.week-row label { display: block; font-size: 12px; }
.week-row input[type="checkbox"] { width: 17px; height: 17px; }
.week-row input[type="time"]:disabled { opacity: .5; }
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 15px; }
.color-grid input[type="color"] { padding: 4px; cursor: pointer; }
.dialog-actions { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fafbfe; }
.dialog-actions > span { flex: 1; }
.switch { display: flex; align-items: center; gap: 8px; }
.switch input { width: 18px; height: 18px; }
.embed-dialog { width: min(100% - 24px, 650px); padding-bottom: 20px; }
.embed-dialog > p { margin: 20px 24px 10px; color: var(--muted); }
.embed-dialog pre { margin: 0 24px 18px; padding: 16px; overflow: auto; border-radius: 11px; color: #dfe7ff; background: #182033; font: 12px/1.6 ui-monospace, monospace; white-space: pre-wrap; }
.embed-dialog .dialog-actions { border: 0; background: transparent; justify-content: flex-end; }

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 68px; flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .account-menu { flex-wrap: wrap; }
  .auth-shell { grid-template-columns: 1fr; margin: 16px auto; }
  .auth-intro { padding: 32px; }
  .auth-intro h1 { margin-top: 30px; }
  .auth-card { margin: 14px; }
  .page-head { align-items: start; flex-direction: column; }
  .connection-card { align-items: flex-start; flex-wrap: wrap; }
  .connection-card .button { width: 100%; }
  .form-grid.two, .form-grid.three, .color-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .wide { grid-column: 1/-1; }
  .week-row { grid-template-columns: 24px 80px 1fr 12px 1fr; gap: 5px; }
  .dialog-actions { flex-wrap: wrap; }
}
