:root {
  color-scheme: light;
  --ink: #102326;
  --muted: #617476;
  --paper: #f3f6f2;
  --panel: #ffffff;
  --line: #dce5df;
  --teal: #14655e;
  --teal-dark: #104c47;
  --mint: #dcefe6;
  --amber: #8f5a12;
  --rose: #9a3d3d;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 12% 0%, #e3efe8 0, transparent 36rem), var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 24px; }
.topbar, .welcome-row, .section-heading, .actions { display: flex; align-items: center; }
.topbar { gap: 14px; margin-bottom: 28px; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px 15px 15px 5px; color: #fff; background: var(--teal); font-size: 24px; font-weight: 700; box-shadow: 0 8px 24px #14655e2a; }
.brand-copy { flex: 1; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.08rem, 2vw, 1.45rem); letter-spacing: -.02em; }
h2 { margin-bottom: 10px; font-size: clamp(1.25rem, 2vw, 1.65rem); letter-spacing: -.025em; }
.eyebrow { margin: 0 0 5px; color: var(--teal); text-transform: uppercase; letter-spacing: .09em; font-size: .68rem; font-weight: 750; }
.muted, .footnote, footer { color: var(--muted); line-height: 1.55; }
.muted { margin-bottom: 0; max-width: 48rem; }
.panel { border: 1px solid var(--line); border-radius: 22px; padding: clamp(20px, 3vw, 30px); background: #ffffffec; box-shadow: 0 14px 40px #173e2910; }
.login-panel { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; max-width: 900px; margin: 8vh auto 12vh; }
.form-grid { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #3f5556; font-weight: 650; font-size: .9rem; }
input, textarea, select { width: 100%; border: 1px solid #ccd9d3; border-radius: 12px; padding: 12px 13px; color: var(--ink); background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #14655e19; }
textarea { resize: vertical; min-height: 90px; }
.button { border: 1px solid transparent; border-radius: 11px; padding: 10px 15px; font-weight: 700; transition: background .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: var(--teal-dark); }
.button-secondary { color: #fff; background: #24434a; }
.button-quiet { color: #315051; border-color: var(--line); background: #fff; }
.button-quiet:hover { background: #f4f8f5; }
.error { margin: 0; color: var(--rose); font-size: .9rem; }
.welcome-row { justify-content: space-between; gap: 18px; margin: 8px 0 20px; }
.welcome-row h2 { margin: 0; }
.actions { flex-wrap: wrap; gap: 8px; }
.status-pill, .count-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; border-radius: 999px; padding: 5px 11px; background: var(--mint); color: var(--teal-dark); font-size: .78rem; font-weight: 750; }
.status-pill.offline { color: var(--rose); background: #fde9e6; }
.count-badge { min-width: 30px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.section-heading { justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; font-size: 1.22rem; }
.item-list { display: grid; gap: 10px; min-height: 66px; }
.add-profile { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.add-profile summary { color: var(--teal-dark); font-weight: 750; cursor: pointer; }
.add-profile[open] summary { margin-bottom: 8px; }
.add-profile form { margin-top: 12px; }
.add-task { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.add-task summary { color: var(--teal-dark); font-weight: 750; cursor: pointer; }
.add-task[open] summary { margin-bottom: 8px; }
.task-form { margin-top: 12px; }
.task-fields-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.weekday-fieldset { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.weekday-fieldset legend { padding: 0 6px; color: #3f5556; font-size: .9rem; font-weight: 650; }
.weekday-options { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.weekday-options label { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 550; }
.weekday-options input { width: auto; margin: 0; accent-color: var(--teal); }
.weekday-fieldset .footnote, .task-time-section .footnote { margin-top: 8px; }
.task-time-section { display: grid; gap: 10px; }
.inline-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .9rem; font-weight: 650; }
.inline-heading .button { padding: 7px 10px; font-size: .8rem; }
.task-time-windows { display: grid; gap: 8px; }
.task-time-window { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.task-time-window .button { padding: 9px 10px; }
.task-form .footnote { margin: 0; }
.record-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 14px; border: 1px solid #e4ebe6; border-radius: 13px; background: #fbfdfb; }
.record-card > div { min-width: 0; flex: 1; }
.record-card h3 { margin: 0 0 4px; font-size: .98rem; }
.record-card p { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.5; overflow-wrap: anywhere; }
.record-card .candidate-detail { margin-top: 9px; color: var(--teal-dark); font-weight: 650; }
.task-actions { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.auto-book-choice { flex: 1 0 100%; display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: .84rem; line-height: 1.45; }
.auto-book-choice input { flex: 0 0 auto; width: auto; margin: 3px 0 0; accent-color: var(--teal); }
.task-unavailable-note { flex: 1 0 100%; margin: 0; }
.profile-credentials { flex: 1 0 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.profile-credentials summary { color: var(--teal-dark); font-size: .82rem; font-weight: 700; cursor: pointer; }
.profile-credentials .footnote { margin: 8px 0 12px; font-size: .75rem; }
.profile-credentials .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.profile-credentials .form-grid .error, .profile-credentials .form-grid button { grid-column: 1 / -1; }
.profile-access { flex: 1 0 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.profile-access summary { color: var(--teal-dark); font-size: .82rem; font-weight: 700; cursor: pointer; }
.profile-access .footnote { margin: 8px 0 12px; font-size: .75rem; }
.profile-access-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding: 10px 0; border-top: 1px solid #e7eeea; }
.profile-access-form .consent-confirmation { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 8px; font-size: .78rem; font-weight: 500; }
.profile-access-form .consent-confirmation input { width: auto; margin: 3px 0 0; }
.profile-access-form .error { grid-column: 1 / -1; }
.record-status { flex: 0 0 auto; border-radius: 8px; padding: 5px 8px; background: #eff4f1; color: #355350; font-size: .72rem; font-weight: 750; }
.record-status.action { color: var(--amber); background: #fff2d8; }
.record-status.error { color: var(--rose); background: #fde9e6; }
.empty-state { margin: 0; padding: 18px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 13px; }
.footnote { margin: 14px 0 0; font-size: .78rem; }
.ai-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 26px; }
.result-card { grid-column: 1 / -1; padding: 16px; border-radius: 14px; background: #f3f8f4; border: 1px solid #dce9df; }
.result-title { margin-bottom: 8px; font-weight: 750; }
.preference-list { display: grid; grid-template-columns: minmax(110px, .35fr) minmax(0, 1fr); gap: 8px 14px; margin: 12px 0; }
.preference-list dt { color: var(--muted); font-size: .84rem; }
.preference-list dd { margin: 0; font-weight: 650; font-size: .88rem; overflow-wrap: anywhere; }
.task-preferences { margin: 9px 0 2px; gap: 4px 12px; }
.task-preferences dt, .task-preferences dd { font-size: .78rem; line-height: 1.4; }
.preference-clarifications { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; color: #744c13; background: #fff2d8; font-size: .84rem; line-height: 1.5; }
.global-message { min-height: 22px; margin: 14px 0 0; color: var(--muted); font-size: .88rem; }
.challenge-open { flex: 0 0 auto; align-self: center; }
.challenge-dialog { width: min(620px, calc(100% - 24px)); max-height: min(90vh, 820px); overflow: auto; border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 4vw, 28px); color: var(--ink); background: var(--panel); box-shadow: 0 24px 90px #10232655; }
.challenge-dialog::backdrop { background: #10232699; backdrop-filter: blur(3px); }
.challenge-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.challenge-heading h2 { margin-bottom: 12px; }
.challenge-image { display: block; max-width: 100%; max-height: 48vh; object-fit: contain; margin: 18px auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.challenge-dialog .form-grid { margin-top: 16px; }
.challenge-dialog .footnote { color: var(--amber); }
footer { display: flex; justify-content: space-between; gap: 18px; margin: 28px 2px 0; font-size: .74rem; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 600px); padding-top: 15px; }
  .login-panel, .ai-panel { grid-template-columns: 1fr; }
  .login-panel { margin: 4vh auto 8vh; gap: 22px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .profile-credentials .form-grid { grid-template-columns: 1fr; }
  .profile-credentials .form-grid .error, .profile-credentials .form-grid button { grid-column: auto; }
  .profile-access-form { grid-template-columns: 1fr; }
  .profile-access-form .consent-confirmation, .profile-access-form .error { grid-column: auto; }
  .ai-panel { grid-column: auto; }
  .preference-list { grid-template-columns: 1fr; gap: 3px; }
  .preference-list dd { margin-bottom: 8px; }
  .welcome-row { align-items: flex-start; flex-direction: column; }
  .actions { width: 100%; }
  .record-card { flex-wrap: wrap; }
  .task-fields-two, .task-time-window { grid-template-columns: 1fr; }
  .inline-heading { align-items: flex-start; flex-direction: column; }
  .challenge-open { margin-left: auto; }
  .actions .status-pill { margin-right: auto; }
  footer { flex-direction: column; gap: 4px; }
  #install-button { font-size: .76rem; padding: 8px 9px; }
}
