:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --panel: #fffdf8;
  --panel-soft: #f1ece3;
  --text: #2f261f;
  --muted: #746a60;
  --line: #ded4c7;
  --accent: #c96442;
  --accent-strong: #9d462d;
  --accent-soft: #f5e7dc;
  --sidebar: #eee7dc;
  --sidebar-text: #342b24;
  --danger: #a13d2d;
  --shadow: 0 10px 28px rgba(47, 38, 31, 0.08);
}

body.dark {
  color-scheme: dark;
  --bg: #11100f;
  --panel: #1b1917;
  --panel-soft: #24211e;
  --text: #f3eee7;
  --muted: #b5aaa0;
  --line: #39332e;
  --accent: #f0b090;
  --accent-strong: #ffd0b8;
  --accent-soft: #33251e;
  --sidebar: #171513;
  --sidebar-text: #f3eee7;
  --danger: #ffb0a0;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: 212px 1fr;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

aside {
  padding: 18px 12px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding: 0 6px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand b {
  color: var(--accent-strong);
  font-size: 12px;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 680;
}

button:hover { border-color: var(--accent); }

aside button {
  width: 100%;
  margin: 3px 0;
  padding: 8px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
}

aside button.active,
aside button:hover {
  background: var(--panel);
  border-color: var(--line);
  color: var(--accent-strong);
}

#theme {
  display: flex;
  justify-content: center;
  text-align: center;
  margin-top: 8px;
}

main {
  min-width: 0;
  padding: 18px;
  overflow: auto;
}

.tab { display: none; }
.tab.active { display: block; }

.topline {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.actions,
form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin: 20px 0 10px;
  font-size: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.stat {
  min-height: 72px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.stat span {
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.stat b {
  font-size: 19px;
  letter-spacing: 0;
}

.tablewrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  height: 31px;
  max-width: 1px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  user-select: none;
}

th span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  border-right: 2px solid transparent;
}

.col-resizer:hover,
th:hover .col-resizer {
  border-right-color: var(--accent);
}

tr:hover td {
  background: var(--accent-soft);
}

input,
textarea {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  padding: 7px 9px;
  outline: none;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.inline-name {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
}

td button {
  min-height: 27px;
  width: 100%;
  padding: 3px 7px;
  font-size: 12px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.config-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 680;
}

.config-section {
  grid-column: 1 / -1;
}

.config-section h2 {
  margin-top: 0;
}

.ops-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.ops-panel h2 {
  width: 100%;
  margin-bottom: 0;
}

.config-grid label.switch {
  display: flex;
}

.status-note {
  color: var(--muted);
  font-weight: 680;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.ocb-login-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ocb-login-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ocb-login-card b {
  color: var(--ink);
}

.ocb-login-card .otp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.config-grid button {
  grid-column: 1 / -1;
  max-width: 170px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fffdf8;
}

.bankcodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 8px;
}

.bankcodes label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-weight: 680;
}

.result {
  min-height: 110px;
  margin-top: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 680;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  max-width: 100%;
  align-items: center;
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 780;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-page {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(410px, 100%);
  display: grid;
  gap: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 { margin-bottom: 0; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-weight: 850;
  letter-spacing: 0;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }

  aside {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 12px;
  }

  .brand {
    grid-column: 1 / -1;
    margin-bottom: 4px;
    padding-bottom: 10px;
  }

  aside button { text-align: center; }
  main { padding: 12px; }
  .topline { align-items: stretch; flex-direction: column; }
}
