:root {
  color-scheme: light;
  --page: #f4f7fb;
  --white: #fff;
  --ink: #102945;
  --muted: #50667c;
  --line: #d9e3ef;
  --blue: #0f6cbd;
  --blue-hover: #095a9f;
  --blue-soft: #e8f3fd;
  --amber: #fff1d9;
  --amber-ink: #764b08;
  --radius: 14px;
  font: 400 1rem/1.55 "Leelawadee UI", "Noto Sans Thai", Tahoma, system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; }
::selection { color: var(--ink); background: #cbe6ff; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid #1f78c7; outline-offset: 3px; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: 2.55rem; line-height: 1.15; letter-spacing: -.035em; }
h1:focus { outline: none; }
h2 { font-size: 1.17rem; line-height: 1.4; }
small { color: var(--muted); font-size: .875rem; }
svg { flex: none; vertical-align: middle; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 10; padding: .5rem 1rem; transform: translateY(-180%); background: var(--white); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); grid-template-rows: 70px 1fr; }
.sidebar { grid-row: span 2; position: sticky; top: 0; height: 100vh; background: #fbfdff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 24px 16px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.65rem; letter-spacing: -.035em; font-weight: 800; color: var(--ink); text-decoration: none; width: max-content; }
.brand > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--blue); color: var(--white); }
.sidebar .brand { margin: 4px 9px 35px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 12px; border-radius: 9px; padding: 11px 12px; min-height: 46px; color: var(--muted); text-decoration: none; font-weight: 650; }
.nav-link:hover, .nav-link.current { background: var(--blue-soft); color: #0a579c; }
.account { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 10px 7px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 700; text-decoration: none; }
.account small { display: block; font-weight: 400; }
.account > svg { margin-left: auto; color: var(--muted); }
.avatar { display: grid; place-items: center; border-radius: 50%; width: 34px; height: 34px; background: var(--blue-soft); color: #0a579c; font-size: .86rem; font-weight: 800; flex: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--white); }
.prototype-label { font-size: .87rem; color: var(--muted); }
.top-account { display: flex; align-items: center; gap: 14px; color: var(--blue); text-decoration: none; }
.mobile-brand, .mobile-nav { display: none; }
.main { width: min(100%, 1320px); margin: 0 auto; padding: 32px clamp(20px, 4vw, 48px) 50px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-heading p { color: var(--muted); margin-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; text-align: center; text-decoration: none; line-height: 1.35; }
.btn.primary { background: var(--blue); color: var(--white); }
.btn.primary:hover { background: var(--blue-hover); }
.btn.secondary { border-color: #b3c8de; background: var(--white); color: #0a579c; }
.btn.secondary:hover, .btn.quiet:hover { background: var(--blue-soft); }
.btn.quiet { color: #0a579c; background: transparent; }
.btn.compact { min-height: 42px; padding-inline: 10px; font-size: .9rem; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .35fr); gap: 18px; align-items: start; }
.today-grid > div, .today-aside { min-width: 0; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.day-rail { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 8px; margin-bottom: 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.day-rail a, .day-rail .date-disabled { display: grid; min-height: 54px; place-items: center; align-content: center; gap: 1px; color: var(--muted); border-radius: 8px; font-size: .88rem; text-decoration: none; }
.day-rail strong { color: var(--ink); font-size: 1rem; }
.day-rail a:hover { background: var(--blue-soft); }
.day-rail a.selected { background: var(--blue); color: var(--white); }
.day-rail a.selected strong { color: inherit; }
.focus { padding: clamp(16px, 2.7vw, 27px); margin-bottom: 15px; background: #eef6fe; border-color: #ccdef0; }
.focus-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; color: #214d75; }
.focus-detail { display: flex; align-items: center; gap: clamp(13px, 2vw, 23px); margin: 15px 0 8px; }
.focus-detail > time { font-size: 2.6rem; line-height: 1; font-weight: 800; letter-spacing: -.035em; }
time, .summary dd { font-variant-numeric: tabular-nums; }
.focus-detail p { color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.focus-detail h2 { overflow-wrap: anywhere; }
.separator { height: 42px; width: 1px; flex: none; background: #bed3e7; }
.focus-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-heading > span { color: var(--muted); font-size: .88rem; }
.dose-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(0, auto) auto; gap: 10px; align-items: center; padding: 11px 16px; min-height: 66px; border-bottom: 1px solid var(--line); }
.dose-row:last-child, .med-row:last-child, .invite-row:last-child { border-bottom: 0; }
.dose-row time { font-weight: 750; }
.dose-info { overflow-wrap: anywhere; }
.dose-info small, .dose-status small { display: block; }
.dose-status small { font-size: .8rem; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 4px 7px; font-size: .85rem; line-height: 1.35; font-weight: 700; background: #eef2f6; color: #465f77; }
.badge.taken, .badge.due { color: #164e81; background: #e0f0ff; }
.badge.overdue { color: var(--amber-ink); background: var(--amber); }
.today-aside { display: grid; gap: 15px; }
.inset { padding: 19px; }
.summary { margin-top: 10px; }
.summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.summary > div:last-child { border: 0; padding-bottom: 1px; }
.summary dt { color: var(--muted); font-size: .9rem; }
.summary dd { margin: 0; white-space: nowrap; font-weight: 700; }
.feature-icon { width: 37px; height: 37px; display: grid; place-items: center; flex: none; border-radius: 9px; color: #0a579c; background: var(--blue-soft); }
.notification-info h2 { margin: 9px 0 5px; }
.notification-info p, .sharing-note p, .inset > p { color: var(--muted); }
.notification-info a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; margin-top: 10px; }
.slim { max-width: 780px; }
.spaced { margin-top: 16px; }
.back { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 15px; color: #0a579c; font-weight: 700; text-decoration: none; }
.med-row, .invite-row { display: flex; align-items: center; gap: 13px; min-height: 64px; border-bottom: 1px solid var(--line); padding: 12px 17px; color: var(--ink); text-decoration: none; }
.med-row:hover { background: #f3f8fd; }
.med-row > div, .invite-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.med-row small, .invite-row small { display: block; }
.med-row > svg { color: var(--blue); }
.empty { padding: 19px; }
.empty p { color: var(--muted); margin: 4px 0 8px; }
.empty-action { padding: 0 19px 18px; }
.form-panel { max-width: 640px; display: grid; gap: 14px; }
.form-panel label:not(.choice) { display: grid; gap: 5px; font-weight: 700; }
input:not([type=checkbox]), select, textarea { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #aebfd2; border-radius: 8px; padding: 8px 10px; background: var(--white); color: var(--ink); font-weight: 400; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #586f84; opacity: 1; }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--blue); flex: none; margin: 3px 0 0; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-weight: 750; }
.time-row { display: flex; gap: 7px; align-items: center; margin-bottom: 7px; }
.time-row input { max-width: 200px; }
.icon-button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue); background: var(--white); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-error { padding: 10px 12px; background: #fbeaf0; color: #971934; border-radius: 8px; }
.field-note { font-size: .9rem; max-width: 68ch; margin: 3px 0; color: var(--muted); }
.choice { display: flex; align-items: flex-start; gap: 10px; min-height: 55px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.choice small { display: block; }
.choice.fixed svg { margin: 4px 0 0 2px; color: var(--blue); }
.summary-list { margin: 0; padding-left: 23px; }
.sharing-note { display: flex; gap: 11px; align-items: start; padding-top: 17px; }
.filter-date input { width: auto; max-width: 100%; }
.form-panel h2 { overflow-wrap: anywhere; }
.history-week { max-width: 970px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 6px; gap: 4px; margin-bottom: 14px; }
.history-week a { display: grid; gap: 3px; padding: 10px 7px; border-radius: 7px; font-size: .92rem; color: var(--ink); text-decoration: none; text-align: center; }
.history-week a:hover, .history-week a[aria-current] { background: var(--blue-soft); }
.history-week small { font-size: .82rem; }
.inset.slim > .btn { margin-top: 9px; }
.notice { display: none; position: fixed; z-index: 3; color: var(--white); background: #102945; border-radius: 9px; padding: 10px 13px; bottom: 20px; right: 20px; max-width: calc(100% - 40px); align-items: center; gap: 13px; }
.notice.visible { display: flex; }
.notice .btn.quiet { color: var(--white); }
.notice .btn.quiet:hover { color: var(--ink); }
@media (max-width: 1120px) {
  .layout { grid-template-columns: 185px minmax(0, 1fr); }
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .today-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 60px; gap: 8px; padding-inline: 15px; }
  .mobile-brand { display: block; }
  .mobile-brand .brand > span { width: 31px; height: 31px; }
  .top-account { min-height: 44px; min-width: 44px; justify-content: center; }
  .top-account > svg { display: none; }
  .prototype-label { font-size: .76rem; }
  .main { padding: 20px 13px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 2rem; }
  .page-heading { align-items: center; gap: 8px; margin-bottom: 16px; }
  .page-heading p { font-size: .9rem; }
  .page-heading .btn { flex: none; }
  .today-aside { grid-template-columns: minmax(0, 1fr); }
  .focus-detail > time { font-size: 2.2rem; }
  .focus-actions .primary { flex-basis: 100%; }
  .focus-actions .secondary, .focus-actions .quiet { flex: 1; }
  .dose-row { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 6px 8px; padding: 10px 12px; }
  .dose-row .btn { grid-column: 3; justify-self: end; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; inset: auto 0 0; z-index: 2; background: var(--white); border-top: 1px solid var(--line); padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); }
  .mobile-nav .nav-link { display: grid; justify-items: center; align-content: center; gap: 2px; padding: 3px 2px; font-size: .82rem; min-height: 50px; }
  .filter-date { min-width: 0; }
  .filter-date input { width: 122px; }
  .history-week { display: none; }
  .notice { bottom: calc(70px + env(safe-area-inset-bottom)); right: 12px; max-width: calc(100% - 24px); }
}
@media (max-width: 355px) {
  .panel-heading { padding-inline: 11px; }
  .panel-heading h2 { font-size: 1.05rem; }
  .focus-detail { gap: 10px; }
  .focus-detail > time { font-size: 1.95rem; }
  .dose-row { grid-template-columns: 43px minmax(0, 1fr) auto; }
  .dose-info small { font-size: .8rem; }
}
