:root {
  --bg: #f4f5f8; --card: #fff; --text: #1b1e27; --muted: #6b7280; --line: #e3e6ee;
  --accent: #4f6bed; --ok: #1f9d55; --bad: #d64545; --warn: #d9822b;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1117; --card: #181b24; --text: #e8eaf0; --muted: #8b93a7; --line: #272b38; --accent: #7b92ff; --ok: #3ecf80; --bad: #ff6b6b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, sans-serif; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 1.05rem; }
h3 { font-size: .9rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: .85rem; }
.err { color: var(--bad); min-height: 1.2em; margin: 4px 0 0; font-size: .85rem; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }

input, select, button { font: inherit; color: inherit; }
input, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
button { padding: 8px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.mini { padding: 0 6px; background: transparent; color: var(--muted); border: 0; }
button:hover { filter: brightness(1.1); }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
label input, label select { margin-top: 4px; color: var(--text); }

.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; }
.brand { color: var(--muted); font-size: .85rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; padding: 0 24px 24px; max-width: 1300px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.wide { grid-column: 1 / -1; }

.today-main { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.clock { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.date { color: var(--muted); margin-top: 6px; }
.wnow { display: flex; align-items: center; gap: 12px; }
.wicon { font-size: 2.8rem; }
.wtemp { font-size: 1.8rem; font-weight: 700; }
.whours { display: flex; gap: 6px; overflow-x: auto; margin: 14px 0 8px; padding-bottom: 6px; }
.wh { display: flex; flex-direction: column; align-items: center; min-width: 54px; padding: 6px; border-radius: 8px; background: var(--bg); font-size: .85rem; }
.wh:first-child { outline: 2px solid var(--accent); }
.cityform { display: flex; gap: 6px; max-width: 260px; margin-bottom: 14px; }
.journal { border-top: 1px solid var(--line); padding-top: 12px; }
.journal audio { width: 100%; }
.journal .muted { margin: 4px 0 0; }

.sys { display: grid; gap: 6px; margin: 10px 0 14px; }
.meter { display: grid; grid-template-columns: 56px 1fr 120px; align-items: center; gap: 8px; font-size: .85rem; }
progress { width: 100%; height: 8px; accent-color: var(--ok); }
progress.hot { accent-color: var(--bad); }
.services { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.services li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--bg); }
.services .muted { margin-left: auto; font-size: .75rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); flex: none; }
.up .dot { background: var(--ok); }

#favs { margin-top: 12px; }
.links, .sub { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.sub { margin: 8px 0 4px 8px; }
.folder { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.folder > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.link { display: flex; align-items: center; gap: 4px; border-radius: 10px; background: var(--bg); padding: 4px; }
.link a { flex: 1; display: flex; align-items: center; gap: 10px; padding: 6px; color: inherit; text-decoration: none; min-width: 0; }
.link a:hover b { color: var(--accent); }
.tile { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; }
.ltxt { display: flex; flex-direction: column; min-width: 0; }
.ltxt b, .ltxt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { margin-left: auto; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog .row { justify-content: flex-end; }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(360px, 92vw); }
.login-card h1 { margin-bottom: 18px; }
.login-card button { width: 100%; margin-top: 4px; }
@media (max-width: 600px) { .grid { padding: 0 12px 16px; grid-template-columns: 1fr; } .clock { font-size: 2.6rem; } }
[hidden] { display: none !important; }
