[hidden] { display: none !important; }
:root {
  --bg: #FBF1F7;
  --surface: #FFFFFF;
  --surface-2: #FAEFF6;
  --ink: #24121F;
  --muted: #765A6D;
  --line: #EBD5E3;
  --accent: #A8206E;
  --accent-ink: #FFFFFF;
  --plum: #6E1F5F;
  --brand-grad: linear-gradient(135deg, #C2287F 0%, #7A2068 100%);
  --danger: #B3261E;

  --rosa-fg: #A8206E;    --rosa-bg: #F8DCEC;
  --violeta-fg: #5E2A7E; --violeta-bg: #E9DDF3;
  --azul-fg: #1F5F99;    --azul-bg: #DCE8F5;
  --verde-fg: #2A7650;   --verde-bg: #D9EEE2;
  --ambar-fg: #96600A;   --ambar-bg: #F5E6C8;
  --grafite-fg: #4A5563; --grafite-bg: #E5E7EB;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #150B14;
    --surface: #201220;
    --surface-2: #2A182A;
    --ink: #F6EAF2;
    --muted: #BA9DB3;
    --line: #432A40;
    --accent: #E460A9;
    --accent-ink: #1B0B17;
    --plum: #F2AAD3;
    --brand-grad: linear-gradient(135deg, #E45AA6 0%, #B058A6 100%);
    --danger: #F2827B;

    --rosa-fg: #F28CC4;    --rosa-bg: #4A1D38;
    --violeta-fg: #C7A4EB; --violeta-bg: #35214D;
    --azul-fg: #8DBBEA;    --azul-bg: #1C3550;
    --verde-fg: #7FD0A3;   --verde-bg: #1B3A2B;
    --ambar-fg: #E8B864;   --ambar-bg: #46341A;
    --grafite-fg: #BFC6CF; --grafite-bg: #2E3239;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #150B14;
  --surface: #201220;
  --surface-2: #2A182A;
  --ink: #F6EAF2;
  --muted: #BA9DB3;
  --line: #432A40;
  --accent: #E460A9;
  --accent-ink: #1B0B17;
  --plum: #F2AAD3;
  --brand-grad: linear-gradient(135deg, #E45AA6 0%, #B058A6 100%);
  --danger: #F2827B;

  --rosa-fg: #F28CC4;    --rosa-bg: #4A1D38;
  --violeta-fg: #C7A4EB; --violeta-bg: #35214D;
  --azul-fg: #8DBBEA;    --azul-bg: #1C3550;
  --verde-fg: #7FD0A3;   --verde-bg: #1B3A2B;
  --ambar-fg: #E8B864;   --ambar-bg: #46341A;
  --grafite-fg: #BFC6CF; --grafite-bg: #2E3239;
  color-scheme: dark;
}

html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.c-azul    { --ev: var(--azul-fg);    --evbg: var(--azul-bg); }
.c-verde   { --ev: var(--verde-fg);   --evbg: var(--verde-bg); }
.c-ambar   { --ev: var(--ambar-fg);   --evbg: var(--ambar-bg); }
.c-rosa    { --ev: var(--rosa-fg);    --evbg: var(--rosa-bg); }
.c-violeta { --ev: var(--violeta-fg); --evbg: var(--violeta-bg); }
.c-grafite { --ev: var(--grafite-fg); --evbg: var(--grafite-bg); }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

/* ---------- Month ---------- */
.brand { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.logo { width: 64px; height: 64px; flex: none; border-radius: 50%; display: block; box-shadow: 0 0 0 1px var(--line); }
.brand-name {
  font-family: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--plum);
}
.month { min-width: 0; }
.bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.title {
  font-family: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--plum);
  margin: 0;
}
.title .yr { color: var(--muted); font-weight: 600; margin-left: 0.25em; }
.nav { display: flex; gap: 6px; margin-left: auto; }
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 500;
  min-height: 40px;
}
.btn:hover { background: var(--surface-2); }
.btn.icon { width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary {
  background: var(--brand-grad);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); background: var(--brand-grad); }
.btn.danger { color: var(--danger); }

.cal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.dow span {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.day {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  min-height: 104px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  position: relative;
}
.day:nth-child(7n) { border-right: 0; }
.day:nth-last-child(-n+7) { border-bottom: 0; }
.day:hover { background: var(--surface-2); }
.day:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.day.out .num { color: var(--muted); opacity: 0.55; }
.day.sel { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 0 0 0 2px var(--accent); }
.num {
  align-self: flex-start;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.day.today .num { background: var(--brand-grad); color: var(--accent-ink); }
.chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--evbg);
  color: var(--ev);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}
.chip .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ev); }
.chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more { font-size: 12px; color: var(--muted); padding-left: 6px; }
.hol {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--plum);
  overflow: hidden;
  overflow-wrap: anywhere;
}
.hol.fac { font-weight: 500; color: var(--muted); }
.day.holiday:not(.out):not(.today) .num { color: var(--accent); }

