:root {
  --bg: #070707;
  --surface: #111111;
  --surface-raised: #161616;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.72);
  --text-faint: rgba(255, 255, 255, 0.45);

  --gold-deep: #92400e;
  --gold-amber: #d97706;
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --gold-contrast: #1a1103;

  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.32);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.32);

  --radius: 10px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold-light);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  padding: 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand small {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0;
  margin-left: 2px;
}

.logo-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--text);
}

.sidebar nav a {
  display: block;
  padding: 8px 8px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.sidebar nav a.active {
  background: var(--surface-raised);
  color: var(--gold-light);
}

.sidebar .nav-section {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 20px 8px 6px;
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1100px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.main-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 40px 0;
  font-size: 13px;
  color: var(--text-faint);
}

.topbar a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 12px;
}

.topbar .inline-form {
  display: inline;
  margin: 0;
}

.topbar .link-button {
  background: none;
  border: 0;
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 12px;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.topbar a:hover {
  color: var(--gold-light);
}

.topbar .link-button:hover {
  color: var(--gold-light);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--gold);
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  background: var(--surface-raised);
  font-weight: 500;
  color: var(--text-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-raised);
}

.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: var(--radius-lg);
  background: var(--gold);
  color: var(--gold-contrast);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--gold-light);
}

.btn-danger {
  background: var(--danger);
  color: #2b0b0b;
}

.btn-danger:hover {
  background: #fca5a5;
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.10);
}

.actions a, .actions button {
  font-size: 13px;
  margin-right: 8px;
  color: var(--text-muted);
  text-decoration: none;
}

.actions a:hover {
  color: var(--gold-light);
}

.actions form {
  display: inline;
}

form.stacked p {
  margin: 0 0 14px;
}

form.stacked label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-muted);
}

form.stacked input[type=text],
form.stacked input[type=number],
form.stacked input[type=url],
form.stacked input[type=email],
form.stacked input[type=password],
form.stacked input[type=file],
form.stacked textarea,
form.stacked select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

form.stacked input[type=file] {
  padding: 7px 10px 7px 0;
  cursor: pointer;
}

.custom-icon-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-icon-preview__image,
.custom-icon-preview__placeholder {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(245, 158, 11, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.custom-icon-preview__image {
  object-fit: contain;
  padding: 7px;
}

.custom-icon-preview__glyph {
  color: var(--gold-light);
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
}

.custom-icon-preview__label {
  color: var(--text-muted);
  font-size: 13px;
  word-break: break-all;
}

form.stacked input[type=file]::file-selector-button {
  margin-left: 10px;
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-light);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

form.stacked input[type=file]::-webkit-file-upload-button {
  margin-left: 10px;
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-light);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

form.stacked input[type=file]::file-selector-button:hover,
form.stacked input[type=file]::-webkit-file-upload-button:hover {
  background: rgba(245, 158, 11, 0.20);
  border-color: var(--gold);
}

form.stacked input:focus,
form.stacked textarea:focus,
form.stacked select:focus {
  outline: none;
  border-color: var(--gold);
}

form.stacked textarea {
  min-height: 100px;
}

.icon-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.icon-select {
  position: relative;
}

.icon-select__trigger {
  width: 100%;
  min-height: 42px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.icon-select__trigger:hover {
  border-color: var(--gold);
}

.icon-select__glyph {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
}

.icon-select__label {
  flex: 1;
}

.icon-select__chevron {
  color: var(--text-faint);
  font-size: 12px;
}

.icon-select__panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  padding: 10px;
}

.icon-select.is-open .icon-select__panel {
  display: block;
}

.icon-select__search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
}

.icon-select__search:focus {
  outline: none;
  border-color: var(--gold);
}

.icon-select__list {
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.icon-select__option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.icon-select__option:hover {
  background: rgba(245, 158, 11, 0.12);
}

.icon-select__option-glyph {
  width: 18px;
  height: 18px;
  color: var(--gold-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.transfer-card {
  margin-top: 24px;
}

.transfer-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

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

.transfer-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.check-label input[type="checkbox"] {
  width: auto;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.category-option {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
}

.errorlist {
  color: var(--danger);
  font-size: 13px;
  padding-left: 0;
  list-style: none;
  margin: 4px 0 0;
}

.help-text {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.messages li {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 14px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.empty-state {
  color: var(--text-faint);
  padding: 24px;
  text-align: center;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(146, 64, 14, 0.16), transparent 60%),
    var(--bg);
}

.login-box {
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand .logo-icon {
  width: 36px;
  height: 36px;
}

.login-brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge.ok {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
