:root {
  --bg: #e6efe8;
  --ink: #17211b;
  --muted: #5d6b62;
  --card: #f7fbf8;
  --line: #d3e0d6;
  --accent: #0c6b45;
  --accent-ink: #ffffff;
  --danger: #8d2b2b;
  --danger-bg: #fdecec;
  --calc: #e7f6ee;
  --head: #f3f7f4;
  --summary: #fff6df;
  --shadow: 0 18px 50px rgba(23, 33, 27, 0.08);
  font-family: "Noto Sans Khmer", "Noto Sans", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(12, 107, 69, 0.16), transparent 32%),
    var(--bg);
}

button, input, textarea, select { font: inherit; color: inherit; }

button {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.eyebrow {
  margin: 0 0 0.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.78rem;
}

.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 210, 255, 0.16), transparent 32%),
    radial-gradient(circle at 80% 80%, rgba(0, 255, 170, 0.08), transparent 28%),
    linear-gradient(180deg, #031018 0%, #062033 42%, #04140f 100%);
  color: #e8fff8;
}

.login-aurora,
.login-grid,
.login-floor,
.login-scan {
  position: absolute;
  pointer-events: none;
}

.login-aurora {
  inset: -10%;
  background:
    linear-gradient(115deg, transparent 20%, rgba(0, 229, 255, 0.08) 40%, transparent 55%),
    repeating-linear-gradient(90deg, rgba(0, 229, 255, 0.08) 0 1px, transparent 1px 88px);
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.login-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.09) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 78%);
}

.login-floor {
  left: -10%;
  right: -10%;
  bottom: -8%;
  height: 46%;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.28) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: center top;
  mask-image: linear-gradient(transparent, black 30%, transparent 95%);
}

.login-scan {
  left: 0;
  right: 0;
  height: 18%;
  background: linear-gradient(180deg, transparent, rgba(0, 229, 255, 0.16), transparent);
  animation: scan 7s linear infinite;
}

@keyframes scan {
  from { top: -20%; }
  to { top: 110%; }
}

.login-card, .filters, .topbar {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 2rem 2rem 1.6rem;
  border-radius: 22px;
  color: #e9fbff;
  background: rgba(4, 18, 28, 0.82);
  border: 1px solid rgba(0, 229, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.12), 0 0 40px rgba(0, 229, 255, 0.12), 0 30px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}

.login-card::before,
.login-card::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #5dffe8;
  pointer-events: none;
}

.login-card::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.login-card::after { right: 10px; bottom: 10px; border-left: 0; border-top: 0; }



.mascot {
  position: relative;
  height: 168px;
  margin: 0.2rem auto 0.3rem;
}

.mascot-say {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 4;
  max-width: 220px;
  margin: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 12px;
  background: rgba(244, 254, 255, 0.95);
  color: #12343a;
  font-size: 0.82rem;
  text-align: center;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.mascot-say.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.mascot-figure {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 140px;
  height: 130px;
  margin-left: -70px;
  animation: mascotFloat 3.2s ease-in-out infinite;
}

.mascot-antenna {
  position: absolute;
  left: 50%;
  top: 0;
  width: 4px;
  height: 16px;
  margin-left: -2px;
  border-radius: 3px;
  background: #9ad8e4;
  z-index: 3;
}

.mascot-antenna::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -9px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #d4af37;
  box-shadow: 0 0 10px #d4af37;
}

