:root {
  --bg: #12141a;
  --card: #1b1e27;
  --ink: #ece7dc;
  --muted: #9a9386;
  --line: #2a2e3a;
  --accent: #d8a15a;
  --ok: #7dba7a;
  --warn: #e2a39a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.45 Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--ink);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--ink); text-decoration: none; font-weight: 700; }
main { padding: 1.25rem; max-width: 1280px; margin: 0 auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .row { grid-template-columns: 1fr; } }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1rem;
}
.narrow { max-width: 24rem; margin: 3rem auto; }
h1, h2 { margin: 0 0 0.6rem; font-size: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 0.65rem; margin: 0.75rem 0; }
label { display: flex; flex-direction: column; gap: 0.25rem; }
input, select, textarea, button, .btn {
  font: inherit;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #111318;
  color: var(--ink);
}
button, .btn {
  background: var(--accent);
  color: #1b140b;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  width: fit-content;
}
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.6rem 0; }
.muted { color: var(--muted); font-size: 0.92rem; }
.warn { color: var(--warn); }
.flash { margin: 0.8rem 1.25rem; padding: 0.55rem 0.7rem; background: #2a2418; border-radius: 6px; }
.plain { list-style: none; padding: 0; }
.plain li { margin: 0.4rem 0; }
.inline { display: inline; }
.linkish { background: none; color: var(--accent); padding: 0; border: 0; }
.badge { font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 999px; border: 1px solid var(--line); }
.badge.write { color: var(--ok); }
.badge.read { color: var(--muted); }
.badge.mirror { color: var(--accent); }
.cal { border-top: 1px solid var(--line); padding: 0.85rem 0; }
.cal-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.4rem; }
.days { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; margin: 0.4rem 0; }
.check { flex-direction: row; align-items: center; gap: 0.35rem; }
.week-nav { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.week-nav-actions { display: flex; gap: 0.75rem; align-items: center; }
.week-nav .cal-toggle { display: inline-flex; align-items: center; background: transparent; color: var(--ink); border: 0; box-shadow: none; padding: 0.05rem 0.1rem; font-size: 0.85rem; width: auto; }
.week-nav .cal-toggle.off { color: var(--muted); text-decoration: line-through; }
.week-frame { display: flex; align-items: center; gap: 0.4rem; }
.week-scroll { overflow-x: auto; flex: 1; min-width: 0; }
.week-arrow { display: grid; place-items: center; width: 2.25rem; height: 3.25rem; flex: 0 0 auto; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.week-arrow:hover { border-color: var(--accent); color: var(--accent); }
.week-grid { display: grid; grid-template-columns: 3.4rem repeat(7, minmax(6.5rem, 1fr)); min-width: 760px; }
.week-grid.days-5 { grid-template-columns: 3.4rem repeat(5, minmax(6.5rem, 1fr)); min-width: 560px; }
.day-name { padding: 0.35rem 0.3rem; font-size: 0.85rem; border-bottom: 1px solid var(--line); }
.day-name.today, .day-col.today { background: #242018; }
.legend { display: flex; flex-direction: column; align-items: flex-start; gap: 0.55rem; margin: 0.4rem 0 0.8rem; font-size: 0.85rem; }
.legend-group { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; align-items: center; }
.legend-account { flex: 1 0 100%; color: var(--muted); font-size: 0.75rem; }
.legend form { margin: 0; }
.cal-label { display: inline-flex; align-items: center; gap: 0.28rem; }
.legend input[type="color"] { -webkit-appearance: none; appearance: none; width: 0.9rem; height: 0.9rem; padding: 0; border: 0; border-radius: 2px; background: transparent; cursor: pointer; }
.legend input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.legend input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.legend input[type="color"]::-moz-color-swatch { border: 0; border-radius: 2px; }
.legend button.cal-toggle { display: inline-flex; align-items: center; background: transparent; color: var(--ink); border: 0; box-shadow: none; padding: 0.05rem 0.1rem; font-size: 0.85rem; width: auto; }
.legend button.cal-toggle.off { color: var(--muted); text-decoration: line-through; }
.legend-note { display: inline-flex; align-items: center; }
.legend i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 0.3rem; }
.all-day { min-height: 1.6rem; border-bottom: 1px solid var(--line); padding: 0.15rem; display: flex; flex-direction: column; gap: 0.15rem; }
.chip, .block { color: #1b140b; border-radius: 4px; padding: 0.1rem 0.25rem; font-size: 0.72rem; line-height: 1.2; overflow: hidden; }
.hours .hour { height: 48px; font-size: 0.7rem; color: var(--muted); }
.day-col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent, transparent 47px, #2a2e3a 48px); }
.block { position: absolute; box-sizing: border-box; }
.block strong, .block span { display: block; }
.alert { white-space: pre-wrap; }
body.widget { height: 100dvh; overflow: hidden; }
body.widget .week-card { height: 100%; margin: 0; border: 0; border-radius: 0; display: flex; flex-direction: column; padding: 0.4rem 0.45rem; }
body.widget .week-nav h2 { font-size: 0.95rem; margin: 0; }
body.widget .week-nav .btn { font-size: 0.75rem; padding: 0.2rem 0.4rem; }
body.widget .legend { margin: 0.25rem 0 0.35rem; font-size: 0.72rem; gap: 0.25rem; }
body.widget .legend .cal-toggle.off { color: var(--muted); text-decoration: line-through; }
body.widget .week-arrow { width: 1.7rem; height: 2.4rem; }
body.widget .week-frame { flex: 1; min-height: 0; }
body.widget .week-scroll { overflow: hidden; }
