@font-face { font-family: "PT Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ptsans-400.woff2) format("woff2"); }
@font-face { font-family: "PT Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/ptsans-400i.woff2) format("woff2"); }
@font-face { font-family: "PT Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/ptsans-700.woff2) format("woff2"); }

:root {
  --ink: #3b3b3b;
  --ink2: #6b6b6b;
  --line: #dee2e6;
  --bee: #FFCB06;
  --bee-txt: #FFD949;
  --dark: #3b3b3b;
  --dark-h: #4c4c4c;
  --red: #ca1212; --orange: #f89406; --blue: #125bca; --green: #00ad00; --dkgreen: #228c22;
  --bg: #ffffff;
  --soft: #f7f7f5;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "PT Sans", Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: #1a5fb4; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #f2f2f2; padding: 1px 4px; border-radius: 3px; word-break: break-all; }
.muted { color: var(--ink2); }
.warn { color: #b05a00; }
.good { color: #1f7a1f; }
.neg { color: #c01010; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.topbar { background: var(--bee); padding-top: env(safe-area-inset-top); border-bottom: 1px solid #e6b600; }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 8px 2%; display: flex; align-items: center; gap: 16px; min-height: 46px; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 22px; letter-spacing: -0.3px; }
.wordmark b { font-weight: 700; }
.wm-mark { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); position: relative; display: inline-block; }
.wm-mark::after { content: ""; position: absolute; left: 3px; right: -7px; top: 50%; height: 3px; background: #ff0000; transform: rotate(-32deg); transform-origin: left center; }
.topbar-note { color: #5a4a00; font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync { border: 0; background: rgba(255,255,255,0.45); border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: #888; display: inline-block; }
.sync.s-synced i, .sync.s-idle i { background: #1f9a1f; }
.sync.s-syncing i { background: #1a5fb4; animation: pulse 1s infinite alternate; }
.sync.s-error i { background: #d01010; }
.sync.s-offline i { background: #999; }
.sync.s-local i { background: #e08a00; }
@keyframes pulse { to { opacity: 0.3; } }

/* ---------------------------------------------------------------- layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 2% 40px; }
.goalhead { padding: 18px 0 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.crumbs { font-size: 26px; color: #888; }
.crumbs b { color: var(--ink); }
.fineprint { margin: 0; color: var(--ink2); font-size: 14px; flex: 1 1 420px; }

/* hero row */
.hero { display: flex; justify-content: center; gap: 10px; padding: 12px 0; flex-wrap: wrap; }
.hbox { min-width: 190px; padding: 6px 16px 8px; text-align: center; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.hbox b { font-size: 24px; line-height: 40px; font-weight: 700; white-space: nowrap; }
.hbox small { font-size: 12px; opacity: 0.92; }
.hbox-dark { background: var(--dark); color: var(--bee); }
.hbox-dark small { color: #fff; }
.hbox-count { color: #fff; min-width: 210px; }
.st-red { background: var(--red); }
.st-orange { background: var(--orange); }
.st-blue { background: var(--blue); }
.st-green { background: var(--green); }
.st-dkgreen { background: var(--dkgreen); }
.hbox-prog .of { font-size: 15px; color: #e8e8e8; font-weight: 400; }
.pbar { display: block; height: 4px; background: #5f5f5f; margin-top: 6px; }
.pbar span { display: block; height: 100%; background: var(--bee); }

.banner { margin: 0 0 14px; padding: 9px 14px; background: var(--soft); border-left: 4px solid #c8c8c8; font-size: 14.5px; }
.banner.bad { background: #fff1f1; border-left-color: var(--red); }
.banner.ok { background: #effbe9; border-left-color: var(--green); }

/* entry + graph */
.goalmain { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.entry { position: sticky; top: 10px; }
.entry-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; color: var(--ink2); }
#entry { background: var(--soft); border: 1px solid #ececec; padding: 12px 12px 14px; }
.fld { display: block; margin-bottom: 9px; }
.fld > span { display: block; font-size: 11.5px; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.fld input, .fld select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid #cfcfcf; border-radius: 0;
  padding: 8px 9px; height: 40px; -webkit-appearance: none; appearance: none;
}
.fld select { background-image: linear-gradient(45deg, transparent 50%, #666 50%), linear-gradient(135deg, #666 50%, transparent 50%); background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; text-overflow: ellipsis; }
.fld input:focus, .fld select:focus { outline: 2px solid var(--bee); outline-offset: -1px; border-color: #b8960a; }
.fld-row { display: flex; gap: 8px; align-items: flex-end; }
.fld-min { flex: 0 0 92px; }
.fld-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.chip { border: 1px solid #cfcfcf; background: #fff; padding: 0 10px; height: 32px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--ink); }
.hint { font-size: 12.5px; color: var(--ink2); margin: 2px 0 10px; min-height: 36px; line-height: 1.4; }
.hint b { color: var(--ink); }
.hint .note { color: #1a5fb4; }

.bbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--dark); color: var(--bee-txt); border: 0; border-radius: 0; cursor: pointer;
  text-transform: uppercase; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; padding: 10px 26px; text-decoration: none;
}
.bbtn:hover { background: var(--dark-h); }
.bbtn:active { background: #5e5e5e; }
.bbtn:disabled { opacity: 0.6; cursor: default; }
.bbtn-wide { width: 100%; height: 44px; font-size: 14px; }
.bbtn-sm { padding: 7px 14px; font-size: 12px; }
.link { background: none; border: 0; color: #1a5fb4; cursor: pointer; padding: 0; text-decoration: underline; font-size: 13px; }

.recent { margin-top: 16px; }
.recent-head { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink2); margin-bottom: 4px; }
.recent-head a { text-transform: none; letter-spacing: 0; }
#recent { list-style: none; margin: 0; padding: 0; }
#recent li { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; border-bottom: 1px solid #f0f0f0; font-size: 15px; }
#recent li.empty { color: var(--ink2); font-size: 13px; border: 0; }
.dp-day { font-weight: 700; width: 20px; text-align: right; flex: none; }
.dp-val { font-weight: 700; width: 30px; text-align: right; flex: none; }
.dp-c { flex: 1; min-width: 0; color: #555; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x { border: 0; background: none; color: #b0b0b0; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.x:hover { color: #c01010; }
#recent li .x { opacity: 0; }
#recent li:hover .x, #recent li:focus-within .x { opacity: 1; }
@media (hover: none) { #recent li .x { opacity: 1; } }

.badge { font-size: 10.5px; padding: 1px 6px; border-radius: 9px; white-space: nowrap; flex: none; font-weight: 700; }
.b-short { background: #ffe1e1; color: #a00; }
.b-over { background: #e7f0ff; color: #1a4fa0; }
.b-done { background: #e3f6e3; color: #1d6e1d; }
.b-now { background: var(--bee); color: var(--ink); }

.graphcol { min-width: 0; }
.graphbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.seg { display: inline-flex; border: 1px solid #cfcfcf; }
.seg button { border: 0; background: #fff; padding: 5px 14px; cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid #cfcfcf; }
.seg button[aria-selected="true"] { background: var(--dark); color: var(--bee-txt); }
.graphbox { position: relative; border: 1px solid #e3e3e3; }
.graph svg { display: block; font-family: "PT Sans", Helvetica, sans-serif; user-select: none; -webkit-user-select: none; }
.tip { position: absolute; pointer-events: none; background: rgba(255,255,255,0.97); border: 1px solid #bbb; box-shadow: 0 2px 8px rgba(0,0,0,0.12); padding: 6px 9px; font-size: 12.5px; min-width: 170px; z-index: 2; }
.tip b { display: block; margin-bottom: 3px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }
.tip div span:first-child { color: var(--ink2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); padding: 7px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-line { display: inline-block; width: 18px; height: 3px; }
.lg-line.thin { height: 2px; }
.lg-band { display: inline-block; width: 18px; height: 10px; background: #ffff88; border: 1px solid #ecec70; }
.lg-aura { display: inline-block; width: 18px; height: 8px; background: #E5BbE5; opacity: 0.8; border-radius: 4px; }

/* ---------------------------------------------------------------- tabs */
.tabs { margin-top: 26px; }
.tabnav { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabnav::-webkit-scrollbar { display: none; }
.tabnav button { border: 1px solid transparent; border-bottom: 0; background: none; padding: 9px 16px; cursor: pointer; color: #1a5fb4; margin-bottom: -1px; white-space: nowrap; font-size: 14.5px; }
.tabnav button:hover { border-color: #eee #eee var(--line); }
.tabnav button[aria-selected="true"] { color: #495057; background: #fff; border-color: var(--line) var(--line) #fff; }
.tabpanel { padding: 16px 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head p { margin: 0; color: var(--ink2); max-width: 70ch; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.dtable th, .dtable td, .ltable th, .ltable td { padding: 6px 8px; border-bottom: 1px solid #eee; text-align: left; vertical-align: middle; }
.dtable thead th, .ltable thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink2); border-bottom: 2px solid var(--line); font-weight: 700; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.act { width: 1%; white-space: nowrap; text-align: right; }
.cmt { color: #555; }
tr.deleted td { color: #aaa; text-decoration: line-through; }
tr.deleted td.act { text-decoration: none; }
.empty { color: var(--ink2); }

.ltable tr.lv th { font-size: 17px; padding-top: 18px; border-bottom: 2px solid var(--bee); text-align: left; }
.ltable tr.course th { font-size: 14px; padding-top: 12px; background: #fafafa; text-align: left; }
.ltable .lnum { color: var(--ink2); width: 36px; }
.ltable tr.complete td { color: #8a8a8a; }
.ltable tr.current td { background: #fffbe0; }
.barcell { width: 26%; }
.lbar { display: block; height: 8px; background: #eee; min-width: 60px; }
.lbar span { display: block; height: 100%; background: #6BC461; }
tr.current .lbar span { background: #e0a800; }

.stats, .settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.settings { grid-template-columns: 2fr 1fr; }
.card { border: 1px solid #ececec; padding: 12px 14px; background: #fff; }
.card h3, .dial h3 { margin: 0 0 8px; font-size: 15px; }
.card h4 { margin: 14px 0 4px; font-size: 14px; }
.card h3 + p { margin-top: 0; }
.card h3:not(:first-child) { margin-top: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 6px 0; }
.kv dt { color: var(--ink2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sbar { display: grid; grid-template-columns: 50px 1fr 36px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.sbar .lbar span { background: var(--dark); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.copyrow { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.copyrow input { flex: 1; min-width: 200px; font: inherit; padding: 7px 8px; border: 1px solid #cfcfcf; }
.filebtn { cursor: pointer; }

.dial { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 26px; }
.dialform { background: var(--soft); border: 1px solid #ececec; padding: 12px; }
.dial-r h3:not(:first-child) { margin-top: 18px; }

.foot { color: #aaa; font-size: 12px; text-align: center; margin-top: 30px; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #2c2c2c; color: #fff; padding: 10px 16px; display: flex; gap: 16px; align-items: center; max-width: min(560px, 92vw);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25); z-index: 10; font-size: 14px;
}
.toast .link { color: var(--bee); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .goalmain { grid-template-columns: 270px minmax(0, 1fr); gap: 16px; }
  .dial { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 12px 30px; }
  .topbar-note { display: none; }
  .topbar-in { justify-content: space-between; }
  .goalhead { padding-top: 12px; }
  .crumbs { font-size: 20px; }
  .fineprint { font-size: 13px; }
  .hero { gap: 6px; padding: 8px 0 10px; }
  .hbox { min-width: 0; flex: 1 1 30%; padding: 4px 6px 6px; }
  .hbox b { font-size: 17px; line-height: 30px; }
  .hbox small { font-size: 11px; }
  .hbox-prog .of { font-size: 12px; }
  .goalmain { display: flex; flex-direction: column-reverse; }
  .entry { position: static; width: 100%; }
  .graphcol { width: 100%; }
  .legend { font-size: 11px; gap: 2px 10px; }
  .dtable th, .dtable td, .ltable th, .ltable td { padding: 6px 5px; }
  .barcell { display: none; }
  .tabnav button { padding: 9px 12px; }
}
@media (max-width: 420px) {
  .hbox-prog { flex-basis: 100%; }
}
