:root {
  --bordo: #411217;
  --bordo-dark: #2a0b0e;
  --gold: #c9a227;
  --bronze: #8b5e34;
  --bg: #f6f3ee;
  --panel: #ffffff;
  --border: #e5ddd0;
  --text: #2a1f1a;
  --muted: #8a7a6d;
  --danger: #b3403a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Segoe UI', ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, textarea, select { font-family: inherit; }
a { color: inherit; }

.a-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--bordo), var(--bordo-dark));
}
.a-login-card {
  background: var(--panel);
  padding: 40px;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.a-login-card h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}
.a-login-card p.sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 0.9rem;
}
.a-field { margin-bottom: 16px; }
.a-field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.a-field input, .a-field textarea, .a-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  background: #fff;
  color: var(--text);
}
.a-field input:focus, .a-field textarea:focus, .a-field select:focus {
  border-color: var(--gold);
}

.a-btn {
  background: var(--bordo);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.a-btn:hover { background: var(--bordo-dark); }
.a-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.a-btn-gold { background: var(--gold); color: var(--bordo-dark); }
.a-btn-gold:hover { background: #b6901f; }
.a-btn-ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.a-btn-ghost:hover { border-color: var(--gold); }
.a-btn-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.a-btn-danger:hover { background: var(--danger); color: #fff; }
.a-btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 6px; }
.a-btn-icon {
  background: transparent; border: 1.5px solid var(--border); border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; color: var(--text);
}
.a-btn-icon:hover { border-color: var(--gold); }
.a-error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; margin-top: 4px; }

.a-shell { display: flex; min-height: 100vh; }
.a-sidebar {
  width: 220px;
  background: var(--bordo);
  color: #f5e9d8;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}
.a-logo { font-weight: 800; font-size: 1.15rem; margin-bottom: 4px; }
.a-logo span { color: var(--gold); }
.a-sidebar .a-user { font-size: 0.78rem; color: #c9a88f; margin-bottom: 28px; word-break: break-all; }
.a-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: 7px;
  color: #f5e9d8;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 4px;
  cursor: pointer;
}
.a-nav a:hover, .a-nav a.active { background: rgba(255,255,255,0.12); }
.a-sidebar .a-logout {
  margin-top: auto;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #f5e9d8;
  border-radius: 7px;
  padding: 9px;
  cursor: pointer;
  font-size: 0.85rem;
}

.a-main { flex: 1; padding: 32px 40px; max-width: 1100px; }
.a-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.a-topbar h1 { font-size: 1.4rem; margin: 0; }
.a-topbar .a-actions { display: flex; gap: 10px; }

.a-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.a-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.a-card:hover { border-color: var(--gold); box-shadow: 0 6px 18px rgba(65,18,23,0.1); }
.a-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.a-card .a-meta { color: var(--muted); font-size: 0.82rem; }
.a-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 10px;
}
.a-badge.on { background: #e4f4e3; color: #2f7d32; }
.a-badge.off { background: #f1eae0; color: var(--muted); }

.a-empty { color: var(--muted); text-align: center; padding: 60px 0; }

.a-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1.5px solid var(--border); }
.a-tabs button {
  background: transparent; border: none; padding: 10px 4px; margin-right: 20px;
  font-size: 0.92rem; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent;
}
.a-tabs button.active { color: var(--text); border-color: var(--gold); font-weight: 600; }

.a-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin-bottom: 20px; }
.a-panel h2 { font-size: 1rem; margin: 0 0 16px; }
.a-row { display: flex; gap: 16px; }
.a-row > * { flex: 1; }

.a-qcard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.a-qcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.a-qcard-head .a-qnum {
  width: 26px; height: 26px; border-radius: 6px; background: var(--bordo); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700;
}
.a-qcard-head select { width: auto; }
.a-qcard-head .a-spacer { flex: 1; }
.a-qcard-head .a-qbtns { display: flex; gap: 6px; }

.a-options-editor { margin-top: 10px; }
.a-option-row { display: flex; gap: 8px; margin-bottom: 6px; }
.a-option-row input { flex: 1; }

.a-checkline { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--muted); margin-top: 6px; }

.a-theme-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.a-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.a-swatch input[type=color] { width: 44px; height: 34px; border: none; padding: 0; border-radius: 6px; cursor: pointer; }

.a-savebar {
  position: sticky; bottom: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  box-shadow: 0 -6px 16px rgba(0,0,0,0.04);
}
.a-savebar .a-status { color: var(--muted); font-size: 0.85rem; }

.a-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.a-table th, .a-table td {
  text-align: left; padding: 10px 14px; font-size: 0.85rem; border-bottom: 1px solid var(--border);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.a-table th { background: #f1eae0; color: var(--muted); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; }
.a-table tr:last-child td { border-bottom: none; }

.a-link-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); word-break: break-all; }
.a-link-row a { color: var(--bordo); font-weight: 600; text-decoration: none; }
.a-link-row a:hover { text-decoration: underline; }
