:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --card-2: #f9fafb;
  --text: #17191c;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --brand: #03c75a;
  --brand-ink: #029a46;
  --brand-soft: #e7f8ee;
  --link: #1f63e0;
  --ok: #0f9d58;
  --ok-soft: #e6f6ed;
  --warn: #b7791f;
  --warn-soft: #fff5e1;
  --bad: #d93a3f;
  --bad-soft: #fdecec;
  --info: #3268d8;
  --info-soft: #eaf1ff;
  --mute-soft: #eef0f3;
  --up: #d93a3f;
  --down: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113;
    --card: #181b1f;
    --card-2: #1d2126;
    --text: #eceef1;
    --muted: #9aa1ab;
    --line: #2a2f36;
    --line-strong: #394049;
    --brand-soft: #0f2a1b;
    --link: #7aa8ff;
    --ok: #3ccf82;
    --ok-soft: #10281b;
    --warn: #f0b64d;
    --warn-soft: #2d2410;
    --bad: #ff6b6f;
    --bad-soft: #321718;
    --info: #86a9ff;
    --info-soft: #172240;
    --mute-soft: #22272d;
    --up: #ff6b6f;
    --down: #6ea0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.3;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.right {
  text-align: right;
}
.spacer {
  flex: 1;
}

.boot,
.loading {
  padding: 60px 16px;
  text-align: center;
  color: var(--muted);
}

/* ── buttons & inputs ─────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover {
  background: var(--card-2);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: var(--brand-ink);
}
.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--mute-soft);
  color: var(--text);
}
.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.btn.block {
  width: 100%;
  height: 44px;
  font-size: 15px;
}
.danger-text {
  color: var(--bad) !important;
}

input:not([type='checkbox']),
select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
  outline: none;
  min-width: 0;
}
input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}
input[type='checkbox']:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.chip:hover {
  border-color: var(--brand);
  color: var(--brand-ink);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill.info {
  background: var(--info-soft);
  color: var(--info);
}
.pill.mute {
  background: var(--mute-soft);
  color: var(--muted);
}

.notice {
  padding: 12px 16px;
  border-radius: 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  background: var(--card);
}
.notice.warn {
  background: var(--warn-soft);
  border-color: transparent;
}
.notice.bad {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}

/* ── shell ────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}
.brand:hover {
  text-decoration: none;
}
.brand strong {
  display: block;
  font-size: 15px;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}
.tabs {
  display: flex;
  gap: 4px;
}
.tab {
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
}
.tab:hover {
  background: var(--mute-soft);
  color: var(--text);
  text-decoration: none;
}
.tab.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.sync-pill {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--mute-soft);
  color: var(--muted);
}
.sync-pill:empty {
  display: none;
}
.sync-pill::before {
  content: '●';
  margin-right: 5px;
}
.sync-pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.sync-pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.sync-pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}
.user-name {
  font-weight: 600;
}

.acct-slot:empty {
  display: none;
}
.acct {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.acct-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.acct-select {
  height: 34px !important;
  max-width: 240px;
  font-weight: 700;
  border-color: var(--brand) !important;
  background: var(--brand-soft) !important;
  color: var(--brand-ink);
  cursor: pointer;
}
.acct-empty {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
}

.view {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 20px 120px;
}

.page-head {
  margin: 8px 0 18px;
}
.page-head h2 {
  font-size: 22px;
}
.page-head p {
  margin: 6px 0 0;
}

/* ── day bar & summary ────────────────────────── */

.daybar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
}
.daynav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.daynav-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.date-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  min-width: 220px;
  text-align: center;
}
.date-input {
  height: 32px !important;
  border-radius: 999px !important;
}
.strip {
  position: relative;
  display: flex;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.day-chip {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  position: relative;
}
.day-chip:hover {
  border-color: var(--brand);
}
.day-chip .dc-date {
  font-size: 12px;
  font-weight: 700;
}
.day-chip .dc-count {
  font-size: 12px;
  color: var(--muted);
}
.day-chip.has .dc-count {
  color: var(--text);
  font-weight: 800;
}
.day-chip.fri {
  border-style: dashed;
}
.day-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.day-chip.active .dc-count {
  color: #fff;
}
.dc-restore {
  position: absolute;
  top: -7px;
  right: -4px;
  font-size: 10px;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--info);
  color: #fff;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.stat strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.stat small {
  color: var(--muted);
}
.stat.accent {
  background: var(--brand-soft);
  border-color: transparent;
}
.stat.accent strong {
  color: var(--brand-ink);
}
.summary-foot {
  grid-column: 1 / -1;
  font-size: 12px;
  text-align: right;
  margin-top: -4px;
}

