/* ============================================================================
   Kalender — Editorial v2
   Instrument Serif (display, dramatic italic) + Geist (body).
   Petrol blue + warm clay on warm cream paper.
   ============================================================================ */

:root {
  /* Paper + ink */
  --paper: #F2EBDC;
  --paper-deep: #E8DEC9;
  --paper-raised: #FAF5EB;
  --ink: #18222F;
  --ink-soft: #45556B;
  --ink-fade: #93A0AE;
  --rule: #D9CDB6;
  --rule-soft: #E5DDC8;

  /* Owners — afdæmpet blå + brick red */
  --color-a: #2C4865;
  --color-a-soft: #D5DCE7;
  --color-b: #A04A47;
  --color-b-soft: #ECD7D6;

  /* Proposal accent — warm gold */
  --gold: #C49A3D;
  --gold-soft: #F0E1B8;
  --gold-deeper: #6B4D0C;

  /* Legacy aliases */
  --bg: var(--paper);
  --surface: var(--paper-raised);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --border: var(--rule);
  --accent: var(--gold);
  --warn-bg: var(--gold-soft);
  --warn-text: var(--gold-deeper);

  /* Typography */
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Geist", -apple-system, "Segoe UI", system-ui, sans-serif;

  /* Shadows */
  --shadow-soft: 0 1px 2px rgba(24,34,47,.04), 0 4px 14px rgba(24,34,47,.05);
  --shadow-lift: 0 12px 32px rgba(24,34,47,.16);
  --shadow-press: 0 2px 6px rgba(24,34,47,.10);

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ----------------------------------------------------------------- */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--paper);
  color: var(--ink);
  /* Paper texture: subtle SVG noise overlay + warm radial highlights */
  background-image:
    radial-gradient(ellipse 80% 60% at 12% -5%, rgba(160,74,71,.07), transparent 55%),
    radial-gradient(ellipse 70% 50% at 88% 105%, rgba(44,72,101,.07), transparent 55%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.094 0 0 0 0 0.133 0 0 0 0 0.184 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed, fixed, fixed;
  background-size: cover, cover, 200px 200px;
}

#app {
  max-width: 540px;
  margin: 0 auto;
  /* top padding leaves room for the fixed action bar (#confirmbar) */
  padding: 84px 24px 32px;
  min-height: 100vh;
  position: relative;
  animation: app-fade .45s var(--ease);
}

@keyframes app-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.loading {
  color: var(--ink-fade);
  text-align: center;
  padding: 80px 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
}