/* ---------- Side panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  position: sticky;
  top: 16px;
}
.panel h2 {
  font-family: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ev {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--evbg);
  color: var(--ink);
  border-left: 4px solid var(--ev);
}
.ev:hover { filter: brightness(0.97); }
.ev:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev .when { font-size: 12.5px; color: var(--ev); font-weight: 600; }
.ev .name { font-weight: 600; overflow-wrap: anywhere; }
.ev .note { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; margin-top: 2px; }
.empty { color: var(--muted); margin: 0 0 18px; }
.holnote { margin: -6px 0 14px; font-size: 14px; font-weight: 600; color: var(--plum); }
.notice { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0 0 16px; }
.notice p { margin: 0 0 10px; font-size: 14px; }
.notice .actions { margin-top: 0; }
.ev.static { cursor: default; }
.ev.static:hover { filter: none; }
.ev .by { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ev .by:empty { display: none; }
.export { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.export .btn { width: 100%; }
.export p { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.export .msg:empty { display: none; }

.formhead { font-weight: 600; margin: 0 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input[type="text"], .field input[type="time"], .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px 11px;
  min-height: 40px;
}
.field textarea { resize: vertical; min-height: 68px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; background: var(--surface); }
.row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatches .sw {
  display: block;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ev);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.swatches input:checked + .sw { box-shadow: 0 0 0 2px var(--ink); }
.swatches input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.err { color: var(--danger); font-size: 13.5px; margin: -4px 0 10px; min-height: 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 16px 12px 32px; }
  .panel { position: static; }
}
@media (max-width: 640px) {
  .title { font-size: 34px; }
  .dow span { padding: 6px 2px; text-align: center; font-size: 12px; }
  .day { min-height: 64px; padding: 6px 4px; align-items: center; }
  .num { align-self: center; }
  .chips { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .chip { padding: 0; background: transparent; }
  .chip .t { display: none; }
  .more { padding: 0; font-size: 11px; }
  .hol { display: block; padding: 0; }
  .hol .t { display: none; }
  .hol::before { content: ""; display: block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); }
  .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px 24px;
  text-align: center;
}
.login .logo { width: 96px; height: 96px; margin: 0 auto 14px; }
.login h1 {
  font-family: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--plum);
  margin: 0 0 20px;
}
.login .field { text-align: left; }
.login .field input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px 11px;
  min-height: 40px;
}
.login .field input:focus { outline: 2px solid var(--accent); outline-offset: 0; background: var(--surface); }
.login .btn.primary { width: 100%; margin-top: 4px; }
.login .err { margin: 0 0 12px; text-align: left; }

/* ---------- Topo ---------- */
.brand .spacer { flex: 1; }
.brand .who { color: var(--muted); font-size: 14px; }
.btn.link-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: inherit; }
.feed { margin-top: 12px; }
.feed label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.feed .copy-row { display: flex; gap: 6px; }
.feed input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
  font-size: 13px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }


.loading { text-align: center; padding: 48px 16px; color: var(--muted); margin: 0; }

.export .feed .copy-row .btn { width: auto; flex: none; }
