:root {
  --ink: #18302b;
  --muted: #71807b;
  --paper: #f5f3ee;
  --card: #fffefb;
  --green: #1d6b59;
  --green-dark: #155345;
  --line: #dce3df;
  --coral: #e87963;
  --gold: #e0a83e;
  --teal: #4d9d91;
  --violet: #8174b9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #e8b65c; outline-offset: 2px; }
.app-shell { min-height: 100svh; padding: env(safe-area-inset-top) 0 calc(108px + env(safe-area-inset-bottom)); }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 850; font-size: 20px; letter-spacing: -.035em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--green); position: relative; transform: rotate(-10deg); box-shadow: 0 7px 18px #1d6b5933; display: inline-block; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: white; border-radius: 4px; }
.brand-mark::before { width: 18px; height: 6px; top: 14px; left: 8px; }
.brand-mark::after { height: 18px; width: 6px; left: 14px; top: 8px; }
.brand-mark.large { width: 58px; height: 58px; border-radius: 17px; margin-bottom: 25px; }
.brand-mark.large::before { width: 31px; height: 8px; left: 14px; top: 25px; }
.brand-mark.large::after { width: 8px; height: 31px; left: 25px; top: 14px; }
.avatar { border: 0; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: #d88f74; font-weight: 800; cursor: pointer; }
.content { width: min(100% - 40px, 860px); margin: 26px auto 0; }
.welcome { margin: 30px 0 25px; }
.eyebrow { font-size: 11px; line-height: 1.3; letter-spacing: .16em; font-weight: 850; color: var(--green); margin: 0 0 7px; }
.welcome h1, .inner-page > h1, .page-title h1, .lock-card h1 { margin: 0; font: 700 clamp(34px, 7vw, 49px)/1.08 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
.welcome > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 16px; }
.next-card { background: var(--green); color: #fff; border-radius: 28px; padding: 25px; box-shadow: 0 18px 42px #1d6b5926; position: relative; overflow: hidden; }
.next-card::after { content: ""; position: absolute; width: 210px; height: 210px; border: 38px solid #ffffff0c; border-radius: 50%; right: -72px; bottom: -115px; }
.next-topline { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; font-size: 11px; letter-spacing: .13em; font-weight: 850; color: #dcece7; }
.next-topline strong { color: #fff; margin-left: auto; font-size: 14px; letter-spacing: .04em; }
.status-dot { width: 8px; height: 8px; background: #e8b65c; border-radius: 50%; box-shadow: 0 0 0 4px #e8b65c24; }
.medicine-title { display: flex; align-items: center; gap: 16px; margin: 27px 0 24px; position: relative; z-index: 1; }
.medicine-title h2 { margin: 0; font-size: clamp(24px, 6vw, 31px); letter-spacing: -.03em; }
.medicine-title p { margin: 5px 0 0; color: #dcece7; }
.medicine-title .medicine-purpose { color: #c5ded7; font-size: 13px; }
.pill-icon, .empty-pill { display: inline-block; width: 49px; height: 28px; border-radius: 22px; position: relative; overflow: hidden; flex: 0 0 auto; background: #fff; transform: rotate(-35deg); box-shadow: inset 0 0 0 1px #0000000d; }
.pill-icon::after, .empty-pill::after { content: ""; position: absolute; inset: 0 50% 0 0; background: var(--coral); }
.pill-icon.gold::after { background: var(--gold); }
.pill-icon.teal::after { background: var(--teal); }
.pill-icon.violet::after { background: var(--violet); }
.pill-icon.small { width: 34px; height: 20px; }
.primary-actions { display: grid; grid-template-columns: 1.15fr 1fr; gap: 11px; position: relative; z-index: 1; }
.primary-actions button { border: 0; min-height: 50px; border-radius: 15px; font-weight: 800; cursor: pointer; }
.taken-button { color: var(--green-dark); background: #fff; box-shadow: 0 7px 18px #0f3b3133; }
.taken-button span { margin-right: 7px; font-size: 18px; }
.later-button { color: #fff; background: #ffffff13; border: 1px solid #ffffff32 !important; }
.done-card, .empty-card { text-align: center; background: #e8f1ec; border: 1px solid #d4e5dc; padding: 34px 20px; border-radius: 26px; }
.done-card > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--green); color: #fff; margin: 0 auto 12px; }
.done-card h2, .done-card p, .empty-card h2, .empty-card p { margin: 5px 0; }
.done-card p, .empty-card p { color: var(--muted); line-height: 1.55; }
.empty-card .empty-pill { width: 72px; height: 40px; margin: 2px 0 20px; }
.empty-card h2 { font: 700 27px Georgia, serif; }
.empty-card p { max-width: 500px; margin: 8px auto 20px; }
.empty-card button, .error-card button { border: 0; border-radius: 14px; background: var(--green); color: white; padding: 13px 17px; font-weight: 800; cursor: pointer; }
.error-card { background: #fff0ed; border: 1px solid #efc7be; border-radius: 20px; padding: 18px; }
.error-card p { margin: 0 0 13px; color: #864c40; }
.section-block { margin-top: 32px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-heading > button:not(.round-add):not(.modal-close) { border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 800; cursor: pointer; }
.schedule-list { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.schedule-row { display: grid; grid-template-columns: 52px 42px 1fr 36px; gap: 10px; align-items: center; padding: 18px; border-bottom: 1px solid #e8ece9; }
.schedule-row:last-child { border-bottom: 0; }
.schedule-row time { font-weight: 800; font-size: 14px; color: #3d524c; }
.schedule-row h3 { margin: 0; font-size: 16px; }
.schedule-row p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.schedule-row > button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid #ccd7d2; background: #fff; color: #9aa8a3; cursor: pointer; }
.schedule-row.is-taken { opacity: .53; }
.schedule-row.is-taken h3 { text-decoration: line-through; }
.schedule-row.is-taken > button { background: var(--green); color: #fff; border-color: var(--green); }
.stock-card { margin-top: 18px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; background: #fff6e5; border: 1px solid #efddb7; border-radius: 20px; padding: 17px; }
.stock-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #8b5b0c; background: #f5d894; font-weight: 900; }
.stock-card h2 { margin: 0; font-size: 16px; }
.stock-card p:last-child { margin: 4px 0 0; color: #867252; font-size: 13px; }
.stock-card button { border: 0; border-radius: 12px; background: #fff; padding: 9px 12px; color: #79500e; font-size: 12px; font-weight: 850; cursor: pointer; }
.bottom-nav { position: fixed; z-index: 20; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 28px), 560px); height: 72px; padding: 7px 13px; display: flex; justify-content: space-around; align-items: center; background: #fffefbee; backdrop-filter: blur(15px); border: 1px solid #dfe4e1; border-radius: 24px; box-shadow: 0 14px 42px #1c342d21; }
.bottom-nav button { border: 0; background: transparent; min-width: 70px; height: 58px; display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; color: #82908c; font-size: 10px; font-weight: 750; cursor: pointer; }
.bottom-nav button span { font-size: 22px; line-height: 1; }
.bottom-nav button.active { color: var(--green); }
.bottom-nav .nav-add { min-width: 54px; width: 54px; height: 54px; border-radius: 18px; background: var(--green); color: white; font-size: 30px; box-shadow: 0 8px 20px #1d6b5945; transform: translateY(-12px); }
.inner-page { padding-top: 26px; }
.page-title { margin-bottom: 24px; }
.round-add { width: 48px; height: 48px; border: 0; border-radius: 15px; background: var(--green); color: #fff; font-size: 28px; cursor: pointer; }
.medicine-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.medicine-card { background: var(--card); border: 1px solid var(--line); border-radius: 23px; padding: 20px; }
.medicine-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.stock-badge { font-size: 11px; font-weight: 850; color: var(--green); background: #e6f1ec; border-radius: 20px; padding: 6px 9px; }
.stock-badge.warning { color: #865710; background: #fff0ce; }
.medicine-card h2 { margin: 0; font-size: 19px; }
.medicine-card > p { min-height: 38px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.medicine-card .medicine-purpose { color: #4f665f; }
.stock-line { height: 6px; background: #e9eeeb; border-radius: 5px; overflow: hidden; margin: 19px 0 8px; }
.stock-line i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.stock-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stock-controls small { color: var(--muted); font-size: 11px; }
.stock-controls div { display: flex; gap: 5px; }
.stock-controls button { width: 28px; height: 28px; border-radius: 9px; border: 1px solid #d6dfda; background: #fff; color: var(--green); font-weight: 900; cursor: pointer; }
.quiet-empty { color: var(--muted); background: var(--card); border: 1px dashed #cad4cf; border-radius: 20px; padding: 28px; text-align: center; }
.settings-list { margin-top: 24px; display: grid; gap: 12px; }
.settings-list article { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 19px; padding: 16px; }
.setting-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #e7f0ec; color: var(--green); font-size: 19px; font-weight: 800; }
.settings-list h2 { margin: 0; font-size: 16px; }
.settings-list p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.settings-list button { border: 1px solid #d4dfda; border-radius: 11px; padding: 8px 10px; background: #fff; color: var(--green); font-size: 12px; font-weight: 850; cursor: pointer; }
.install-note { background: #e8f1ec; border-radius: 19px; padding: 17px; margin-top: 16px; }
.install-note h2 { margin: 0; font-size: 15px; }
.install-note p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.medical-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 28px 6px; }
.modal-backdrop { position: fixed; z-index: 40; inset: 0; display: grid; place-items: end center; background: #10221d99; padding-top: 60px; }
.modal { width: min(100%, 560px); max-height: calc(100svh - 42px); overflow-y: auto; background: var(--paper); border-radius: 28px 28px 0 0; padding: 12px 22px calc(30px + env(safe-area-inset-bottom)); box-shadow: 0 -16px 50px #0e2c2366; }
.modal.compact { max-width: 440px; }
.modal-handle { width: 48px; height: 5px; background: #ccd3cf; border-radius: 4px; margin: 0 auto 19px; }
.modal .section-heading h2 { font: 700 28px/1.1 Georgia, serif; }
.modal-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #e4e8e5; font-size: 24px; cursor: pointer; }
.modal form, .lock-card form { margin-top: 24px; display: grid; gap: 15px; }
.modal label, .lock-card label { display: grid; gap: 7px; color: #425650; font-size: 12px; font-weight: 850; }
.modal input, .modal select, .lock-card input { width: 100%; min-height: 50px; border: 1px solid #d3dbd7; background: #fff; border-radius: 13px; padding: 0 14px; color: var(--ink); outline: none; }
.modal select { appearance: auto; }
.modal input:focus, .modal select:focus, .lock-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #1d6b5915; }
.input-help { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.35; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.save-button, .lock-card form button { margin-top: 5px; min-height: 52px; border: 0; border-radius: 15px; background: var(--green); color: white; font-weight: 850; cursor: pointer; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(102px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 40px); background: #163b32; color: #fff; padding: 12px 17px; border-radius: 12px; box-shadow: 0 10px 30px #0003; font-size: 13px; font-weight: 750; text-align: center; }
.lock-screen { min-height: 100svh; display: grid; place-items: center; background: radial-gradient(circle at 50% 18%, #e8f1ec, var(--paper) 52%); padding: 24px; }
.lock-card { width: min(100%, 390px); background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 32px; box-shadow: 0 20px 60px #193e3420; text-align: center; }
.lock-card h1 { font-size: 35px; }
.lock-card form { text-align: left; }
@media (min-width: 780px) {
  .content { margin-top: 55px; }
  .next-card { padding: 30px; }
  .medicine-grid { grid-template-columns: repeat(3, 1fr); }
  .bottom-nav { bottom: 24px; }
}
@media (max-width: 540px) {
  .topbar { padding: 0 20px; height: 66px; }
  .content { width: min(100% - 28px, 860px); margin-top: 15px; }
  .welcome { margin-top: 22px; }
  .next-card { border-radius: 23px; padding: 21px 18px; }
  .primary-actions { grid-template-columns: 1fr; }
  .primary-actions button { min-height: 48px; }
  .medicine-grid { grid-template-columns: 1fr; }
  .stock-card { grid-template-columns: 40px 1fr; }
  .stock-card button { grid-column: 2; justify-self: start; }
  .settings-list article { grid-template-columns: 40px 1fr; }
  .settings-list article button { grid-column: 2; justify-self: start; }
  .form-row { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
