:root {
  --bg: #f2f2f7; --card: #fff; --text: #1c1c1e; --muted: #8e8e93; --line: rgba(60,60,67,.14);
  --accent: #e53935; --ok: #34c759; --warn: #ff9f0a; --chip: #e5e5ea;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f2f2f7; --muted: #8e8e93; --line: rgba(84,84,88,.5); --chip: #2c2c2e; --accent: #ff453a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
body { padding: calc(var(--safe-t) + 52px) 0 calc(var(--safe-b) + 70px); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.top h1 { font-size: 22px; margin: 0; flex: 1; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--accent); }
main { max-width: 680px; margin: 0 auto; padding: 4px 14px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; z-index: 5; padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 90%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 0.5px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 7px 0 6px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tabs button span { font-size: 21px; filter: grayscale(1); opacity: .6; }
.tabs button.on { color: var(--accent); } .tabs button.on span { filter: none; opacity: 1; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 0; background: var(--chip); border-radius: 16px; padding: 5px 12px; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--accent); color: #fff; }
.day { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; margin: 14px 4px 6px; }
.item { display: flex; gap: 10px; background: var(--card); border-radius: 14px; padding: 11px 12px; margin-bottom: 7px; }
.item .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--chip); display: grid; place-items: center; font-size: 18px; flex: none; }
.item .tx { flex: 1; min-width: 0; }
.item .hd { display: flex; gap: 6px; align-items: baseline; }
.item .t { font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.item .h { font-size: 13px; color: var(--muted); flex: none; }
.item .b { font-size: 14.5px; color: var(--text); opacity: .85; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.item.open .b { -webkit-line-clamp: unset; display: block; }
.item.urg { box-shadow: inset 3px 0 0 var(--accent); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 8px; background: var(--chip); color: var(--muted); margin-top: 5px; margin-right: 4px; }
.tag.r { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty b { display: block; font-size: 40px; margin-bottom: 8px; }
.more { display: block; width: 100%; border: 0; background: none; color: var(--accent); padding: 12px; }

.sec { margin: 18px 0 6px; }
.sec h2 { font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; margin: 0 4px 6px; }
.grp { background: var(--card); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; min-height: 46px; border-top: 0.5px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row input[type=text], .row input[type=password], .row input:not([type]) { flex: 1.4; min-width: 0; border: 0; background: none; text-align: right; color: var(--muted); outline: none; }
.row input[type=time] { border: 0; background: var(--chip); border-radius: 8px; padding: 4px 8px; }
.row select { border: 0; background: none; color: var(--muted); text-align: right; max-width: 55%; }
.btn { border: 0; background: none; color: var(--accent); padding: 0; font-size: 16px; text-align: left; }
.btn.red { color: #ff3b30; }
.btn.sm { font-size: 14px; flex: none; }
.note { font-size: 13px; color: var(--muted); margin: 6px 6px 0; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.sw { position: relative; width: 51px; height: 31px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw i { position: absolute; inset: 0; background: var(--chip); border-radius: 31px; transition: .2s; }
.sw i::after { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: .2s; }
.sw input:checked + i { background: var(--ok); }
.sw input:checked + i::after { transform: translateX(20px); }
.ok { color: var(--ok); } .bad { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 80px); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: rgba(30,30,30,.92); color: #fff; padding: 9px 16px; border-radius: 20px; font-size: 14px; transition: .25s; max-width: 90%; text-align: center; z-index: 9; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
