/* App surfaces are independent of the user's paper, frame and desk colours. */
:root {
  --shell-chrome:#f7f7f5;
  --shell-chrome-line:#e5e5e2;
  --shell-surface:#ffffff;
  --shell-soft:#f1f1ef;
  --shell-line:#e8e8e5;
  --shell-text:#37352f;
  --shell-muted:#787774;
  --shell-action:#37352f;
  --shell-action-text:#ffffff;
  --shell-shadow:0 1px 2px rgb(24 24 22 / 3%);
  --shell-radius:10px;
  --shell-top:calc(60px + env(safe-area-inset-top));
  --shell-accent-ink:var(--shell-text);
}
:root[data-theme="dark"] {
  --shell-chrome:#202020;
  --shell-chrome-line:#363634;
  --shell-surface:#252525;
  --shell-soft:#2f2f2d;
  --shell-line:#3c3c39;
  --shell-text:#ececea;
  --shell-muted:#aeaea8;
  --shell-action:#e8e8e4;
  --shell-action-text:#202020;
  --shell-shadow:0 1px 2px rgb(0 0 0 / 10%);
}

/* A single, anchored app bar in every view and device layout. */
html body:is(.dev-phone,.dev-pad,.tab-port) #tabbar {
  position:fixed;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;
  inset:0 0 auto;transform:none;width:100%;max-width:none;height:var(--shell-top);
  padding:calc(8px + env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left));
  gap:8px;border:0;border-bottom:1px solid var(--shell-chrome-line);border-radius:0;
  background:var(--shell-chrome);color:var(--shell-text);box-shadow:none;
  box-sizing:border-box;z-index:40;
}
html body:is(.dev-phone,.dev-pad,.tab-port) #tabbar > * {order:0;grid-column:auto;flex-shrink:0}
html body #tabbar .tb-seg {
  display:flex;flex-direction:row;align-items:center;gap:2px;padding:3px;
  background:var(--shell-soft);border-radius:9px;
}
html body #tabbar button {
  display:inline-flex;flex-direction:row;align-items:center;justify-content:center;
  height:36px;min-width:36px;padding:0 13px;border-radius:6px;
  font-family:Pretendard,sans-serif;font-size:13px;font-weight:500;line-height:1;
  letter-spacing:-.02em;color:var(--shell-muted);transition:background .16s,color .16s;
}
html body #tabbar .tb-seg button {height:34px;padding:0 12px}
html body #tabbar .tb-seg button.on {background:var(--shell-surface);color:var(--shell-text);font-weight:650;box-shadow:0 1px 3px rgb(24 24 22 / 8%)}
html body #tabbar :is(.tb-nav,.tb-set,.zb-back) {margin:0;padding:0;width:36px;height:36px;border-radius:7px;color:var(--shell-muted)}
html body #tabbar .tb-today {margin:0 0 0 auto;padding:0 13px;background:var(--shell-soft);color:var(--shell-text)!important;font-size:12px}
html body #tabbar .tb-nav:has(+.tb-today) {margin-left:auto}
html body #tabbar .tb-nav+.tb-today {margin-left:0}
html body #tabbar .tb-today~.tb-nav {margin-left:0}
html body #tabbar .zb-date {min-width:0;flex:1;color:var(--shell-text);font-family:Pretendard,sans-serif}
html body #tabbar .zb-date b {font-size:13px;font-weight:650;color:var(--shell-text)}
html body #tabbar .zb-date span {color:var(--shell-muted);font-size:10px;font-weight:500}
html body #tabbar .zb-back+.zb-nav {margin-left:-5px}
html body #tabbar button:focus-visible {outline:2px solid var(--shell-action);outline-offset:2px}
@media (hover:hover) {
  html body #tabbar button:not(.on):hover {background:var(--shell-line);color:var(--shell-text)}
}
html body:is(.dev-phone,.dev-pad,.tab-port) .app {padding-top:calc(var(--shell-top) + 16px)}
html body:is(.dev-pad,.tab-port) .app {padding-left:20px;padding-right:20px}

/* Mobile daily paper stays on the desk. Zoom and keyboard use #dayView's own scroll area. */
html:has(body.dev-phone.view-day) {height:100%;overflow:hidden;overscroll-behavior:none}
html body.dev-phone.view-day {
  position:fixed;inset:0;width:100%;height:100%;min-height:0;
  overflow:hidden;overscroll-behavior:none;
}
html body.dev-phone.view-day .app {
  height:100%;min-height:0;box-sizing:border-box;padding-bottom:0;overflow:hidden;
}
html body.dev-phone.view-day:not(.zoom-in):not(.zoom-write):not(.zoom-time) #dayView {
  overflow:hidden;overflow:clip;overflow-clip-margin:12px;overscroll-behavior:none;
}
/* Inline height/overflow from fitKb still exposes the part above the keyboard. */
html body.dev-phone.view-day #dayView[data-kb] {overscroll-behavior:contain}