.mascot-head {
  position: absolute;
  left: 16px;
  top: 18px;
  width: 108px;
  height: 96px;
  border-radius: 22px;
  background: linear-gradient(180deg, #f7fbfc, #c9d5d8);
  border: 3px solid #8aa0a6;
  transform-origin: center 80%;
  transition: transform 0.5s cubic-bezier(.22, .85, .3, 1);
  z-index: 2;
}

.mascot-bolt {
  position: absolute;
  top: 36px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8aa0a6;
  border: 2px solid #e7eef0;
}

.mascot-bolt.left { left: -8px; }
.mascot-bolt.right { right: -8px; }

.mascot-eye {
  position: absolute;
  top: 20px;
  width: 30px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff, #e7fbff 42%, #c5eef6);
  border: 2px solid #2f6f78;
  box-shadow: inset 0 -4px 0 rgba(16, 40, 46, 0.12), 0 0 8px rgba(122, 246, 255, 0.35);
  display: grid;
  place-items: center;
  overflow: hidden;
  transform-origin: center 65%;
  transition: transform 0.45s cubic-bezier(.22, .85, .3, 1), height 0.45s ease, top 0.45s ease, width 0.45s ease;
  animation: mascotBlink 4.8s infinite;
}

.mascot-eye.left { left: 16px; }
.mascot-eye.right { right: 16px; animation-delay: 0.06s; }

.mascot-eye i {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #bff8ff, #1aa0b0 58%, #083840);
  transition: transform 0.45s cubic-bezier(.22, .85, .3, 1), opacity 0.25s ease;
}

.mascot-eye b {
  position: absolute;
  left: 5px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #07181c;
}

.mascot-eye b::after {
  content: "";
  position: absolute;
  left: -3px;
  top: -3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
}

.mascot-mouth {
  position: absolute;
  left: 34px;
  top: 64px;
  width: 36px;
  height: 14px;
  border: 3px solid #5f7378;
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: transparent;
  transition: transform 0.45s ease, width 0.45s ease, height 0.45s ease, left 0.45s ease, top 0.45s ease, border-radius 0.45s ease, border-color 0.45s ease;
}

.mascot.account .mascot-head { transform: translateY(14px) rotate(16deg) scale(1.08); }
.mascot.account .mascot-eye { animation: none; transform: scale(1.35); }
.mascot.account .mascot-eye i { transform: translateY(9px) scale(1.15); }
.mascot.account .mascot-mouth { width: 16px; height: 16px; left: 44px; top: 62px; border-radius: 50%; border-top: 3px solid #5f7378; }

.mascot.password .mascot-head { transform: rotate(-34deg) translateX(-14px); }
.mascot.password .mascot-eye { animation: none; transform: scaleY(0.12); }
.mascot.password .mascot-eye i { opacity: 0; }
.mascot.password .mascot-mouth { width: 26px; height: 6px; left: 40px; top: 68px; border-radius: 6px; border-color: transparent; background: #8aa0a6; }

.mascot.peek .mascot-head { transform: rotate(-22deg) translateX(-8px); }
.mascot.peek .mascot-eye.right { animation: none; transform: scaleY(0.12); }
.mascot.peek .mascot-eye.right i { opacity: 0; }
.mascot.peek .mascot-eye.left { animation: none; transform: scale(1.45); }
.mascot.peek .mascot-eye.left i { transform: translate(4px, -3px); }
.mascot.peek .mascot-mouth { width: 20px; height: 12px; left: 42px; }

.mascot.hover .mascot-eye { animation: none; }

.mascot.mood-0 .mascot-head { transform: rotate(-8deg) scale(1.06); }
.mascot.mood-0 .mascot-eye.left { transform: scaleY(0.12); }
.mascot.mood-0 .mascot-eye.left i { opacity: 0; }
.mascot.mood-0 .mascot-mouth { width: 48px; height: 18px; left: 28px; top: 62px; border-color: #3f8f86; }

.mascot.mood-1 .mascot-head { transform: rotate(6deg) scale(1.08); }
.mascot.mood-1 .mascot-eye { transform: scale(1.2); }
.mascot.mood-1 .mascot-eye i { opacity: 0; }
.mascot.mood-1 .mascot-eye::after { content: "★"; color: #19b4c4; font-size: 22px; line-height: 1; }
.mascot.mood-1 .mascot-mouth { width: 18px; height: 18px; left: 44px; top: 62px; border-radius: 50%; border-top: 3px solid #3f8f86; border-color: #3f8f86; }

.mascot.mood-2 .mascot-head { transform: rotate(-4deg) scale(1.05); }
.mascot.mood-2 .mascot-eye { transform: scaleY(0.38); }
.mascot.mood-2 .mascot-mouth { width: 54px; height: 24px; left: 26px; top: 58px; border-color: #3f8f86; }

.mascot.mood-3 .mascot-head { transform: translateY(-6px) scale(1.08); }
.mascot.mood-3 .mascot-eye { transform: scale(1.32); }
.mascot.mood-3 .mascot-eye i { transform: scale(0.7); }
.mascot.mood-3 .mascot-mouth { width: 22px; height: 24px; left: 42px; top: 58px; border-radius: 50%; border-top: 3px solid #5f7378; }

.mascot.mood-4 .mascot-head { transform: rotate(10deg); }
.mascot.mood-4 .mascot-eye i { transform: translateX(-6px); }
.mascot.mood-4 .mascot-mouth { width: 40px; height: 12px; left: 32px; border-color: #3f8f86; }

.mascot.mood-5 .mascot-head { transform: rotate(-12deg) scale(1.04); }
.mascot.mood-5 .mascot-eye { transform: scaleY(0.55) rotate(-8deg); }
.mascot.mood-5 .mascot-eye.right { transform: scaleY(0.55) rotate(8deg); }
.mascot.mood-5 .mascot-mouth { width: 46px; height: 20px; left: 30px; top: 60px; border-color: #e07a8a; background: rgba(255, 170, 184, 0.55); }

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes mascotBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.08); }
}

.secret-field { position: relative; }

.secret-field input { padding-right: 2.8rem; }

.secret-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #7af6ff;
  box-shadow: none;
}

.secret-toggle svg { display: block; margin: 0 auto; }

.remember {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
  color: #d7fbff;
}

.remember input { width: auto; }

.login-card .eyebrow { color: #7af6ff; }

.login-card h1 {
  margin: 0 0 0.6rem;
  font-size: 2rem;
  color: #f3feff;
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.35);
}

.login-card .lede { color: rgba(244, 247, 242, 0.78); }

.login-card input {
  background: rgba(0, 20, 30, 0.72);
  border-color: rgba(0, 229, 255, 0.35);
  color: #f4feff;
}

#login-button {
  background: linear-gradient(90deg, #123e46, #0e8f86 45%, #d4af37);
  color: #f7fff8;
  font-weight: 700;
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.28);
}

.lang-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: inherit;
  font-size: 0.85rem;
}

.login-card .lang-menu { color: #d7fbff; }

.lang-current {
  min-width: 8.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, 0.55);
  background: rgba(3, 16, 24, 0.92);
  color: #f4feff;
  text-align: left;
  font-family: "Noto Sans Khmer", "Noto Sans", "Segoe UI", sans-serif;
}

.lang-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 30;
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.7);
  background: #071820;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.lang-list button {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: transparent;
  color: #f4feff;
  text-align: left;
  font-family: "Noto Sans Khmer", "Noto Sans", "Segoe UI", sans-serif;
}

.lang-list button[aria-selected="true"],
.lang-list button:hover {
  background: rgba(0, 229, 255, 0.22);
  color: #ffffff;
}

.lede, .footnote, .filter-actions p, .result-bar, .topbar-user {
  color: var(--muted);
}

label { display: grid; gap: 0.35rem; margin-top: 0.9rem; font-size: 0.92rem; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
}

textarea { resize: vertical; min-height: 4.6rem; }

.banner {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger);
}

#login-button { width: 100%; margin-top: 1rem; }

.app-view { padding: 0.7rem 1rem 1rem; }

.query-head {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
  padding: 0.55rem 0.9rem 0.6rem;
}

.query-head .topbar,
.query-head .filters {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

.topbar, .filters, .result-bar {
  border-radius: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.topbar strong { font-size: 1.25rem; }

.topbar-user { display: flex; align-items: center; gap: 0.8rem; }

.lang-row { display: flex; justify-content: flex-end; }

.color-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.skin-picker {
  display: flex;
  align-items: center;
  gap: 0.32rem;
}

button.skin-swatch {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

button.skin-swatch.active {
  box-shadow: 0 0 0 2px var(--ink);
}

.color-switch input[type="color"] {
  width: 2.2rem;
  height: 2rem;
  padding: 0.15rem;
  border-radius: 8px;
  background: #fff;
}

body.themed {
  background: var(--bg);
  color: var(--ink);
}

body.themed .query-head,
body.themed .filters,
body.themed .topbar,
body.themed .table-wrap,
body.themed th {
  background: var(--card);
  color: var(--ink);
}

body.themed .query-head .filters,
body.themed .query-head .topbar {
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.themed .lede,
body.themed .footnote,
body.themed .filter-actions p,
body.themed .result-bar,
body.themed .topbar-user,
body.themed .column-bar,
body.themed .eyebrow,
body.themed label,
body.themed th,
body.themed td,
body.themed .summary-clock {
  color: var(--ink);
}

body.themed .table-wrap,
body.themed .query-head,
body.themed input,
body.themed textarea,
body.themed select,
body.themed .lang-current,
body.themed .lang-list,
body.themed td {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}

body.themed th {
  background: var(--head);
  color: var(--ink);
  border-color: var(--line);
}

body.themed th.calc,
body.themed td.calc {
  background: var(--calc);
}

body.themed tr.summary td {
  background: var(--summary);
  color: var(--ink);
}

body.themed th,
body.themed td {
  border-bottom-color: var(--line);
  border-right-color: var(--line);
}

body.themed .summary-clock {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

body.themed .lang-list button {
  background: transparent;
  color: var(--ink);
}

body.themed .lang-list button[aria-selected="true"],
body.themed .lang-list button:hover {
  background: var(--ink);
  color: var(--bg);
}

body.themed button.ghost {
  color: var(--ink);
  border-color: var(--ink);
}

body.themed #query-button {
  background: var(--accent);
  color: var(--accent-ink);
}

body.themed .month-picker,
body.themed .month-panel {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

body.themed .month-group-chip,
body.themed .month-section label {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
}

body.themed .month-group-chip.active,
body.themed .month-section label.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

body.themed .month-group-chip input,
body.themed .month-section label input {
  accent-color: var(--accent);
}

body.themed .month-group-chip.active input,
body.themed .month-section label.active input {
  accent-color: var(--accent-ink);
}

td.summary-label,
td.clock-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.clock-cell { text-align: center; }

.summary-clock {
  display: inline-block;
  max-width: 100%;
  padding: 0.12rem 0.55rem;
  border: 1px solid #d4af37;
  border-radius: 8px;
  color: #8a6412;
  background: linear-gradient(180deg, #fff8df, #f3e2a4);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.45), 0 0 12px rgba(212, 175, 55, 0.28);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.filters {
  margin-top: 0.4rem;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.8rem;
  align-items: end;
}

.filters label { margin-top: 0; }

.query-head textarea { min-height: 2.5rem; }

.query-head .filters > label { grid-column: 1; grid-row: 1; }

.query-head .filter-actions { display: contents; }

.query-head .filter-actions div {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.query-head .filter-actions p {
  grid-column: 1 / -1;
  grid-row: 2;
  max-width: none;
  font-size: 0.78rem;
  line-height: 1.3;
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.filter-actions p { margin: 0; max-width: 46rem; }

.filter-actions .inline { margin: 0; display: flex; align-items: center; gap: 0.4rem; }

.inline select { width: auto; }

.filter-actions div { display: flex; align-items: center; gap: 0.7rem; }

.result-bar {
  margin: 0.4rem 0 1.2rem;
  padding: 0.75rem 0.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.result-bar p { margin: 0; }

.pager { display: flex; align-items: center; gap: 0.6rem; }

.column-bar {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.column-bar > span { padding-top: 0.35rem; white-space: nowrap; }

.column-panel { display: flex; flex-wrap: wrap; gap: 0.35rem 0.85rem; }

.column-panel label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  color: var(--ink);
}

.column-panel input { width: auto; }

.month-picker {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.month-picker-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.month-picker-title {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink);
}

.month-group-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.month-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
}

.month-group-chip input {
  width: auto;
  margin: 0;
}

.month-toggle {
  margin-left: auto;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.month-panel {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.month-panel input[type="search"] {
  margin-bottom: 0.45rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
}

.month-list {
  max-height: min(42vh, 320px);
  overflow: auto;
  display: grid;
  gap: 0.55rem;
}

.month-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}

.month-section label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0 0 0.28rem;
  padding: 0.28rem 0.45rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.35;
}

.month-section label.active {
  border-color: var(--line);
  background: rgba(12, 107, 69, 0.08);
}

.month-section label input {
  width: auto;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.table-wrap {
  width: 100%;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

th, td {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid #d7e8f6;
  border-right: 1px solid #9ec9ef;
  text-align: center;
  vertical-align: middle;
}

td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

tr:not(.summary) td:not(.col-text) {
  white-space: nowrap;
}

th:last-child, td:last-child { border-right: 0; }

th.col-text, td.col-text { text-align: center; }

th {
  position: sticky;
  top: 0;
  overflow: visible;
  background: #f3f7f4;
  z-index: 2;
}

th .th-label {
  display: block;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

th .th-label.th-wrap {
  white-space: pre-line;
  word-break: keep-all;
}

th .col-resize {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

body.resizing { cursor: col-resize; user-select: none; }

th.calc { background: var(--calc); }

td.calc { background: var(--calc); }

tr.summary td {
  background: var(--summary);
  font-weight: 650;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

td.neg { color: var(--danger); }

.footnote { margin: 0.7rem 0.2rem 1rem; font-size: 0.85rem; }

.missing-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(23, 33, 27, 0.45);
}

.missing-card {
  width: min(420px, 100%);
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 1.1rem 1.2rem 1rem;
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.missing-card h2 { margin: 0 0 0.7rem; font-size: 1.05rem; }

.missing-card ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  line-height: 1.6;
}

.missing-card li { cursor: pointer; }

.missing-copied {
  margin: 0 0 0.7rem;
  color: var(--accent);
  font-weight: 650;
}

.missing-actions { display: flex; gap: 0.6rem; }

.missing-actions button { flex: 1; }

.password-card label { display: grid; gap: 0.35rem; margin: 0 0 0.75rem; }
.password-card input { width: 100%; }
.password-card .secret-toggle { color: var(--ink); }
#password-force-hint { margin: 0 0 0.8rem; }
.password-success { margin: 0.4rem 0 1rem; font-weight: 650; }
#password-ok { width: 100%; }

@media (max-width: 980px) {
  .filters { grid-template-columns: 1fr; }
  .filter-actions, .topbar, .result-bar, .column-bar { display: grid; }
  .query-head .filters > label,
  .query-head .filter-actions p,
  .query-head .filter-actions div {
    grid-column: 1;
    grid-row: auto;
  }
}
