:root {
  --bg: #f2f2f2;
  --surface: #fff;
  --text: #000;
  --muted: #5a5a5a;
  --line: #d1d1d1;
  --cyan: #0891b2;
  --button: #0e7490;
  --tint: #e0f5fa;
  --green: #15803d;
  --amber: #b45309;
  --red: #c0392b;
  --radius: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--cyan); }
button { cursor: pointer; }
a { color: var(--button); }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 18px; font-weight: 650; }
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: white; border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
img { max-width: 100%; height: auto; }
.brand { display: block; margin: 0 6px 28px; }
.brand img, .logo { display: block; width: 168px; max-width: 100%; height: auto; }
.nav { display: grid; gap: 6px; }
.nav a { display: block; padding: 10px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 600; }
.nav a:hover { background: #f3f3f3; color: var(--text); }
.nav a.active { background: var(--tint); color: var(--button); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
.small { font-size: 12px; }
.workspace { min-width: 0; }
.topbar { height: 60px; border-bottom: 1px solid var(--line); background: white; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; gap: 16px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 600; }
.content { padding: 24px 28px 40px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-heading p { margin-top: 6px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat span, .stat small { display: block; font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 28px; font-weight: 650; margin: 2px 0; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel-header { padding: 16px 18px; border-bottom: 1px solid #e4e4e4; }
.panel-header h2 { margin: 0; }
.panel-body { padding: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.banner, .note { background: var(--tint); border: 1px solid #c5e8ef; border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th { background: #fafafa; color: var(--muted); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; font-weight: 650; padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; }
td { padding: 13px 16px; border-bottom: 1px solid #e8e8e8; vertical-align: middle; text-align: left; }
tbody tr:hover { background: #fafcfc; }
.row-link { font-weight: 650; text-decoration: none; }
.cell-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.table-footer, .empty { padding: 12px 18px; color: var(--muted); font-size: 12px; background: #fafafa; }
.empty { text-align: center; padding: 28px; background: white; }
.error, .ok, .secret { overflow-wrap: anywhere; }
.error { background: #fde8e6; color: var(--red); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.ok { background: #e8f6ee; color: var(--green); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.setup-label { margin: 0 0 4px; font-size: 12px; font-weight: 650; }
.secret { margin: 0 0 12px; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-family: Consolas, monospace; font-size: 13px; line-height: 1.45; }
.qr { display: block; width: 196px; height: 196px; margin: 4px 0 16px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.secret-more { margin: 0 0 8px; }
.secret-more summary { cursor: pointer; color: var(--button); font-weight: 650; margin-bottom: 8px; }
label { display: block; font-weight: 650; margin: 10px 0 4px; }
input, select, textarea { width: 100%; max-width: 520px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background-color: #fff; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 16px; max-width: none; margin: 2px 0 0; padding: 0; flex: 0 0 auto; accent-color: var(--button); }
label:has(input[type="checkbox"]), label:has(input[type="radio"]) { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; }
input::-ms-reveal, input::-ms-clear { display: none; }
textarea { min-height: 72px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1 1 220px; }
button, .button { background: var(--button); color: white; border: 0; border-radius: 6px; padding: 8px 14px; min-height: 36px; text-decoration: none; display: inline-block; font-weight: 600; }
button:hover, .button:hover { background: #155e75; }
button.secondary, a.secondary, a.button.secondary { background: white; color: var(--text); border: 1px solid #b6b6b6; }
button.danger { background: #9f1239; }
button.danger:hover { background: #881337; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
button.secondary:hover, a.secondary:hover, a.button.secondary:hover { background: #f6f6f6; }
a.button.compact, button.compact { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; border-radius: 4px; font-size: 11px; font-weight: 650; padding: 3px 7px; background: #eee; color: #4b4b4b; }
.badge.good { background: #eaf5ee; color: var(--green); }
.badge.warn { background: #fff1e0; color: var(--amber); }
.badge.info { background: var(--tint); color: var(--button); }
.badge.neutral { background: #efefef; color: var(--muted); }
.auth { max-width: 420px; margin: 64px auto; padding: 28px 28px 20px; }
.auth .logo { width: 280px; max-width: 100%; margin-bottom: 8px; }
.auth h1 { margin: 0; }
.auth label { font-size: 12px; margin: 14px 0 6px; }
.auth input { max-width: none; }
.auth form p { margin: 16px 0 12px; }
.auth > .muted:last-child { margin-bottom: 0; }
code { font-family: Consolas, monospace; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; padding: 14px 18px; border-bottom: 1px solid #e4e4e4; margin: 0; }
.filters label { margin: 0 0 4px; font-size: 12px; }
.filters select, .filters input { max-width: 220px; min-width: 160px; }
.filters button { margin-bottom: 0; }
@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .page-heading { flex-direction: column; }
}
.card > h2 { margin: -16px -16px 16px; padding: 14px 16px; border-bottom: 1px solid #e4e4e4; font-size: 16px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid #b9b9b9; margin: 0 0 22px; }
.tabs a { text-decoration: none; padding: 10px 0 12px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--button); border-bottom-color: var(--cyan); }
.notice { padding: 13px 14px; border: 1px solid #bfdae0; background: #f0fafc; border-radius: 7px; color: #265462; font-size: 12px; margin-bottom: 15px; }
.notice strong { display: block; margin-bottom: 3px; color: inherit; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field { margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .form-grid input, .form-grid select, .form-grid textarea { max-width: none; }
.overlay { position: fixed; inset: 0; background: #0005; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: white; border-radius: 11px; width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 15px 60px #0003; }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; }
.modal-body { padding: 20px 22px; }
.modal-footer { border-top: 1px solid var(--line); justify-content: flex-end; gap: 8px; }
.close-btn { border: 0; background: transparent; color: var(--muted); font-size: 28px; line-height: 1; text-decoration: none; width: 32px; height: 32px; text-align: center; }
.codes { list-style: none; padding: 0; margin: 0 0 16px; }
.codes .secret { margin-bottom: 8px; }
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