@media (min-width:760px) {
  html body:is(.dev-phone,.dev-pad,.tab-port) #tabbar {padding-left:28px;padding-right:28px;gap:12px}
  html body #tabbar::before {content:'툭 플래너';margin-right:18px;color:var(--shell-text);font-size:16px;font-weight:650;letter-spacing:-.04em;white-space:nowrap}
}
@media (max-width:359px) {
  html body:is(.dev-phone,.dev-pad,.tab-port) #tabbar {gap:5px;padding-left:8px;padding-right:8px}
  html body #tabbar .tb-seg button {min-width:34px;padding:0 10px;font-size:12px}
  html body #tabbar :is(.tb-nav,.tb-set,.zb-back) {min-width:30px;width:30px}
  html body #tabbar .tb-today {padding:0 10px}
  html body #tabbar .zb-date b {font-size:12px}
  html body #tabbar .zb-date span {display:none}
  html body.zoom-in #tabbar .tb-seg button {padding:0 8px}
}

/* Keep the existing writing tools in place; give their container the app finish. */
html body .app > .board > .quick {
  background:var(--shell-surface);color:var(--shell-text);border:1px solid var(--shell-line);
  border-radius:12px;box-shadow:0 3px 14px rgb(24 24 22 / 6%);
}
html body .quick-box {background:transparent;border-color:transparent;box-shadow:none}
html body .quick :is(input,.quick-hint) {color:var(--shell-text)}
html body .quick input::placeholder {color:var(--shell-muted);opacity:.8}
html body .quick :is(.ink-btn,.mic-btn,.q-clear) {color:var(--shell-muted);border-radius:6px}
html body .quick :is(.ink-btn,.mic-btn).on {background:var(--shell-soft);color:var(--shell-text)}
html body .quick .quick-go {background:var(--shell-action);color:var(--shell-action-text);border-radius:8px;font-size:13px;font-weight:600}
html body .quick:focus-within {border-color:color-mix(in srgb,var(--shell-text) 30%,var(--shell-line))}
html body #calView > .wk-strip-wrap .wk-strip-in {background:var(--shell-surface);border:1px solid var(--shell-line);border-radius:10px;box-shadow:var(--shell-shadow);padding:4px}
html body #calView > .wk-strip-wrap .wk-strip-in button {border-radius:7px;color:var(--shell-muted)}
html body #calView > .wk-strip-wrap .wk-strip-in b {font-family:Pretendard,sans-serif;font-size:15px;font-weight:650;color:var(--shell-text)}
html body #calView > .wk-strip-wrap .wk-strip-in button.on {background:var(--shell-soft)}
html body #calView > .wk-strip-wrap .wk-strip-in button.on :is(b,span) {color:var(--shell-text)!important}

