:root {
  color-scheme: dark;
  --page: #101a25;
  --panel: #172432;
  --panel-soft: #1d2c3b;
  --line: rgba(210, 228, 241, .1);
  --text: #edf3f6;
  --muted: #8fa1b0;
  --accent: #86d6c1;
  --hour-height: 34px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--page); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
.dashboard { display: flex; width: 100vw; height: 100vh; min-height: 440px; }
.sidebar { width: 34%; min-width: 310px; max-width: 470px; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); }
.topbar, .week-header, .settings-header, .settings-footer { display: flex; align-items: center; justify-content: space-between; }
.topbar { height: 58px; flex: 0 0 58px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: #14251f; background: var(--accent); font-size: 14px; }
.brand-mark { margin-right: 10px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 22px; width: 38px; height: 38px; border-radius: 9px; }
.icon-button:hover, .nav-button:hover, .today-button:hover { background: rgba(255,255,255,.08); color: var(--text); }
.sidebar-content { overflow: auto; padding: 16px 22px 12px; flex: 1; }
.clock-card { padding: 8px 0 15px; }
.clock { font-size: 66px; line-height: 1; letter-spacing: -.055em; font-weight: 300; font-variant-numeric: tabular-nums; }
.date-line { display: flex; margin-top: 8px; color: var(--muted); font-size: 14px; }
.date-line span + span { margin-left: 9px; }
.section-kicker { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .14em; font-weight: 700; }
.verse-card { border-top: 1px solid var(--line); padding: 15px 0 13px; }
.verse-version { float: right; letter-spacing: 0; text-transform: none; font-weight: 500; }
.verse-text { margin: 10px 0 8px; font-size: 17px; line-height: 1.65; color: #e1e9ec; }
.verse-reference { color: var(--accent); font-size: 12px; }
.weather-card, .agenda-card { border-top: 1px solid var(--line); padding: 14px 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; font-weight: 700; }
.section-heading > span:last-child { font-weight: 400; font-size: 11px; }
.weather-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 11px; }
.weather-day { min-width: 0; text-align: center; padding: 9px 4px 7px; background: var(--panel-soft); border-radius: 9px; }
.weather-day-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.weather-icon { height: 30px; display: grid; place-items: center; font-size: 22px; margin: 4px 0; }
.weather-temp { font-size: 12px; font-variant-numeric: tabular-nums; }
.weather-temp .low { color: var(--muted); }
.agenda-list { margin-top: 7px; }
.agenda-item { display: flex; align-items: stretch; padding: 7px 2px; border-bottom: 1px solid rgba(255,255,255,.045); cursor: pointer; }
.agenda-item.finished { opacity: .43; }
.agenda-stripe { width: 3px; flex: 0 0 3px; margin-right: 10px; border-radius: 5px; }
.agenda-copy { min-width: 0; flex: 1; }
.agenda-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.agenda-time { margin-top: 3px; color: var(--muted); font-size: 10px; }
.muted { color: var(--muted); }
.sidebar-footer { height: 38px; flex: 0 0 38px; padding: 0 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.text-button { border: 0; padding: 5px 0 5px 10px; background: transparent; color: var(--accent); font-size: 11px; }
.calendar-panel { display: flex; flex-direction: column; min-width: 0; flex: 1; padding: 0 20px 16px; }
.week-header { min-height: 74px; flex: 0 0 74px; border-bottom: 1px solid var(--line); }
.week-header h1 { margin: 5px 0 0; font-size: 19px; font-weight: 600; }
.week-controls { display: flex; align-items: center; }
.week-controls > * + * { margin-left: 8px; }
.nav-button, .today-button { border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); height: 32px; }
.nav-button { width: 33px; font-size: 22px; line-height: 20px; }
.today-button { padding: 0 12px; font-size: 11px; }
.all-day-row { display: flex; min-height: 74px; max-height: 120px; border-bottom: 1px solid var(--line); }
.all-day-label { width: 45px; padding-top: 48px; color: var(--muted); font-size: 9px; }
.all-day-events { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: 1; }
.all-day-cell { padding: 0 3px 5px; border-left: 1px solid var(--line); overflow: hidden; }
.all-day-chip { margin-bottom: 3px; padding: 3px 4px; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 9px; cursor: pointer; }
.week-grid { display: grid; grid-template-columns: 45px repeat(7, minmax(0, 1fr)); flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.time-axis { position: relative; height: calc(var(--hour-height) * 24); }
.hour-label { position: absolute; right: 7px; transform: translateY(-6px); color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.day-column { position: relative; height: calc(var(--hour-height) * 24); border-left: 1px solid var(--line); }
.day-column.today { background: rgba(134,214,193,.035); }
.day-heading { height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); font-size: 10px; }
.day-heading.today { color: var(--accent); }
.day-heading-date { margin-top: 2px; font-size: 9px; color: var(--muted); }
.hour-line { position: absolute; z-index: 0; left: 0; right: 0; height: 1px; background: var(--line); pointer-events: none; }
.event-block { position: absolute; z-index: 2; min-width: 0; overflow: hidden; padding: 3px 4px; border-left: 2px solid; border-radius: 3px; color: #f6fbfc; font-size: 9px; line-height: 1.25; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.event-block:hover { filter: brightness(1.18); z-index: 4; }
.event-block-title { font-weight: 650; overflow-wrap: anywhere; }
.event-block-time { margin-top: 2px; opacity: .78; font-size: 8px; }
.current-time-line { position: absolute; z-index: 4; left: 0; right: 0; height: 2px; background: #ff7373; pointer-events: none; }
.current-time-line:before { content: ""; position: absolute; left: -3px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: #ff7373; }
.settings-backdrop, .event-dialog { position: fixed; z-index: 20; top: 0; right: 0; bottom: 0; left: 0; display: flex; justify-content: flex-end; background: rgba(4,9,14,.66); }
.settings-backdrop[hidden], .event-dialog[hidden] { display: none; }
.settings-dialog { width: min(480px, 100vw); height: 100%; display: flex; flex-direction: column; background: #172432; box-shadow: -18px 0 50px rgba(0,0,0,.25); }
.settings-header { padding: 15px 20px; border-bottom: 1px solid var(--line); }
.settings-header h2 { margin: 4px 0 0; font-size: 20px; }
.settings-content { overflow: auto; padding: 0 20px 18px; }
.settings-section { padding: 17px 0; border-bottom: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 13px; font-size: 13px; }
.settings-section > label:not(.setting-row), .settings-section form > label { display: block; margin: 11px 0; color: var(--muted); font-size: 11px; }
.settings-section input[type="text"], .settings-section input[type="url"], .settings-section input[type="password"], .settings-section input[type="time"], .settings-section select { display: block; width: 100%; height: 36px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #101a25; color: var(--text); font-size: 12px; }
.settings-section input:focus, .settings-section select:focus { border-color: var(--accent); }
.settings-section input[type="color"] { display: block; width: 100%; height: 36px; margin-top: 6px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #101a25; }
.setting-row { display: flex; align-items: center; justify-content: space-between; min-height: 34px; color: #d9e2e7; font-size: 12px; }
input[type="checkbox"] { accent-color: #5eb9a0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.form-grid > label, .form-grid > .time-field { color: var(--muted); font-size: 11px; }
.form-grid select { display: block; width: 100%; height: 36px; margin-top: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #101a25; color: var(--text); font-size: 12px; }
.time-picker-button { display: block; width: 100%; height: 36px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #101a25; color: var(--text); text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.time-field-label { display: block; }
.time-picker-button:focus { border-color: var(--accent); outline: none; }
.time-picker-backdrop { position: fixed; z-index: 35; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4,9,14,.76); }
.time-picker-backdrop[hidden] { display: none; }
.time-picker-dialog { display: flex; flex-direction: column; width: min(400px, 100%); max-height: 90vh; border: 1px solid var(--line); border-radius: 14px; background: #172432; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.time-picker-header, .time-picker-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; }
.time-picker-header { border-bottom: 1px solid var(--line); }
.time-picker-header h2 { margin: 0; font-size: 16px; }
.time-picker-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; padding: 12px 15px; }
.time-picker-columns h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; text-align: center; }
.time-picker-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; max-height: 48vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.time-option { min-height: 38px; padding: 5px 2px; border: 1px solid var(--line); border-radius: 6px; background: #101a25; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.time-option.selected { border-color: var(--accent); background: #285044; color: #fff; }
.minute-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.time-picker-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.secondary-button, .primary-button { height: 34px; padding: 0 13px; border-radius: 7px; font-size: 11px; }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--text); }
.primary-button { border: 0; background: var(--accent); color: #13211d; font-weight: 700; }
.help-text { color: var(--muted); font-size: 10px; line-height: 1.5; }
.days-picker { display: flex; justify-content: space-between; padding: 5px 0; }
.days-picker label { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; }
.inline-check { display: flex; align-items: center; color: var(--muted); font-size: 11px; }
.inline-check input { margin-left: 9px; }
.form-actions { display: flex; justify-content: flex-end; }
.form-actions > * + * { margin-left: 8px; }
.schedule-list { margin-top: 12px; }
.schedule-entry { display: flex; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.schedule-entry-color { width: 4px; height: 28px; border-radius: 4px; }
.schedule-entry-color { margin-right: 8px; }
.schedule-entry-copy { margin-right: 8px; }
.schedule-entry-copy { flex: 1; min-width: 0; }
.schedule-entry-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); font-size: 11px; }
.schedule-entry-meta { margin-top: 3px; color: var(--muted); font-size: 9px; }
.schedule-action { padding: 4px; border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.settings-footer { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 22px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; padding: 10px 15px; max-width: 90vw; border: 1px solid var(--line); border-radius: 9px; background: #233545; color: var(--text); font-size: 12px; transition: opacity .2s, transform .2s; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.event-dialog { z-index: 30; align-items: center; justify-content: center; padding: 20px; }
.event-dialog-card { position: relative; width: min(400px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: #172432; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.close-event { position: absolute; top: 10px; right: 10px; }
.event-color-mark { width: 32px; height: 4px; border-radius: 4px; }
.event-dialog-card h2 { padding-right: 20px; font-size: 18px; }
.event-dialog-card p { color: var(--muted); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; }
body.night { background: #000; }
body.night .dashboard { background: #000; }
body.night .sidebar, body.night .calendar-panel { background: #000; }
body.night .clock { color: #454545; }
body.night .date-line, body.night .brand, body.night .sidebar-footer { color: #3f3f3f; }
body.night .dashboard > .sidebar .sidebar-content, body.night .dashboard > .sidebar .topbar { visibility: hidden; }
body.night .calendar-panel { visibility: hidden; }
body.night .sidebar { width: 100%; max-width: none; border: 0; justify-content: center; text-align: center; }
body.night .sidebar .topbar { position: absolute; top: 16px; left: 16px; border: 0; }
body.night .sidebar .sidebar-content { overflow: visible; }
body.night .sidebar .clock-card { position: absolute; display: block; visibility: visible; top: 50%; left: 0; width: 100%; transform: translateY(-50%); padding: 0; }
body.night .sidebar .clock-card .clock { font-size: 120px; }
body.night .sidebar .clock-card .date-line { justify-content: center; margin-top: 12px; color: #454545; font-size: 16px; }
body.night .sidebar .sidebar-footer { display: none; }
@media (max-width: 850px) {
  .clock { font-size: 55px; }
  .sidebar { width: 37%; min-width: 260px; }
  .sidebar-content { padding-right: 15px; padding-left: 15px; }
  .calendar-panel { padding-right: 10px; padding-left: 10px; }
  .week-grid { grid-template-columns: 34px repeat(7, minmax(0, 1fr)); }
  .all-day-label { width: 34px; }
  .hour-label { right: 4px; }
  .event-block { padding: 2px; font-size: 8px; }
}
@media (max-width: 620px) {
  .dashboard { overflow: auto; flex-direction: column; }
  .sidebar { width: 100%; max-width: none; min-width: 0; min-height: 430px; }
  .calendar-panel { min-height: 660px; }
  body.night .sidebar .clock-card .clock { font-size: 72px; }
}