.boot-fail {
  max-width: 420px;
  margin: 80px auto;
  padding: 32px 24px;
  text-align: center;
  font-family: var(--font-body, system-ui, sans-serif);
}
.boot-fail h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  margin: 0 0 12px;
  color: var(--ink, #1a2230);
}
.boot-fail p {
  color: var(--ink-fade, #555);
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 20px;
}
.boot-fail button {
  background: #2C4865;
  color: #f2ebdc;
  border: none;
  padding: 12px 22px;
  font-size: 16px;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
}
.boot-fail button:hover { background: #1f3550; }
.boot-fail .boot-reason {
  margin-top: 24px;
  font-size: 12px;
  color: var(--ink-fade, #888);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-word;
}

/* ----------------------------------------------------------------- */
/* Login + setup wizard
/* ----------------------------------------------------------------- */

#app > h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: 72px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 36px 0 40px;
  text-transform: lowercase;
}

form label {
  display: block;
  margin: 16px 0 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

form input, form select {
  width: 100%;
  padding: 13px 15px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  transition: border-color .15s, box-shadow .15s;
}

form input:focus, form select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(24,34,47,.08);
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.row button, form > button {
  flex: 1;
  padding: 14px 18px;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper-raised);
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
  box-shadow: var(--shadow-soft);
}

.row button:hover, form > button:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.row button:active, form > button:active { transform: translateY(0); box-shadow: var(--shadow-press); }

.row button:first-child {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: none;
}
.row button:first-child:hover { background: var(--paper-raised); }

.login-extra {
  margin-top: 14px;
  text-align: center;
}
.login-extra a {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.login-extra a:hover { color: var(--ink); }

.msg {
  margin-top: 14px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
}

/* ----------------------------------------------------------------- */
/* Settings gear — lives inside the top action bar (#confirmbar). The
/* legacy floating icon styles are kept for the in-overlay close button
/* below; the bar itself styles its gear via #cb-settings.
/* ----------------------------------------------------------------- */

/* Gear is a button inside #confirmbar, so we need the same specificity as the
/* generic #confirmbar button rule below to override its padding/border. */
#confirmbar #cb-settings {
  width: 34px;
  height: 34px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .15s, transform .25s var(--ease), background .15s, box-shadow .15s;
}
#confirmbar #cb-settings:hover {
  color: var(--ink);
  background: var(--paper-raised);
  transform: rotate(60deg);
  box-shadow: var(--shadow-soft);
}

/* ----------------------------------------------------------------- */
/* Balance — typographic hero (no card, just print-style layout)
/* ----------------------------------------------------------------- */

.balance {
  margin: 0 0 40px;
  padding: 6px 4px 0;
  position: relative;
  transition: opacity .25s;
}

.balance.proposal::before {
  content: '';
  position: absolute;
  top: -10px; left: -16px; right: -16px; bottom: -14px;
  background: var(--gold-soft);
  border-radius: 6px;
  z-index: -1;
  opacity: 0.6;
  border: 1px solid var(--gold);
  box-shadow: var(--shadow-soft);
}

.bal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.bal-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  max-width: calc(50% - 8px);
}
.bal-chip:last-child { flex-direction: row-reverse; }
.bal-chip .dot, .bal-chip .num, .bal-label, .bal-num { display: none; }

.bal-chip .name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 40px;
  line-height: 1.04;
  color: var(--ink);
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bal-bar {
  position: relative;
  height: 4px;
  border-radius: 0;
  overflow: hidden;
  background: var(--rule-soft);
  margin: 4px 0 10px;
  display: flex;
  border: none;
}

.bal-bar-a, .bal-bar-b {
  transition: width .35s var(--ease);
  height: 100%;
}
.bal-bar-a { background: var(--color-a); }
.bal-bar-b { background: var(--color-b); }

.bal-summary {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink-soft);
  text-align: right;
  letter-spacing: 0;
}

.balance.proposal .bal-summary {
  color: var(--gold-deeper);
  font-weight: 500;
}

/* ----------------------------------------------------------------- */
/* Month section
/* ----------------------------------------------------------------- */

.month-block {
  margin-bottom: 44px;
  animation: month-rise .4s var(--ease) both;
}
.month-block:nth-child(n+3) { animation-delay: .06s; }

@keyframes month-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.month-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 18px;
  padding: 0 2px;
  position: relative;
  min-width: 0;
}

.month-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 56px;
  line-height: 0.95;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.015em;
  text-transform: lowercase;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.month-title em {
  font-style: italic;
  font-weight: 500;
}

.month-title .month-year {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-fade);
  font-size: 0.42em;
  letter-spacing: 0.05em;
  vertical-align: 0.6em;
  margin-left: -0.2em;
}

.month-nav-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 40px;
  line-height: 1;
  color: var(--ink-soft);
  padding: 0 4px;
  align-self: center;
  flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.month-nav-btn:hover { color: var(--ink); transform: scale(1.12); }
.month-nav-btn:active { transform: scale(.97); }

.today-link {
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 0 2px;
  margin-left: 6px;
  align-self: center;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  opacity: 0.6;
  transition: color .15s, opacity .15s;
}
.today-link:hover { color: var(--ink); opacity: 1; }

/* ----------------------------------------------------------------- */
/* Calendar grid
/* ----------------------------------------------------------------- */

