/* RO3 Control Panel - Ragnarok Online White-Label Theme */

:root {
  /* Page content box: bars stay full width but pad their content into the same box as .main-content. */
  --content-max: 1400px;
  --page-gutter: 24px;
  --bar-inline: max(var(--page-gutter), calc((100% - var(--content-max)) / 2 + var(--page-gutter)));
  --header-height: 64px;
  --sidebar-width: 248px;
  --sidebar-rail: 68px;
  --bg-sidebar: #111722;
  --bg-dark: #0a0e17;
  /* Item quality, shown as the icon border (the name beside it carries the meaning). */
  --q-common: #94a3b8;
  --q-fine: #10b981;
  --q-rare: #38bdf8;
  --q-legendary: #fbbf24;
  --q-mythic: #f43f5e;
  --bg-card: #121824;
  --bg-card-hover: #172030;
  --bg-modal: #101622;
  --border-color: #26344d;
  --border-focus: #e5c07b;
  --gold: #e5c07b;
  --gold-glow: rgba(229, 192, 123, 0.25);
  --gold-dark: #a88732;
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #808a98;
  --text-strong: #ffffff;
  --bg-inset: #0c1018;
  --border-input: #66738a;
  --danger: #e06c75;
  --danger-bg: rgba(224, 108, 117, 0.15);
  --success: #98c379;
  --success-bg: rgba(152, 195, 121, 0.15);
  --info: #61afef;
  --info-bg: rgba(97, 175, 239, 0.15);
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[hidden],
.login-screen-wrapper[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* One focus ring for every interactive element; no rule may remove it without a replacement. */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(30, 48, 80, 0.3) 0%, transparent 60%),
    radial-gradient(circle at 10% 40%, rgba(229, 192, 123, 0.03) 0%, transparent 40%);
}

/* Header & Top Bar */
.admin-header {
  background: rgba(18, 24, 36, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 var(--bar-inline);
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  row-gap: 8px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #e5c07b, #996e1b);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0e17;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 0 15px var(--gold-glow);
  letter-spacing: -1px;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  display: block;
}

.brand-logo:has(.brand-logo-img),
.login-logo:has(.brand-logo-img) {
  background: transparent;
  box-shadow: none;
}

.brand-info h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 12px;
  text-transform: uppercase;
  background: rgba(229, 192, 123, 0.15);
  color: var(--gold);
  border: 1px solid var(--gold-dark);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-status-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 16px;
}

.server-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 23, 0.6);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger);
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(152, 195, 121, 0.6);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gm-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 192, 123, 0.12);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* Language switch (EN | ES) */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-switch-login {
  position: absolute;
  top: 12px;
  right: 12px;
}

.lang-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn + .lang-btn {
  border-left: 1px solid var(--border-color);
}

.lang-btn:hover {
  color: var(--text-main);
}

.lang-btn.active {
  background: var(--gold-glow);
  color: var(--gold);
}

.lang-btn:focus-visible,
.tab-btn:focus-visible {
  /* Inside scrolling or clipping parents an outer ring would be cut off. */
  outline-offset: -2px;
}

.modal-intro strong {
  color: var(--text-main);
}

/* Sidebar menu: Dashboard on its own, then collapsible groups of sections. It never scrolls sideways. */
.app-shell {
  display: flex;
  flex: 1;
  align-items: flex-start;
  min-width: 0;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 24px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 50;
  transition: width 0.2s ease;
}

.sidebar-head {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 4px;
}

.sidebar-collapse,
.sidebar-open,
.sidebar-close {
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
}

.sidebar-collapse {
  display: inline-flex;
}

.sidebar-open,
.sidebar-close {
  display: none;
}

.sidebar-collapse:hover,
.sidebar-open:hover,
.sidebar-close:hover {
  color: var(--text-main);
  border-color: var(--border-color);
}

.sidebar-collapse svg {
  transition: transform 0.2s ease;
}

