/* Dealti ACP - minimal admin stylesheet */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e5e9;
  --text: #1f2430;
  --muted: #6b7280;
  --brand: #83bf68;
  --brand-dark: #5f9648;
  --danger: #d64545;
  --radius: 8px;
  --sidebar-w: 220px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.acp-shell { display: flex; min-height: 100vh; }
.acp-side {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #1f2430;
  color: #cfd3dc;
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.acp-side .brand {
  font-weight: 700; font-size: 15px; color: #fff;
  padding: 4px 18px 16px; letter-spacing: .3px;
}
.acp-side .brand small { color: var(--brand); font-weight: 600; }
.acp-nav a {
  display: block; padding: 8px 18px; color: #cfd3dc; font-size: 13.5px;
  border-left: 3px solid transparent;
}
.acp-nav a:hover { background: #272d3b; text-decoration: none; color: #fff; }
.acp-nav a.active { background: #272d3b; border-left-color: var(--brand); color: #fff; }
.acp-nav .group { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; }
.acp-nav .badge {
  float: right; background: var(--brand); color: #10240a; font-size: 11px;
  font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 18px;
}
.acp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acp-top {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; gap: 16px;
}
.acp-top h1 { font-size: 16px; margin: 0; font-weight: 650; }
.acp-top .spacer { flex: 1; }
.acp-content { padding: 24px; flex: 1; }

/* ---------- cards / tables ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.alert .n { color: var(--brand-dark); }

table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
table.list th { background: #fafbfc; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.list tr:hover td { background: #fafbfc; }
table.list td.actions { text-align: right; white-space: nowrap; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: #eef0f3; color: var(--muted); }
.tag.on { background: #e4f2dc; color: var(--brand-dark); }
.tag.off { background: #fbe6e6; color: var(--danger); }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
.field .hint { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; min-height: 90px; }
.charcount { float: right; color: var(--muted); font-size: 11px; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--brand-dark);
  background: var(--brand); color: #10240a; font-weight: 650; font-size: 13px; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: #eef0f3; color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert.err { background: #fbe6e6; color: #8a2a2a; border: 1px solid #f0c0c0; }
.alert.ok { background: #e4f2dc; color: #2f5720; border: 1px solid #c3e0b0; }

/* ---------- language tabs ---------- */
.langtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.langtabs button {
  padding: 7px 16px; border: 1px solid transparent; border-bottom: none; background: none;
  cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); border-radius: 6px 6px 0 0;
}
.langtabs button.active { color: var(--text); background: var(--surface); border-color: var(--border); margin-bottom: -1px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 30px; width: 360px; }
.auth-box h1 { font-size: 17px; margin: 0 0 4px; }
.auth-box p.sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.auth-box .btn { width: 100%; text-align: center; }
.qr img { display: block; margin: 10px auto; width: 190px; height: 190px; }
code.secret { display: block; background: #f4f5f7; padding: 8px; border-radius: 6px; text-align: center; letter-spacing: 2px; font-size: 13px; margin: 8px 0; }
.recovery { background: #f4f5f7; border-radius: 6px; padding: 12px; font-family: monospace; font-size: 12.5px; columns: 2; }

/* ---------- editor ---------- */
.CodeMirror { border: 1px solid var(--border); border-radius: 6px; height: 420px; font-size: 13px; }
.editor-bar { display: flex; gap: 6px; margin-bottom: 6px; }
.editor-bar button.active { background: var(--brand); color: #10240a; border-color: var(--brand-dark); }
.editor-preview-mode > textarea { display: none; }
.preview-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.repeater-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.repeater-row textarea { min-height: 40px; }

@media (max-width: 800px) {
  .acp-side { position: fixed; left: -240px; transition: left .2s; z-index: 50; }
  .acp-side.open { left: 0; }
  .acp-shell { display: block; }
}
