:root {
  --bg: #f5f4ef;
  --panel: #fffdf7;
  --text: #1d2a2f;
  --muted: #637076;
  --line: #d9d2c3;
  --accent: #0b6b6b;
  --accent-strong: #084f4f;
  --danger: #8e2a2a;
  --danger-soft: #f3dcdc;
  --secondary: #e5ebe9;
  --ok: #2b6d39;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top, #fdf9ef, var(--bg) 55%);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  background: white;
  color: var(--text);
}
button { font: inherit; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #16363c; color: #f8f2e9; padding: 24px; }
.sidebar h1 { margin-top: 0; font-size: 1.3rem; }
.sidebar nav a { display: block; padding: 10px 0; color: #f8f2e9; opacity: 0.92; }
.sidebar nav form { margin: 10px 0 0; }
.sidebar nav .btn { width: 100%; }
.content { padding: 28px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 22px rgba(17, 26, 31, 0.06);
}
.toolbar, .form-grid { display: grid; gap: 12px; }
.toolbar { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; margin-bottom: 18px; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-strong); color: white; }
.btn-secondary { background: var(--secondary); color: var(--text); border-color: #cfd8d6; }
.btn-secondary:hover { background: #d9e1df; color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #e4b8b8; }
.btn-danger:hover { background: #eccaca; color: var(--danger); }
.btn[disabled], .btn.is-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; background: #d8ece8; color: var(--accent-strong); }
.badge.inactive { background: #f5dfdf; color: var(--danger); }
.badge.sync-error { background: #f8ead1; color: #8c5d0d; }
.messages { margin-bottom: 16px; }
.message { padding: 12px 14px; border-radius: 12px; margin-bottom: 10px; }
.message.success { background: #e4f1e7; color: var(--ok); }
.message.warning { background: #f9efd9; color: #7a5410; }
.message.error { background: #f8e3e3; color: var(--danger); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-header h2 { margin: 0; }
.errorlist { margin: 6px 0 0; padding-left: 18px; color: var(--danger); }
.muted { color: var(--muted); }
.empty-state { padding: 18px 0; color: var(--muted); text-align: center; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.code-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin: 16px 0; padding: 0; list-style: none; }
.code-list li { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-family: Consolas, "Courier New", monospace; letter-spacing: 0.08em; }
.hint { margin-top: 8px; color: var(--muted); font-size: 0.95rem; }
.mt-18 { margin-top: 18px; }
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #17363c, #ede6d6);
}
.auth-card {
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
.auth-card h1 { margin-top: 0; }
.auth-card input {
  padding: 12px;
  border: 1px solid #d1cbc0;
  margin-bottom: 14px;
}
.auth-card .btn {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: none;
}
.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f5f4ef;
}
.error-card {
  width: min(520px, 92vw);
  padding: 28px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { padding: 16px 20px; }
  .content { padding: 20px; }
  .section-header { flex-direction: column; align-items: flex-start; }
}
