:root {
  --ink: #173f35;
  --muted: #63736d;
  --paper: #f6f3ea;
  --card: #fffdf8;
  --line: #dedbd0;
  --mint: #dcecdf;
  --green: #2d725e;
  --terracotta: #c96645;
  --amber: #e6b85c;
  --shadow: 0 18px 50px rgba(25, 58, 48, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "DM Sans", sans-serif; min-height: 100vh; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"); }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; position: relative; }
.hero, .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
h1, h2, h3 { font-family: "Lora", serif; margin: 0; }
h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); line-height: .96; letter-spacing: -.055em; }
h2 { font-size: 2rem; letter-spacing: -.035em; }
h3 { font-size: 1.25rem; }
.eyebrow { margin: 0 0 10px; font-size: .72rem; letter-spacing: .16em; font-weight: 700; color: var(--terracotta); }
.subtitle { margin: 16px 0 0; color: var(--muted); font-size: 1rem; }
.button { border: 0; border-radius: 999px; min-height: 48px; padding: 0 22px; font: 700 .9rem "DM Sans"; cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--ink); color: white; box-shadow: 0 9px 22px rgba(23,63,53,.18); }
.button-primary:hover { background: #225649; }
.button-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: 44px 0 60px; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: rgba(255,253,248,.64); }
.summary div { padding: 22px 28px; display: flex; align-items: baseline; gap: 9px; color: var(--muted); }
.summary div + div { border-left: 1px solid var(--line); }
.summary-number { color: var(--ink); font: 700 1.8rem "Lora"; }
.section-heading { margin-bottom: 22px; }
.legend { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: 8px; }
.legend span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--mint); }
.medicine-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.medicine-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.medicine-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--green); }
.medicine-card.late::before { background: var(--terracotta); }
.medicine-card.complete::before { background: #a6aaa6; }
.card-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.card-title { display: flex; gap: 13px; align-items: center; }
.pill-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--mint); font-size: 1.3rem; }
.medicine-name { font: 700 1.2rem "Lora"; }
.medicine-dose { color: var(--muted); margin-top: 4px; font-size: .88rem; }
.menu { display: flex; gap: 5px; }
.mini-button, .icon-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 7px; font: 600 .78rem "DM Sans"; border-radius: 9px; }
.mini-button:hover { background: #eeebe3; color: var(--ink); }
.schedule { margin: 23px 0; padding: 18px; border-radius: 16px; background: #f1efe7; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.schedule-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.schedule-time { margin-top: 4px; font: 700 1.4rem "Lora"; }
.status { border-radius: 999px; padding: 7px 10px; font-size: .72rem; font-weight: 700; background: var(--mint); color: var(--green); white-space: nowrap; }
.late .status { background: #f4ddd5; color: #9d4225; }
.complete .status { background: #e6e7e4; color: #626762; }
.notes { color: var(--muted); min-height: 42px; margin: 0 0 18px; line-height: 1.45; font-size: .86rem; }
.card-actions { display: flex; gap: 9px; }
.card-actions .button-primary { flex: 1; }
.history-button { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.history { display: none; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
.history.open { display: block; }
.history-row { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; color: var(--muted); padding: 6px 0; }
.history-row strong { color: var(--ink); font-weight: 600; }
.empty-state { text-align: center; border: 1px dashed #bdc4bd; border-radius: 22px; padding: 55px 20px; color: var(--muted); }
.empty-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--mint); display: grid; place-items: center; color: var(--green); font-size: 1.4rem; margin: 0 auto 15px; }
.empty-state p { margin-bottom: 0; }
dialog { width: min(530px, calc(100% - 30px)); border: 1px solid var(--line); border-radius: 24px; padding: 0; color: var(--ink); background: var(--card); box-shadow: 0 30px 100px rgba(20,50,40,.25); }
dialog::backdrop { background: rgba(18,38,32,.56); backdrop-filter: blur(4px); }
dialog form { padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.icon-button { font-size: 1.7rem; line-height: 1; }
label { display: block; position: relative; font-size: .8rem; font-weight: 700; margin: 15px 0; }
input, textarea { display: block; width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; background: white; color: var(--ink); font: 500 .95rem "DM Sans"; outline: none; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(45,114,94,.12); }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-suffix { position: absolute; right: 14px; bottom: 14px; color: var(--muted); font-weight: 500; }
.dialog-copy { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; translate: -50% 150%; background: var(--ink); color: white; border-radius: 999px; padding: 13px 20px; box-shadow: var(--shadow); transition: translate .25s; font-size: .88rem; }
.toast.show { translate: -50% 0; }

@media (max-width: 760px) {
  .shell { width: min(100% - 26px, 620px); padding-top: 30px; }
  .hero { align-items: start; flex-direction: column; }
  .hero .button { width: 100%; }
  .summary { margin: 28px 0 46px; }
  .summary div { padding: 17px 10px; flex-direction: column; gap: 2px; text-align: center; align-items: center; font-size: .75rem; }
  .medicine-grid { grid-template-columns: 1fr; }
  .legend { display: none; }
  .medicine-card { padding: 20px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