.cal {
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.cal-head {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.cal-head-spacer { display: block; }

.cal-head-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.cal-head-days div {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-fade);
  text-align: center;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.cal-weeks {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.week-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: stretch;
}

.week-no {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink-fade);
  text-align: right;
  align-self: center;
  line-height: 1;
  letter-spacing: -0.01em;
}

.ribbon {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: 56px;
  background: var(--paper-raised);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
  position: relative;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-fade);
  background: transparent;
  transition: filter .18s var(--ease), box-shadow .18s var(--ease);
}

.cell.c-empty { color: transparent; opacity: 0; }

.cell.c-a {
  background: var(--color-a);
  color: var(--paper);
}
.cell.c-b {
  background: var(--color-b);
  color: var(--paper);
}
.cell.c-a, .cell.c-b {
  text-shadow: 0 1px 2px rgba(0,0,0,.22);
}

.cell.c-bytte-ab {
  background: linear-gradient(105deg, var(--color-a) 0%, var(--color-a) 50%, var(--color-b) 50%, var(--color-b) 100%);
  color: var(--paper);
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
}
.cell.c-bytte-ba {
  background: linear-gradient(105deg, var(--color-b) 0%, var(--color-b) 50%, var(--color-a) 50%, var(--color-a) 100%);
  color: var(--paper);
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
}

.cell.c-today::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 2px solid var(--paper);
  pointer-events: none;
}

.cell.c-past { opacity: 0.55; filter: saturate(0.88); }

.cell.c-draggable { cursor: grab; }
.cell.c-draggable:hover { filter: brightness(1.08); }
.cell.c-dragging,
.cell.c-draggable:active { cursor: grabbing; }
.cell.c-dragging {
  z-index: 10;
  filter: brightness(1.12);
  box-shadow: inset 0 0 0 2px var(--paper);
}

/* ----------------------------------------------------------------- */
/* Period mode — inline cell highlights while the user is selecting a
/* range to create or a period to delete.
/* ----------------------------------------------------------------- */

body.period-mode .cell[data-date]:not(.c-empty) {
  cursor: pointer;
}

/* Filter brightness/saturate works on the whole cell INCLUDING the c-bytte
   pseudo-element triangles, so handover cells in the range darken cleanly. */
.cell.c-period-range:not(.c-period-from):not(.c-period-to) {
  filter: brightness(0.55) saturate(1.1);
}

.cell.c-period-from,
.cell.c-period-to {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
  z-index: 5;
  position: relative;
}

.cell.c-period-selected {
  filter: brightness(0.5) saturate(1.1);
  outline: 2px dashed var(--ink);
  outline-offset: -3px;
}

/* Period-mode buttons injected into the action bar */
#confirmbar .cb-period-btn {
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, transform .12s;
  white-space: nowrap;
}
#confirmbar .cb-period-btn:hover { background: var(--paper-deep); }
#confirmbar .cb-period-btn.primary {
  background: var(--ink);
  color: var(--paper-raised);
  border-color: var(--ink);
}
#confirmbar .cb-period-btn.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }

/* ----------------------------------------------------------------- */
/* Ghost markers — every cell in the proposed-change range is marked
/* tentative until the proposal is approved. Hatched diagonal overlay
/* reads as a continuous band across adjacent cells.
/* ----------------------------------------------------------------- */

.cell.c-ghost {
  position: relative;
}

.cell.c-ghost::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.9;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0,
    transparent 5px,
    rgba(255,255,255,.34) 5px,
    rgba(255,255,255,.34) 7px
  );
}

.banner-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

/* ----------------------------------------------------------------- */
/* Confirm bar (drag staging)
/* ----------------------------------------------------------------- */

#confirmbar {
  position: fixed;
  left: 0; right: 0; top: 0;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--rule);
  padding: calc(12px + env(safe-area-inset-top)) 0 12px;
  box-shadow: 0 6px 28px rgba(24,34,47,.10);
  z-index: 100;
  animation: bar-drop .25s var(--ease);
}
#confirmbar .cb-inner {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  gap: 12px;
  align-items: center;
}

@keyframes bar-drop {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

#confirmbar .cb-text {
  flex: 1;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
  transition: color .2s var(--ease);
}