/* ── toolbar ──────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
  flex-wrap: wrap;
}
.seg {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn .seg-n {
  margin-left: 5px;
  font-size: 12px;
  opacity: 0.8;
}
.seg-btn.active {
  background: var(--text);
  color: var(--card);
}
.search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

/* ── cards & rows ─────────────────────────────── */

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.deleted,
.group.deleted {
  opacity: 0.7;
}
.card-head,
.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.card-head {
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
}
.card-head .title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
}
.card-head a.title:hover,
.group-head a.title:hover {
  color: var(--link);
}
.group-head .title {
  font-weight: 700;
  color: var(--text);
}
.badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.badge.alt {
  background: var(--info-soft);
  color: var(--info);
}
.lvl {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 6px;
}
.meta {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.group {
  border-top: 1px solid var(--line);
  margin-left: 22px;
  border-left: 3px solid var(--line);
}
.card > .rows + .group,
.card-head + .group {
  border-top: 0;
}
.group-head {
  padding: 10px 16px 6px;
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}

.row {
  display: grid;
  grid-template-columns: 20px minmax(170px, 1.25fr) minmax(250px, 2.2fr) 70px minmax(120px, 1fr) 104px;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
}
.rows > .row:first-child {
  border-top: 0;
}
.row:hover {
  background: var(--card-2);
}
.row .what {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.row .label {
  font-weight: 700;
  white-space: nowrap;
}
.row .kw {
  font-weight: 700;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--mute-soft);
}
.cat {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
}
.cat-budget {
  background: #fff1e6;
  color: #c2410c;
}
.cat-bid {
  background: #eef2ff;
  color: #4338ca;
}
.cat-onoff {
  background: #ecfdf3;
  color: #047857;
}
.cat-other {
  background: var(--mute-soft);
  color: var(--muted);
}
@media (prefers-color-scheme: dark) {
  .cat-budget {
    background: #3a2210;
    color: #ffb27a;
  }
  .cat-bid {
    background: #1e2150;
    color: #a5b4fc;
  }
  .cat-onoff {
    background: #0d2e22;
    color: #6ee7b7;
  }
}
.change {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.change .before {
  color: var(--muted);
}
.change .arrow {
  color: var(--muted);
}
.change .after {
  font-weight: 800;
}
.change .after.on {
  color: var(--ok);
}
.change .after.off {
  color: var(--bad);
}
.delta {
  font-size: 12px;
  font-weight: 800;
}
.delta.up {
  color: var(--up);
}
.delta.down {
  color: var(--down);
}
.tag.restore {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--info-soft);
  color: var(--info);
}
.when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.now {
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.now small {
  color: var(--muted);
}
.state {
  text-align: right;
}
.row.st-already .change,
.row.st-netzero .change,
.row.st-deleted .change {
  opacity: 0.6;
}

.kw-block {
  border-top: 1px dashed var(--line);
}
.kw-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  border: 0;
  background: transparent;
  padding: 8px 16px 8px 46px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.kw-toggle:hover {
  color: var(--text);
}
.kw-rows .row {
  background: color-mix(in srgb, var(--card-2) 60%, transparent);
}

.empty {
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
}
.empty.small {
  padding: 24px;
}
.empty-icon {
  font-size: 30px;
  margin-bottom: 8px;
}
.empty p {
  margin: 6px 0 0;
}

/* ── action bar ───────────────────────────────── */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  transform: translateY(110%);
  transition: transform 0.2s ease;
  padding: 0 16px 16px;
  pointer-events: none;
}
.actionbar.show {
  transform: translateY(0);
}
.actionbar-inner {
  pointer-events: auto;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 20px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.actionbar .sel {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.actionbar .sel strong {
  font-size: 16px;
}

/* ── modals & toasts ──────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 17, 19, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 0.15s ease;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 22px 22px 18px;
}
.modal.wide {
  width: min(760px, 100%);
}
.modal h3 {
  font-size: 18px;
  margin-bottom: 12px;
}
.modal h4 {
  margin: 16px 0 6px;
}
.modal-body p {
  margin: 6px 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.preview-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.preview-list li {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.preview-list li:first-child {
  border-top: 0;
}
.pv-path {
  font-size: 12px;
  color: var(--muted);
}
.pv-change b.to {
  color: var(--brand-ink);
}
.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--mute-soft);
  overflow: hidden;
  margin: 10px 0;
}
.progress .bar {
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.3s ease;
}
.result-head {
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 800;
}
.result-head.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.result-head.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.result-stats {
  display: flex;
  gap: 14px;
  margin: 12px 2px;
  font-weight: 700;
}
.t-ok {
  color: var(--ok);
}
.t-bad {
  color: var(--bad);
}
.t-mute {
  color: var(--muted);
}
.result-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 320px;
  overflow: auto;
}
.result-list li {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}
.result-list li:first-child {
  border-top: 0;
}
.r-icon {
  font-weight: 900;
  width: 16px;
}
.result-list li.r-ok .r-icon {
  color: var(--ok);
}
.result-list li.r-fail .r-icon {
  color: var(--bad);
}
.result-list li.r-skip .r-icon {
  color: var(--muted);
}
.r-path {
  font-weight: 600;
}
.r-detail {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.r-msg {
  color: var(--bad);
}
.result-list li.r-skip .r-msg,
.result-list li.r-ok .r-msg {
  color: var(--muted);
}
details summary {
  cursor: pointer;
  font-weight: 700;
  margin-top: 10px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--card);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.success {
  background: var(--ok);
  color: #fff;
}
.toast.error {
  background: var(--bad);
  color: #fff;
}
.toast.hide {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ── auth ─────────────────────────────────────── */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent), var(--bg);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 30px 28px 26px;
  text-align: center;
}
.auth-logo {
  margin-bottom: 10px;
}
.auth-card h1 {
  font-size: 22px;
}
.auth-card > p {
  margin: 6px 0 18px;
}
.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field > span {
  font-weight: 700;
  font-size: 13px;
}
.form-error {
  color: var(--bad);
  margin: 0;
  min-height: 1em;
  font-weight: 600;
}
.form-error:empty {
  display: none;
}

/* ── settings ─────────────────────────────────── */

.settings,
.history {
  max-width: 980px;
  margin: 0 auto;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.panel-head {
  margin-bottom: 12px;
}
.panel-head h3 {
  font-size: 16px;
}
.panel-head p {
  margin: 4px 0 0;
  font-size: 13px;
}
.conn {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.conn.ok {
  background: var(--ok-soft);
}
.conn.ok strong {
  color: var(--ok);
}
.conn.bad {
  background: var(--bad-soft);
}
.conn.bad strong,
.conn-msg {
  color: var(--bad);
}
.conn.off {
  background: var(--mute-soft);
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.grid-form .form-error,
.grid-form .form-actions {
  grid-column: 1 / -1;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 8px;
}
.inline-form .field {
  flex: 1 1 180px;
}
.toggle-field .toggle {
  height: 38px;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.help {
  margin-top: 14px;
  color: var(--muted);
}
.help ol {
  margin: 8px 0 0;
  padding-left: 20px;
}
.help li {
  margin: 4px 0;
}
.facts {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 14px;
  margin: 0 0 8px;
}
.facts dt {
  color: var(--muted);
  font-weight: 600;
}
.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.account-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
}
.account-card.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.account-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.account-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
}
.account-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sub-title {
  font-size: 14px;
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.target-account {
  margin: 0 0 10px;
}
.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: min(420px, 100%);
}
.page-account {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 13px;
  vertical-align: middle;
}

.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  text-align: left;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.table th {
  color: var(--muted);
  font-size: 12.5px;
  border-top: 0;
}
.table td.right {
  text-align: right;
  white-space: nowrap;
}

/* ── history ──────────────────────────────────── */

.run-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.run {
  display: grid;
  grid-template-columns: 56px 120px 110px 1fr auto 70px;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.run:hover {
  border-color: var(--brand);
}
.run-id {
  color: var(--muted);
  font-weight: 700;
}
.run-target {
  font-weight: 700;
}
.run-stats {
  display: flex;
  gap: 10px;
  font-weight: 700;
}
.run-more {
  color: var(--muted);
  text-align: right;
}

/* ── responsive ───────────────────────────────── */

@media (max-width: 980px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px 16px;
  }
  .brand small {
    display: none;
  }
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .row {
    grid-template-columns: 20px 1fr auto;
    grid-template-areas:
      'check what state'
      '. change change'
      '. when now';
    row-gap: 4px;
  }
  .row > .check {
    grid-area: check;
  }
  .row > .what {
    grid-area: what;
  }
  .row > .change {
    grid-area: change;
  }
  .row > .when {
    grid-area: when;
  }
  .row > .now {
    grid-area: now;
    text-align: right;
  }
  .row > .state {
    grid-area: state;
  }
  .group {
    margin-left: 10px;
  }
  .grid-form {
    grid-template-columns: 1fr;
  }
  .run {
    grid-template-columns: 1fr auto;
  }
  .run-id,
  .run-more {
    display: none;
  }
}

@media (max-width: 640px) {
  .view {
    padding: 14px 12px 140px;
  }
  .tabs {
    order: 3;
    width: 100%;
  }
  .tab {
    flex: 1;
    text-align: center;
  }
  .user-name {
    display: none;
  }
  .acct-label {
    display: none;
  }
  .acct-select {
    max-width: 150px;
  }
  .topbar-right {
    gap: 8px;
  }
  .account-card {
    flex-direction: column;
    align-items: stretch;
  }
  .account-actions {
    justify-content: flex-start;
  }
  .date-title {
    font-size: 17px;
    min-width: 0;
    flex: 1;
    white-space: nowrap;
  }
  .daynav .spacer {
    display: none;
  }
  .daynav-main {
    flex-basis: 100%;
  }
  .seg {
    max-width: 100%;
    overflow-x: auto;
  }
  .search {
    flex-basis: 100%;
    max-width: none;
  }
  .actionbar-inner {
    flex-wrap: wrap;
  }
  .actionbar .btn.ghost {
    display: none;
  }
  .actionbar .btn.primary {
    flex: 1;
  }
  .facts {
    grid-template-columns: 1fr;
  }
}

.center {
  text-align: center;
}
.otp-input {
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
  height: 48px !important;
  font-variant-numeric: tabular-nums;
}

.when .actor {
  display: block;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.steps {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--muted);
}
.steps li {
  margin: 3px 0;
}
.import-result {
  margin-top: 14px;
}
.import-lines {
  margin: 10px 0;
  padding-left: 20px;
}
.import-lines li {
  margin: 3px 0;
}
.import-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.import-days .chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}