/* Settings use the same header and surface rhythm as Home. */
html body.drawer #side {
  top:calc(var(--shell-top) + 8px);right:12px;bottom:max(12px,env(safe-area-inset-bottom));
  width:min(380px,calc(100vw - 32px));max-height:calc(100dvh - var(--shell-top) - 20px)!important;
  padding:0 14px 20px;border:1px solid var(--shell-line);border-radius:12px;
  background:var(--shell-surface);color:var(--shell-text);box-shadow:0 8px 32px rgb(24 24 22 / 13%);
  scrollbar-width:thin;scrollbar-color:var(--shell-line) transparent;
}
html body #side {--card:var(--shell-surface);--side:var(--shell-surface);--soft:var(--shell-soft);--line:var(--shell-line);--text:var(--shell-text);--sub:var(--shell-muted)}
html body #side .side-top {
  position:sticky;top:0;z-index:4;min-height:58px;margin:0 -14px 16px;
  padding:10px 14px;background:var(--shell-surface);
  border-bottom:1px solid var(--shell-chrome-line);gap:12px;
}
html body #side .side-tabs {gap:4px;padding:0;background:transparent;border-radius:0}
html body #side .side-tabs button {height:34px;border-radius:6px;color:var(--shell-muted);font-size:13px;font-weight:500}
html body #side .side-tabs button.on {background:var(--shell-soft);color:var(--shell-text);box-shadow:none;font-weight:650}
html body #side .side-close {width:32px;height:32px;border-radius:6px;background:transparent;color:var(--shell-muted);flex:none}
html body #side :is(.sg,.acc) {background:var(--shell-surface);border:1px solid var(--shell-line);border-radius:8px;box-shadow:none}
html body #side .acc {padding:14px;margin-bottom:8px}
html body #side .acct {gap:12px;padding:0 0 12px}
html body #side .acct :is(img,.ph) {width:38px;height:38px;border-radius:8px;background:var(--shell-soft);color:var(--shell-text)}
html body #side .acct b {font-size:15px;color:var(--shell-text)}
html body #side .acct span {font-size:11px;color:var(--shell-muted)}
html body #side .acct>div {overflow:hidden}
html body #side .acct>div span {display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;margin-top:4px}
html body #side .plan-row {padding:10px 0;border-top:1px solid var(--shell-line);color:var(--shell-muted);font-size:12px}
html body #side #syncState {margin:5px 0 0;font-size:11px;color:var(--shell-muted)}
html body #side .sg-h {padding:20px 4px 9px;font-size:11px;font-weight:550;color:var(--shell-muted);letter-spacing:.015em}
html body #side .sr {min-height:52px;padding:9px 11px;gap:10px;font-size:13px;color:var(--shell-text)}
html body #side .sr+.sr::before {left:46px;right:12px;background:var(--shell-line);opacity:.65}
html body #side .sr-v {font-size:12px;color:var(--shell-muted);max-width:40%}
html body #side .sr .si {width:25px;height:28px;border-radius:0;background:transparent!important;color:var(--shell-muted)!important}
html body #side .si svg {stroke:currentColor}
html body #side .sr .sc {color:var(--shell-muted);opacity:.55}
html body #side .sr:hover {background:var(--shell-soft)}
html body #side .sp-head {min-height:46px;padding:0 0 12px;grid-template-columns:36px 1fr 36px}
html body #side .sp-head b {font-size:16px;font-weight:650;letter-spacing:-.03em;color:var(--shell-text)}
html body #side .sp-back {width:34px;height:34px;border-radius:6px;border:1px solid var(--shell-line);background:var(--shell-surface);color:var(--shell-text)}
html body #side .sp-intro {padding:4px 3px 22px;gap:12px}
html body #side .sp-intro .si {width:36px;height:36px;border-radius:8px;background:var(--shell-soft)!important;color:var(--shell-text)!important}
html body #side .sp-intro p {font-size:13px;line-height:1.7;color:var(--shell-muted)}
html body #side .sp-intro p b {color:var(--shell-text)}
html body #side .sp-body {padding:8px 14px 14px}
html body #side .set-row {min-height:52px;color:var(--shell-text);border-color:var(--shell-line);font-size:14px}
html body #side :is(.hint,.biz-line) {color:var(--shell-muted);line-height:1.65}
html body #side :is(.btn,.mini) {border-color:var(--shell-line);border-radius:6px}
html body #side .btn:not(.danger):not(.prem-btn) {background:var(--shell-soft);color:var(--shell-text)}
html body #side :is(input,select,textarea) {border-color:var(--shell-line);background-color:var(--shell-surface);color:var(--shell-text)}
html body #side .seg {border-radius:7px;background:var(--shell-soft)}
html body #side .seg button {border-radius:5px}
html body #side .seg button.on {background:var(--shell-surface);color:var(--shell-text)}
html body #side button:focus-visible {outline:2px solid var(--shell-accent-ink);outline-offset:2px}
@media (max-width:600px) {
  html body.drawer #side {top:calc(var(--shell-top) + 12px);bottom:auto;width:min(360px,calc(100vw - 40px));height:min(680px,74dvh)!important}
  html body.dev-phone #sideSet .set-row .seg {border-radius:7px}
  html body.dev-phone #sideSet .set-row .seg button {border-radius:5px}
}
/* Secondary surfaces match the app without changing editing-pill geometry. */
html body .pop:not(.strip) {border:1px solid var(--shell-line);background:var(--shell-surface);color:var(--shell-text);border-radius:var(--shell-radius);box-shadow:0 8px 28px rgb(24 24 22 / 12%)}
html body .pc-sheet {background:var(--shell-surface);color:var(--shell-text);border:1px solid var(--shell-line);border-radius:12px 12px 0 0}
html body .pc-h {border-bottom:1px solid var(--shell-line)}
html body .toast {border-radius:8px;box-shadow:var(--shell-shadow)}
html body:is([data-desk="night"],[data-desk="mat"]) #calView > .st .home-heading :is(p,h1,span) {color:#ececea}
@media (prefers-reduced-motion:reduce) {
  html body #tabbar button {transition:none}
}