#confirmbar:not(.active) .cb-text {
  color: var(--ink-fade);
}

#confirmbar button {
  padding: 11px 18px;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
}

#confirmbar #cb-cancel {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
#confirmbar #cb-cancel:hover { background: var(--paper-deep); }

#confirmbar #cb-send {
  background: var(--ink);
  color: var(--paper-raised);
  box-shadow: var(--shadow-soft);
}
#confirmbar #cb-send:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
#confirmbar #cb-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

/* ----------------------------------------------------------------- */
/* Banner — pending proposal
/* ----------------------------------------------------------------- */

.banner {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-soft);
  animation: banner-fade .35s var(--ease);
}

@keyframes banner-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner-mine { border-left-color: var(--gold); }
.banner-incoming { border-left-color: var(--color-b); }

.banner-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  font-style: italic;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.banner-changes {
  list-style: none;
  padding: 0;
  margin: 14px 0 4px;
  font-size: 14px;
  color: var(--ink-soft);
}

.banner-changes li {
  padding: 8px 14px;
  background: var(--paper-deep);
  border-radius: 3px;
  margin: 5px 0;
  font-family: var(--font-body);
  font-feature-settings: "tnum";
}

.banner-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.banner-actions button {
  flex: 1;
  padding: 12px;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
}

.banner .btn-approve {
  background: var(--ink);
  color: var(--paper-raised);
  box-shadow: var(--shadow-soft);
}
.banner .btn-approve:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }

.banner .btn-reject {
  background: transparent;
  color: var(--color-b);
  border: 1px solid var(--color-b);
}
.banner .btn-reject:hover { background: var(--color-b-soft); }

.banner .btn-cancel {
  margin-top: 14px;
  padding: 10px 14px;
  background: transparent;
  color: var(--color-b);
  border: 1px solid var(--color-b);
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  transition: background .15s;
}
.banner .btn-cancel:hover { background: var(--color-b-soft); }

/* ----------------------------------------------------------------- */
/* Settings overlay
/* ----------------------------------------------------------------- */

#settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,34,47,.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlay-fade .22s var(--ease);
}

@keyframes overlay-fade { from { opacity: 0 } to { opacity: 1 } }

#settings-overlay .panel {
  background: var(--paper);
  border-radius: 6px;
  padding: 28px 28px 26px;
  max-width: 440px;
  width: 100%;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lift);
  animation: panel-rise .28s var(--ease);
}

@keyframes panel-rise {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#settings-overlay header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 22px;
}

#settings-overlay h2 {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-transform: lowercase;
}

#settings-overlay #close-settings {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0 4px;
  line-height: 1;
  transition: color .15s;
}
#settings-overlay #close-settings:hover { color: var(--ink); }

#settings-overlay label {
  display: block;
  margin: 16px 0 6px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

#settings-overlay input[type=text] {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
}

#settings-overlay button {
  margin-top: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper-raised);
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
  box-shadow: var(--shadow-soft);
}

#settings-overlay button:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }

#settings-overlay button.danger {
  background: transparent;
  color: var(--color-b);
  border: 1px solid var(--color-b);
  box-shadow: none;
}
#settings-overlay button.danger:hover { background: var(--color-b-soft); box-shadow: none; }

#settings-overlay hr {
  border: none;
  border-top: 1px solid var(--rule-soft);
  margin: 22px 0;
}

#settings-overlay .settings-emoji {
  display: inline-block;
  margin-right: 6px;
  font-size: 14px;
  letter-spacing: 0;
  vertical-align: -1px;
}

/* ----------------------------------------------------------------- */
/* Period modal — opret / slet
/* ----------------------------------------------------------------- */

#period-overlay {
  position: fixed; inset: 0;
  background: rgba(24,34,47,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 260;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 24px 24px;
  animation: overlay-fade .22s var(--ease);
}

#period-overlay .panel {
  background: var(--paper);
  border-radius: 6px;
  padding: 24px 28px 22px;
  max-width: 460px;
  width: 100%;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lift);
  animation: panel-rise .28s var(--ease);
}

