:root {
  --bg: #edf1f5;
  --card: #ffffff;
  --text: #263445;
  --muted: #788696;
  --accent: #2677a8;
  --border: #dce3ea;
  --shadow: 0 8px 24px rgba(32, 48, 67, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171e27;
    --card: #202a36;
    --text: #ecf2f8;
    --muted: #a6b2bf;
    --accent: #70c5eb;
    --border: #344252;
    --shadow: 0 8px 24px rgba(0, 0, 0, .2);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.dashboard-page { color: #f8fbff; background-color: #263445;
  background-image: linear-gradient(rgba(19, 31, 43, .50), rgba(19, 31, 43, .50)),
    url("/assets/background.avif");
  background-position: center; background-size: cover; background-attachment: fixed; background-repeat: no-repeat; }
.dashboard-page .logout-button { background: rgba(255, 255, 255, .78); }
header, main { max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }
.dashboard-page main { padding-bottom: 2rem; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between;
                    gap: 1rem; padding-top: 2.2rem; padding-bottom: 1.3rem; }
.brand { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.dashboard-logo { display: block; width: 77px; height: 77px; flex: 0 0 77px; object-fit: contain; }
.dashboard-clock { display: flex; align-items: center; justify-content: center; gap: .55rem;
  color: #f8fbff; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.dashboard-clock time { font-size: 1rem; font-weight: 700; }
.dashboard-clock span { color: rgba(255,255,255,.85); font-size: .85rem; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0; letter-spacing: -.035em; }
h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .11em;
     color: var(--muted); margin: 1.65rem 0 .7rem; }
.dashboard-page h2 { color: rgba(255, 255, 255, .9); }
.group-title { display: flex; align-items: center; gap: .55rem; width: fit-content;
  margin: 1.65rem 0 .7rem; color: rgba(255,255,255,.92); cursor: pointer;
  font-size: .82rem; font-weight: 700; letter-spacing: .11em; list-style: none; text-transform: uppercase; }
.group-title::-webkit-details-marker { display: none; }
.group-title::before { width: 0; height: 0; border-top: 5px solid transparent;
  border-bottom: 5px solid transparent; border-left: 6px solid currentColor; content: "";
  transition: transform .16s ease; }
.group[open] > .group-title::before { transform: rotate(90deg); }
.group-title:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.dashboard-header form { flex: 0 0 auto; }
.logout-button, .login-card button { border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem .9rem; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.logout-button:hover, .login-card button:hover { border-color: var(--accent); }
.tiles { display: grid; gap: .55rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { position: relative; display: flex; min-height: 62px; min-width: 0; flex-direction: row;
        align-items: center; justify-content: flex-start; gap: .7rem; overflow: hidden;
        padding: .65rem .8rem; border: 0; border-radius: 11px; color: #fff; text-decoration: none;
        box-shadow: 0 5px 14px rgba(27, 42, 57, .12);
        transition: transform .16s ease, box-shadow .16s ease, filter .16s ease; }
.tile::after { position: absolute; right: -18px; bottom: -38px; width: 100px; height: 100px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 50%; content: ""; }
.tile:hover { z-index: 1; transform: translateY(-3px); filter: saturate(1.08);
               box-shadow: 0 10px 20px rgba(27, 42, 57, .2); }
.tile:focus-visible, .logout-button:focus-visible, .login-card a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px; }
.tile:nth-child(6n + 1) { background: linear-gradient(135deg, #3479a8d9, #255a82d9); }
.tile:nth-child(6n + 2) { background: linear-gradient(135deg, #4c7c68d9, #315f51d9); }
.tile:nth-child(6n + 3) { background: linear-gradient(135deg, #80668ed9, #604b70d9); }
.tile:nth-child(6n + 4) { background: linear-gradient(135deg, #b36d4fd9, #8e4f3cd9); }
.tile:nth-child(6n + 5) { background: linear-gradient(135deg, #567aa3d9, #405d80d9); }
.tile:nth-child(6n) { background: linear-gradient(135deg, #8b7946d9, #6f6037d9); }
.icon { position: relative; z-index: 1; display: grid; width: 34px; height: 34px;
        flex: 0 0 34px; place-items: center; color: #fff; font-size: 1.55rem;
        font-weight: 650; line-height: 1; }
.icon img { width: 34px; height: 34px; object-fit: contain; }
.name { position: relative; z-index: 1; max-width: 100%; overflow: hidden; color: #fff;
        font-size: .94rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 330px);
  align-items: start; gap: 1.15rem; }
.link-groups { min-width: 0; }
.weather-card { align-self: start; margin-top: 1.65rem; padding: 1.1rem;
  background: rgba(255,255,255,.84); border: 1px solid rgba(255,255,255,.48);
  border-radius: 12px; box-shadow: var(--shadow); color: #263445; }
.weather-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.weather-heading h2 { margin: 0; color: inherit; font-size: .95rem; letter-spacing: 0; text-transform: none; }
.weather-current { display: flex; align-items: center; gap: .8rem; padding: .45rem 0 .75rem; }
.weather-icon { width: 66px; flex: 0 0 66px; font-size: 3rem; line-height: 1; text-align: center; }
.weather-reading { display: grid; gap: .1rem; }
.weather-reading strong { font-size: 2.3rem; line-height: 1.1; letter-spacing: -.05em; }
.weather-reading span { color: #53677b; font-size: .85rem; }
.weather-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem;
  padding: .65rem 0; border-top: 1px solid rgba(38,52,69,.14); border-bottom: 1px solid rgba(38,52,69,.14); }
.weather-details span { display: grid; gap: .12rem; color: #66798b; font-size: .72rem; }
.weather-details strong { color: #263445; font-size: .9rem; }
.weather-forecast { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem;
  padding: .65rem 0; border-bottom: 1px solid rgba(38,52,69,.14); }
.forecast-day { display: grid; justify-items: center; gap: .2rem; min-width: 0; }
.forecast-label { color: #66798b; font-size: .7rem; }
.forecast-icon { font-size: 1.15rem; line-height: 1.2; }
.forecast-temperatures { color: #263445; font-size: .7rem; font-weight: 650; white-space: nowrap; }
.weather-updated { margin: .65rem 0 .35rem; color: #718091; font-size: .7rem; }
.weather-updated a { color: #506b83; text-decoration: none; }
.weather-updated a:hover { text-decoration: underline; }
.notes-card { margin: 1.25rem 0 1.75rem; padding: 1.1rem;
  background: rgba(255,255,255,.84); border: 1px solid rgba(255,255,255,.48);
  border-radius: 12px; box-shadow: var(--shadow); color: #263445; }
.notes-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .55rem; }
.notes-heading h2 { margin: 0; color: inherit; }
.notes-heading-actions { display: flex; align-items: center; gap: .7rem; }
#notes-status { color: #66798b; font-size: .75rem; }
#notes-save { padding: .45rem .7rem; color: #fff; background: rgba(38,119,168,.9);
  border: 1px solid rgba(38,119,168,.6); border-radius: 7px; font: inherit; font-size: .78rem; cursor: pointer; }
#notes-save:hover:not(:disabled) { background: #2677a8; }
#notes-save:disabled { opacity: .6; cursor: wait; }
#notes-save:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notes-toolbar { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .65rem; }
.notes-toolbar button { min-width: 2rem; padding: .32rem .48rem; color: #34495e;
  background: rgba(255,255,255,.38); border: 1px solid rgba(38,52,69,.16); border-radius: 6px;
  font: inherit; font-size: .75rem; line-height: 1.2; cursor: pointer; }
.notes-toolbar button:hover { background: rgba(255,255,255,.72); }
.notes-toolbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notes-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.notes-editor, .notes-preview-pane { display: grid; align-content: start; gap: .4rem; min-width: 0; }
.notes-editor > span, .notes-preview-pane h3 { margin: 0; color: #566b80; font-size: .77rem; font-weight: 650; }
#notes-input { width: 100%; min-height: 220px; resize: vertical; padding: .75rem;
  color: #263445; background: rgba(255,255,255,.62); border: 1px solid rgba(38,52,69,.2);
  border-radius: 8px; font: .88rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
#notes-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.markdown-preview { min-height: 220px; padding: .7rem .8rem; overflow-wrap: anywhere;
  background: rgba(255,255,255,.38); border: 1px solid rgba(38,52,69,.12); border-radius: 8px; }
.markdown-preview > :first-child { margin-top: 0; }
.markdown-preview > :last-child { margin-bottom: 0; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3,
.markdown-preview h4, .markdown-preview h5, .markdown-preview h6 { margin: .7rem 0 .35rem;
  color: inherit; letter-spacing: normal; text-transform: none; }
.markdown-preview h1 { font-size: 1.35rem; }
.markdown-preview h2 { font-size: 1.15rem; }
.markdown-preview h3 { font-size: 1rem; }
.markdown-preview p, .markdown-preview ul, .markdown-preview ol, .markdown-preview blockquote { margin: .45rem 0; }
.markdown-preview ul, .markdown-preview ol { padding-left: 1.4rem; }
.markdown-preview blockquote { padding-left: .75rem; border-left: 3px solid var(--accent); color: #66798b; }
.markdown-preview pre, .markdown-preview code { padding: .1rem .25rem; background: rgba(38,52,69,.08); border-radius: 4px;
  font: .84rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.markdown-preview pre { padding: .65rem; overflow: auto; }
.markdown-preview pre code { padding: 0; background: none; }
.markdown-preview a { color: #2677a8; }
.feeds { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.feed { overflow: hidden; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--border);
        border-radius: 11px; box-shadow: var(--shadow); }
.dashboard-page .feed { background: rgba(255, 255, 255, .82); }
.feed-title-row { display: flex; align-items: center; gap: .55rem; min-width: 0;
  margin: -1rem -1.1rem .55rem; padding: .75rem 1.1rem;
  background: rgba(255,255,255,.36); border-bottom: 1px solid rgba(255,255,255,.42); }
.feed h3 { flex: 1 1 auto; min-width: 0; overflow: hidden; margin: 0; color: var(--text);
           font-size: .97rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.feed-updated { flex: 0 0 auto; margin: 0; color: var(--muted); font-size: .68rem; white-space: nowrap; }
.feed-update-button { flex: 0 0 auto; padding: .25rem .45rem; color: var(--text);
  background: rgba(255,255,255,.3); border: 1px solid rgba(38,52,69,.2); border-radius: 6px;
  font: inherit; font-size: .66rem; line-height: 1.2; cursor: pointer; }
.feed-update-button:hover:not(:disabled) { background: rgba(255,255,255,.65); }
.feed-update-button:disabled { opacity: .6; cursor: wait; }
.feed-update-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feed ul { list-style: none; margin: 0; padding: 0; max-height: 19rem;
           overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; }
.feed ul::-webkit-scrollbar { display: none; }
.feed li { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem 0;
           border-top: 1px solid var(--border); font-size: .9rem; }
.feed li:first-child { border-top: 0; }
.feed a { color: var(--text); text-decoration: none; }
.feed a:hover { color: var(--accent); }
.when, .muted { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background-color: #263445; color: #f8fbff;
  background-image: linear-gradient(rgba(19, 31, 43, .50), rgba(19, 31, 43, .50)),
    url("/assets/background.avif");
  background-position: center; background-size: cover; background-attachment: fixed; background-repeat: no-repeat; }
.login-card { width: min(100%, 24rem); padding: 1.5rem; background: var(--card);
  background: rgba(255, 255, 255, .82); border: 1px solid rgba(255,255,255,.45);
  border-radius: 12px; box-shadow: var(--shadow); color: #263445; }
.login-card h1 { margin: 0 0 1.25rem; font-size: 1.4rem; }
.login-card form { display: grid; gap: .55rem; }
.login-card label { margin-top: .35rem; font-size: .9rem; }
.login-card input { width: 100%; padding: .7rem; color: var(--text); background: var(--bg);
  background: rgba(255,255,255,.68); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.login-card button { margin-top: .75rem; background: var(--accent); color: #fff; border-color: var(--accent); }
.login-error { padding: .65rem; border-radius: 8px; background: var(--bg); color: #c0392b; }
.login-home { margin: 1rem 0 0; text-align: center; font-size: .9rem; }
.login-home a { color: var(--accent); }

@media (max-width: 760px) {
  header, main { padding-right: 1rem; padding-left: 1rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
  .weather-card { margin-top: .35rem; }
  .dashboard-header { flex-wrap: wrap; padding-top: 1.5rem; }
  .brand { order: 1; flex: 1 1 auto; }
  .dashboard-header form { order: 2; margin-left: auto; }
  .dashboard-clock { order: 3; flex: 1 1 100%; justify-content: flex-start; text-align: left; }
}
@media (prefers-color-scheme: dark) {
  .login-card { background: rgba(32, 42, 54, .82); border-color: rgba(255,255,255,.18); color: #ecf2f8; }
  .login-card input { background: rgba(23, 30, 39, .68); }
  .login-card button { background: rgba(112, 197, 235, .88); }
  .dashboard-page .feed { background: rgba(32, 42, 54, .82); }
  .feed-title-row { background: rgba(255,255,255,.1); border-bottom-color: rgba(255,255,255,.14); }
  .dashboard-page .logout-button { background: rgba(32, 42, 54, .78); }
  .feed-update-button { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: var(--text); }
  .feed-update-button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
  .weather-card { background: rgba(32, 42, 54, .86); border-color: rgba(255,255,255,.18); color: #ecf2f8; }
  .weather-reading span { color: #c0ccd8; }
  .weather-details, .weather-forecast { border-color: rgba(255,255,255,.16); }
  .weather-details span, .weather-updated { color: #a8b6c4; }
  .weather-details strong { color: #ecf2f8; }
  .forecast-label { color: #a8b6c4; }
  .forecast-temperatures { color: #ecf2f8; }
  .weather-updated a { color: #a9d8ef; }
  .notes-card { background: rgba(32, 42, 54, .86); border-color: rgba(255,255,255,.18); color: #ecf2f8; }
  .notes-editor > span, .notes-preview-pane h3,
  #notes-status, .markdown-preview blockquote { color: #a8b6c4; }
  #notes-save { color: #142432; }
  .notes-toolbar button { color: #ecf2f8; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
  .notes-toolbar button:hover { background: rgba(255,255,255,.18); }
  #notes-input { color: #ecf2f8; background: rgba(23,30,39,.68); border-color: rgba(255,255,255,.18); }
  .markdown-preview { background: rgba(23,30,39,.46); border-color: rgba(255,255,255,.14); }
  .markdown-preview pre, .markdown-preview code { background: rgba(255,255,255,.1); }
  .markdown-preview pre code { background: none; }
  .markdown-preview a { color: #a9d8ef; }
}
@media (max-width: 420px) {
  .tiles { gap: .5rem; }
  .tile { min-height: 58px; padding: .6rem .7rem; }
  .feeds { grid-template-columns: 1fr; }
  h1 { font-size: 1.55rem; }
  .logout-button { padding: .5rem .65rem; font-size: .85rem; }
}