.sidebar-collapse[aria-pressed="true"] svg {
  transform: rotate(180deg);
}

.sidebar-group + .sidebar-group {
  margin-top: 6px;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.sidebar-group-toggle:hover {
  color: var(--text-main);
}

.sidebar-group-toggle > span {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-chevron {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-group.is-open .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar-group:not(.is-open) .sidebar-items {
  display: none;
}

.sidebar-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  flex-shrink: 0;
  white-space: nowrap;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-items .tab-btn {
  padding-left: 22px;
}

.tab-btn > span:not(.tab-counter) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn .tab-counter {
  margin-left: auto;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--gold);
  background: var(--gold-glow);
  /* A ring and a heavier weight mark the current section: colour alone never carries it. */
  box-shadow: inset 0 0 0 1px var(--gold);
  font-weight: 700;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 150;
}

/* Icon rail: only where the sidebar sits beside the content. On a phone it is a drawer and always shows labels. */
@media (min-width: 861px) {
  .app-shell.is-collapsed .sidebar {
    width: var(--sidebar-rail);
    padding-inline: 8px;
  }

  .app-shell.is-collapsed .sidebar .tab-btn > span,
  .app-shell.is-collapsed .sidebar .sidebar-group-toggle,
  .app-shell.is-collapsed .sidebar .sidebar-chevron {
    display: none;
  }

  .app-shell.is-collapsed .sidebar .sidebar-group:not(.is-open) .sidebar-items {
    display: flex;
  }

  .app-shell.is-collapsed .sidebar .sidebar-items .tab-btn,
  .app-shell.is-collapsed .sidebar .tab-btn {
    justify-content: center;
    padding-inline: 0;
  }

  .app-shell.is-collapsed .sidebar-group + .sidebar-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
  }

  .app-shell.is-collapsed .sidebar-head {
    justify-content: center;
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(300px, 86vw);
    z-index: 200;
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.2s ease, visibility 0s;
  }

  .sidebar-open,
  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar-head {
    justify-content: space-between;
  }

  .sidebar-open {
    margin-right: -4px;
  }
}

.tab-counter {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 12px;
}

/* Main Container */
.main-content {
  flex: 1;
  min-width: 0;
  padding: var(--page-gutter);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* Metric Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.accounts { background: rgba(97, 175, 239, 0.15); color: var(--info); }
.stat-icon.chars { background: rgba(152, 195, 121, 0.15); color: var(--success); }
.stat-icon.online { background: rgba(229, 192, 123, 0.15); color: var(--gold); }
.stat-icon.banned { background: rgba(224, 108, 117, 0.15); color: var(--danger); }

.stat-val {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
}

/* Control Toolbar */
.toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  flex: 1;
  min-width: 240px;
  max-width: 400px;
}

.search-box:focus-within {
  border-color: var(--border-focus);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  width: 100%;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.select-filter {
  background: var(--bg-dark);
  border: 1px solid var(--border-input);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.select-filter:focus {
  border-color: var(--border-focus);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #e5c07b, #a88732);
  color: #0a0e17;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f0cf8f, #b89640);
  box-shadow: 0 4px 12px var(--gold-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--bg-dark);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Accounts Pager */
.pager .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

.pager[hidden] {
  display: none;
}

.pager-info {
  color: var(--text-muted);
  font-size: 12px;
}

/* Data Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #0f1521;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(38, 52, 77, 0.4);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.audit-target {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.badge-active { background: var(--success-bg); color: var(--success); border: 1px solid rgba(152, 195, 121, 0.3); }
.badge-banned { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(224, 108, 117, 0.3); }
.badge-admin { background: rgba(229, 192, 123, 0.15); color: var(--gold); border: 1px solid var(--gold-dark); }

/* Character Chips */
.char-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.char-chip {
  background: #0d121c;
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.char-class {
  font-weight: 600;
  color: var(--gold);
}

.char-lv {
  color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 12, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 1px 1px rgba(229, 192, 123, 0.1);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d131f;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #0d131f;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-textarea {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-input);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--border-focus);
}

/* GM Tools in Details Modal */
.gm-tools {
  margin-top: 16px;
  padding: 12px;
  background: #0b0f17;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.gm-tools-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gm-tools-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.gm-warp-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.gm-warp-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.gm-tools-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.gm-tools-section > .gm-tools-title,
.gm-tools-section > .gm-tools-note {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.gm-tools-result {
  font-size: 12px;
  margin-top: 8px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.gm-tools-result.success { color: var(--success); }
.gm-tools-result.error { color: var(--danger); }

/* Quest tools (inside GM Tools) */
.gm-quest-picker {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.gm-quest-select {
  min-height: 120px;
}

.gm-quest-actions {
  justify-content: flex-start;
}

.gm-quest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.gm-quest-head > .gm-tools-title {
  margin-bottom: 0;
}

.gm-quest-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gm-quest-error {
  color: var(--danger);
}

/* Character Card in Details Modal */
.char-card-detail {
  background: #0b0f17;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.char-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(38, 52, 77, 0.4);
}

.char-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.char-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px;
  align-items: start;
  margin-top: 8px;
}

.char-card-main {
  min-width: 0;
}

.char-subtitle {
  margin: 4px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.char-currencies {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.char-currencies--inline {
  display: inline-flex;
  max-height: none;
  overflow: visible;
  vertical-align: middle;
}

.char-currency {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.char-currency .item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.char-currency__name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.char-currency__amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-strong);
}

.char-stats {
  margin: 0;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.char-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
}

.char-stat dt {
  color: var(--text-muted);
  font-weight: 600;
}

.char-stat dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Player names link to the account screen: plain text until hovered, the shared focus ring does the rest. */
.player-link {
  color: inherit;
  text-decoration: none;
}

.player-link:hover {
  text-decoration: underline;
  color: var(--gold);
}

/* Character Mail (read-only) */
.char-mail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.char-mail-panel {
  margin-top: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.char-mail-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.char-mail-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(38, 52, 77, 0.4);
}

.char-mail-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.char-mail-meta,
.char-mail-empty {
  color: var(--text-muted);
  margin-top: 4px;
}

.char-mail-body {
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* RO3Emu diagnostics (dashboard) */
.diag-card {
  display: block;
  margin-bottom: 20px;
}

.diag-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.diag-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.diag-note {
  font-size: 12px;
  color: var(--text-muted);
}

.diag-unavailable {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* display: grid would otherwise override the hidden attribute */
.diag-grid[hidden] {
  display: none;
}

.diag-cell {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.diag-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.diag-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: #141c2b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* The type shows in the whole border and a tint, never in a coloured side stripe. */
.toast.success {
  border-color: var(--success);
  background-image: linear-gradient(var(--success-bg), var(--success-bg));
}

.toast.error {
  border-color: var(--danger);
  background-image: linear-gradient(var(--danger-bg), var(--danger-bg));
}

.toast.info {
  border-color: var(--info);
  background-image: linear-gradient(var(--info-bg), var(--info-bg));
}

/* Login Box */
.login-screen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #060910;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(30, 48, 80, 0.5) 0%, transparent 70%),
    radial-gradient(circle at 80% 80%, rgba(229, 192, 123, 0.05) 0%, transparent 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.login-card {
  background: rgba(18, 24, 36, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(229, 192, 123, 0.08);
  text-align: center;
  position: relative;
}

.login-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #e5c07b, #996e1b);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0e17;
  font-weight: 900;
  font-size: 26px;
  box-shadow: 0 0 25px var(--gold-glow);
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-notice {
  background: rgba(229, 192, 123, 0.08);
  border: 1px solid rgba(229, 192, 123, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 20px;
  text-align: left;
}
.login-security-pill {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(229, 192, 123, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-size: 12px;
}

.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Economy Log */
.economy-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.economy-field {
  display: flex;
  flex-direction: column;
  min-width: 160px;
}

.economy-actions {
  display: flex;
  gap: 8px;
}

.economy-notice {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.economy-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.economy-delta-pos { color: var(--success); font-weight: 700; }
.economy-delta-neg { color: var(--danger); font-weight: 700; }

.economy-pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Read-only guild and auction views */
.readonly-notice {
  background: rgba(229, 192, 123, 0.08);
  border: 1px solid rgba(229, 192, 123, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 16px;
}

.guild-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: #0c1018;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  font-size: 12px;
}

.guild-summary strong {
  color: var(--text-muted);
}

/* Gift codes */
.btn[hidden] {
  display: none;
}

.giftcode-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.giftcode-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.giftcode-item-row .item-combobox {
  flex: 2;
  min-width: 0;
}

.giftcode-item-row .giftcode-item-count {
  flex: 1;
  min-width: 0;
}

/* Item search combobox (gift code rewards) */
.item-combobox {
  position: relative;
}

.item-combobox__input {
  width: 100%;
}

.item-combobox__popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.item-combobox__popup[hidden],
.item-combobox__status[hidden],
.item-combobox__chosen[hidden] {
  display: none;
}

.item-combobox__list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.item-combobox__list:empty {
  display: none;
}

.item-combobox__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.item-combobox__option .item-icon {
  width: 28px;
  height: 28px;
}

.item-combobox__option:hover,
.item-combobox__option.is-active {
  background: var(--bg-card-hover);
}

.item-combobox__option.is-active {
  box-shadow: inset 2px 0 0 var(--border-focus);
}

.item-combobox__name {
  flex: 1;
  min-width: 0;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-combobox__id {
  flex-shrink: 0;
  font-size: 12px;
}

.item-combobox__status {
  padding: 8px 10px;
  font-size: 12px;
}

.item-combobox__chosen {
  margin-top: 6px;
  font-size: 13px;
}

.item-combobox__chosen .item-icon {
  width: 28px;
  height: 28px;
}

.giftcode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.giftcode-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-main);
  font-weight: 700;
  word-break: break-all;
}

.giftcode-rewards {
  min-width: 160px;
}

.giftcode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.form-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.form-error {
  padding: 10px 12px;
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

@media (max-width: 560px) {
  .giftcode-row {
    grid-template-columns: 1fr;
  }

  .char-card-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Account vault and web market (read-only) */
.badge-neutral {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.vault-section {
  margin-top: 16px;
}

.vault-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vault-panel {
  margin-top: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.vault-vip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.vault-meta {
  color: var(--text-muted);
}

.vault-empty {
  color: var(--text-muted);
  margin: 0;
}

.vault-item,
.market-item,
.market-account {
  color: var(--text-main);
}

/* Item image + name */
.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

.item-chip__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-icon {
  --q: var(--border-color);
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--q);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  overflow: hidden;
}

.item-icon__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.item-icon.is-missing {
  border-style: dashed;
}

.quality--common { --q: var(--q-common); }
.quality--fine { --q: var(--q-fine); }
.quality--rare { --q: var(--q-rare); }
.quality--legendary { --q: var(--q-legendary); }
.quality--mythic { --q: var(--q-mythic); }

.item-qty {
  color: var(--text-muted);
  font-weight: 600;
}

.item-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-chip-list--inline {
  display: inline-flex;
  flex-wrap: wrap;
  flex-direction: row;
  gap: 8px 14px;
  vertical-align: middle;
}

.market-price {
  color: var(--success);
  font-weight: 700;
}

.market-date {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.market-toolbar {
  align-items: flex-end;
}

/* Account management screen */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.account-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.account-tab:focus-visible {
  /* The tab strip scrolls, which would clip an outer ring. */
  outline-offset: -2px;
}

.account-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.account-breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  list-style: none;
  font-size: 13px;
  color: var(--text-muted);
}

.account-breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.account-breadcrumb-list li + li::before {
  content: "›";
  color: var(--text-dim);
}

.account-breadcrumb-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--gold);
  text-decoration: none;
}

.account-breadcrumb-list a:hover {
  text-decoration: underline;
}

.account-breadcrumb-list [aria-current="page"] {
  color: var(--text-main);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-screen .btn {
  min-height: 44px;
  text-decoration: none;
}

.account-screen .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.account-header,
.account-card,
.account-state {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.account-header-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.account-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.account-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.account-badges .badge {
  padding: 4px 8px;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.account-vip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.account-vip-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: inherit;
}

.account-vip-toggle:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.6;
}

.account-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
  margin-top: 12px;
  font-size: 13px;
}

.account-meta dt,
.account-summary-row dt,
.char-facts dt {
  color: var(--text-muted);
  font-size: 12px;
}

.account-meta dd {
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.account-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-main);
}

.account-state[hidden] {
  display: none;
}

/* Mobile first: one column; the rail dissolves so the summary sits on top and the notes follow the tabs. */
.account-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-rail {
  display: contents;
}

.account-summary-card {
  order: 0;
}

.account-main {
  order: 1;
  min-width: 0;
}

.account-notes-card {
  order: 2;
}

.account-card-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-main);
}

.account-card-text {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.account-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.account-summary-row:last-child {
  border-bottom: 0;
}

.account-summary-row dd {
  font-weight: 700;
  color: var(--text-main);
}

.account-notes-card .form-textarea {
  min-height: 96px;
  resize: vertical;
}

.account-notes-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

.account-status-text {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.account-status-text.success {
  color: var(--success);
}

.account-status-text.error {
  color: var(--danger);
}

.account-status-text.warning {
  color: var(--gold);
}

/* Tabs: a horizontally scrollable strip with snapping; the active tab has an indicator line, not just a colour. */
.account-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border-color);
}

.account-tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
}

.account-tab:hover {
  color: var(--text-main);
}

.account-tab[aria-selected="true"] {
  color: var(--gold);
}

.account-tab::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.account-tab[aria-selected="true"]::after {
  transform: scaleX(1);
}

.account-panel {
  min-width: 0;
}

.account-panel > * + * {
  margin-top: 16px;
}

.account-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.account-empty {
  padding: 12px 0;
  color: var(--text-muted);
}

/* Characters: one card per character, built with classes instead of inline styles. */
.account-screen .char-card-header {
  flex-wrap: wrap;
  gap: 8px;
}

.char-card-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.char-card-level {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.char-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 16px;
  margin-bottom: 8px;
  font-size: 12px;
}

.char-facts dd {
  overflow-wrap: anywhere;
}

.char-fact-zeny {
  color: var(--success);
}

.char-fact-other {
  color: var(--info);
}

.char-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.account-screen .char-inventory,
.account-screen .vault-panel .table-container {
  max-width: 100%;
  overflow-x: auto;
}

.account-screen .char-mail-panel {
  overflow-wrap: anywhere;
}

/* Security: the danger zone is separated from the other cards and always comes last. */
.account-panel > .account-danger-zone {
  margin-top: 32px;
}

.account-danger-zone {
  padding: 16px;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
}

.account-danger-zone .account-card-title {
  color: var(--danger);
}

/* Loading and error states */
.skeleton {
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  animation: accountSkeletonPulse 1.4s ease-in-out infinite;
}

.skeleton-line {
  height: 16px;
  margin-bottom: 12px;
}

.skeleton-line:nth-child(odd) {
  width: 100%;
}

.skeleton-line:nth-child(even) {
  width: 70%;
}

.skeleton-badge {
  display: inline-block;
  width: 88px;
  height: 24px;
}

@keyframes accountSkeletonPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.account-inline-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
}

.vault-panel {
  transition: opacity 0.2s ease;
}

.vault-panel.is-busy {
  opacity: 0.6;
}

.btn.is-loading {
  cursor: progress;
}

.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: accountSpin 0.8s linear infinite;
}

@keyframes accountSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .account-screen .gm-warp-form {
    grid-template-columns: 1fr;
  }

  .account-title {
    font-size: 20px;
  }
}

@media (min-width: 1024px) {
  .account-layout {
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .account-rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 80px;
  }

  .account-summary-card,
  .account-main,
  .account-notes-card {
    order: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Panel polish: classes that replace inline styles (a strict style-src policy drops style attributes), plus accessibility and responsive rules. Colours come from tokens only. */

/* Text and spacing utilities */
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-strong { color: var(--text-strong); }
.mb-4 { margin-bottom: 4px; }
.mb-12 { margin-bottom: 12px; }

.muted-note {
  font-size: 12px;
  color: var(--text-muted);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
}

.card-note {
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.toolbar-card-block {
  display: block;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.info-list {
  list-style: none;
  font-size: 12px;
  line-height: 2;
  color: var(--text-muted);
}

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.pill-sep {
  color: var(--text-dim);
}

.search-icon {
  color: var(--text-muted);
}

/* Column widths for table headers */
.w-8 { width: 8%; }
.w-10 { width: 10%; }
.w-11 { width: 11%; }
.w-12 { width: 12%; }
.w-14 { width: 14%; }
.w-15 { width: 15%; }
.w-16 { width: 16%; }
.w-17 { width: 17%; }
.w-18 { width: 18%; }
.w-20 { width: 20%; }
.w-22 { width: 22%; }

/* Login */
.login-card .form-group {
  text-align: left;
}

.login-error {
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--danger);
  text-align: left;
}

.btn-block {
  width: 100%;
  padding: 12px;
}

/* Modals */
.modal-dialog-sm { max-width: 440px; }
.modal-dialog-md { max-width: 460px; }
.modal-dialog-lg { max-width: 560px; }

.modal-intro {
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.modal-title-danger {
  color: var(--danger);
}

.modal-subtitle {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-strong);
}

/* Table cells and states built by the script */
/* td.table-state outranks the generic .data-table td padding */
td.table-state {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.table-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--danger);
}

.account-name {
  font-size: 14px;
  color: var(--text-strong);
}

.cell-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.cell-none {
  font-size: 12px;
  color: var(--text-dim);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab-btn svg {
  flex-shrink: 0;
}

/* Character inventory (inside a character card) */
.inventory-box {
  margin-top: 8px;
  padding: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-main);
}

.inventory-box.is-empty {
  color: var(--text-muted);
}

.inventory-total {
  margin-bottom: 8px;
  color: var(--text-muted);
}

.inventory-group {
  margin-bottom: 10px;
}

.inventory-group .data-table {
  margin-top: 6px;
}

/* Toast fade-out (replaces inline transition styles) */
.toast.is-leaving {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Narrow screens: the dashboard grid stacks and the accounts table turns into one card per account. */
@media (max-width: 640px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .data-table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table--stack,
  .data-table--stack tbody,
  .data-table--stack tr {
    display: block;
    width: 100%;
  }

  .data-table--stack tr {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-color);
  }

  .data-table--stack td {
    display: grid;
    grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .data-table--stack td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .data-table--stack td.table-state {
    display: block;
    padding: 24px 8px;
  }

  .data-table--stack td.table-state::before {
    content: none;
  }
}

/* Touch screens: every control gets a 44px target. */
@media (pointer: coarse) {
  .btn,
  .btn-sm,
  .btn-logout,
  .tab-btn,
  .lang-btn,
  .modal-close,
  .select-filter,
  .form-input,
  .search-box input,
  .sidebar-group-toggle {
    min-height: 44px;
  }

  .btn-sm,
  .btn-logout,
  .lang-btn,
  .modal-close,
  .sidebar-collapse,
  .sidebar-open,
  .sidebar-close {
    min-width: 44px;
    min-height: 44px;
  }
}