#period-overlay header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}

#period-overlay h2 {
  font-family: var(--font-display);
  font-style: italic; font-weight: 500;
  font-size: 30px; line-height: 1;
  color: var(--ink);
  text-transform: lowercase;
  margin: 0;
}

#period-overlay #close-period {
  background: none; border: none; font-size: 26px;
  cursor: pointer; color: var(--ink-soft);
  padding: 0 4px; line-height: 1;
}
#period-overlay #close-period:hover { color: var(--ink); }

#period-overlay .period-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 18px;
}
#period-overlay .period-tabs button.tab {
  background: transparent; border: 0;
  padding: 10px 14px;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
#period-overlay .period-tabs button.tab:hover { color: var(--ink); }
#period-overlay .period-tabs button.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

#period-overlay label {
  display: block;
  margin: 14px 0 6px;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft);
}

#period-overlay input[type=date] {
  width: 100%;
  padding: 11px 13px;
  font: inherit; font-size: 14px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
}

#period-overlay .period-owner-row {
  display: flex; gap: 10px;
}
#period-overlay .period-radio {
  flex: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 13px;
  font-size: 14px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  text-transform: none; letter-spacing: 0;
  margin: 0;
  font-weight: 400;
  color: var(--ink);
}
#period-overlay .period-radio input { margin: 0; }

#period-overlay .period-list {
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 320px; overflow-y: auto;
  margin-top: 6px;
}
#period-overlay .period-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  margin: 0;
  text-transform: none; letter-spacing: 0; font-weight: 400;
  font-size: 14px;
  color: var(--ink);
  transition: background .15s, border-color .15s;
}
#period-overlay .period-item:hover { background: var(--paper-deep); }
#period-overlay .period-item input { margin: 0; }

#period-overlay .period-msg {
  margin: 12px 0 0;
  font-family: var(--font-display); font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}

#period-overlay .period-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
}
#period-overlay .period-actions button {
  padding: 11px 18px;
  font: inherit; font-size: 13px; font-weight: 500;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
}
#period-overlay .period-actions button:hover { background: var(--paper-deep); }
#period-overlay .period-actions button.primary {
  background: var(--ink); color: var(--paper-raised); border-color: var(--ink);
}
#period-overlay .period-actions button.primary:hover {
  transform: translateY(-1px); box-shadow: var(--shadow-lift);
}

/* ----------------------------------------------------------------- */
/* Review overlay
/* ----------------------------------------------------------------- */

#review-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,34,47,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlay-fade .22s var(--ease);
}

#review-overlay .panel {
  background: var(--paper);
  border-radius: 6px;
  padding: 28px;
  max-width: 460px;
  width: 100%;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lift);
  animation: panel-rise .28s var(--ease);
}

#review-overlay header {
  margin-bottom: 16px;
}

#review-overlay h2 {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-transform: lowercase;
}

#review-overlay .review-changes {
  list-style: none;
  padding: 0;
  margin: 12px 0 16px;
}

#review-overlay .review-changes li {
  padding: 11px 14px;
  background: var(--paper-deep);
  border-radius: 4px;
  margin: 6px 0;
  font-size: 14px;
  font-feature-settings: "tnum";
  color: var(--ink);
}

#review-overlay .review-summary {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  color: var(--gold-deeper);
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  padding: 12px 16px;
  border-radius: 4px;
  margin: 12px 0;
}

#review-overlay .review-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 12px 0 20px;
  line-height: 1.5;
}

#review-overlay .review-actions {
  display: flex;
  gap: 10px;
}

#review-overlay .review-actions button {
  flex: 1;
  padding: 13px;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
}

#review-overlay #review-back {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
#review-overlay #review-back:hover { background: var(--paper-deep); }

#review-overlay #review-send.primary {
  background: var(--ink);
  color: var(--paper-raised);
  box-shadow: var(--shadow-soft);
}

#review-overlay #review-send.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
#review-overlay #review-send.primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ----------------------------------------------------------------- */
/* Reduce motion
/* ----------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
