/* ============================================================
   VPN Support Admin · стили
   ============================================================ */

:root {
  --bg: #0f1115;
  --bg-2: #161922;
  --bg-3: #1f2330;
  --line: #2a2f3d;
  --line-2: #353b4d;
  --text: #e5e7ec;
  --muted: #8b8f99;
  --muted-2: #5f6470;
  --accent: #ff8c42;
  --accent-dim: rgba(255, 140, 66, 0.15);
  --success: #4ade80;
  --warn: #fbbf24;
  --error: #f87171;
  --mono: ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

code {
  font-family: var(--mono);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background:
    radial-gradient(800px 400px at 20% -10%, rgba(255, 140, 66, 0.08), transparent 60%),
    radial-gradient(600px 300px at 80% 100%, rgba(255, 140, 66, 0.05), transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 38px 32px 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-logo {
  font-size: 38px;
  text-align: center;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 8px rgba(255, 140, 66, 0.4));
}

.login-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
  text-align: center;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 26px;
}

.login-form label {
  display: block;
  margin-bottom: 14px;
}

.login-form label span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-form button {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  background: var(--accent);
  color: #0f1115;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s;
}

.login-form button:hover { filter: brightness(1.1); }
.login-form button:active { filter: brightness(0.95); }

.login-footnote {
  margin-top: 24px;
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 18px;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 28px;
  height: 56px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.brand-dot {
  font-size: 20px;
  filter: drop-shadow(0 0 6px rgba(255, 140, 66, 0.5));
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav a {
  display: inline-block;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover { color: var(--text); background: var(--bg-3); }
.nav a.active { color: var(--text); background: var(--bg-3); }
.nav a.disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  pointer-events: none;
}

.user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.user-name { color: var(--muted); }

.logout {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  transition: all 0.15s;
}

.logout:hover {
  border-color: var(--error);
  color: var(--error);
  text-decoration: none;
}

.content {
  flex: 1;
  padding: 32px 28px 60px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.page-head {
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 28px;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-warn {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #f8d067;
}

.alert-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
}

/* ============================================================
   KPI GRID
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.kpi {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  transition: border-color 0.15s;
}

.kpi:hover { border-color: var(--line-2); }

.kpi-label {
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.kpi-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 8px;
}

.kpi-value.accent { color: var(--accent); }
.kpi-value.small { font-size: 22px; }

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 24px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.card-head .muted { font-size: 12px; }

/* ============================================================
   CHART (bars)
   ============================================================ */

.chart {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding: 24px 20px 12px;
  height: 240px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  position: relative;
}

.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent) 0%, rgba(255, 140, 66, 0.6) 100%);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  transition: filter 0.15s;
}

.chart-bar:hover { filter: brightness(1.15); }

.chart-val {
  position: absolute;
  top: -18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.chart-label {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  font-family: var(--mono);
}

/* ============================================================
   TABLE
   ============================================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 10px 20px;
  background: var(--bg-3);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-open {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.badge-closed {
  background: rgba(139, 143, 153, 0.15);
  color: var(--muted);
}

/* ============================================================
   FOOTER
   ============================================================ */

.foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 720px) {
  .topbar { gap: 16px; padding: 0 16px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .user-name { display: none; }
  .content { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 22px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 26px; }
  .chart { height: 180px; gap: 3px; }
  .chart-label { font-size: 9px; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 12px; }
}


/* ============================================================
   TEXTS LIST: clickable rows
   ============================================================ */

.data-table-clickable tr {
  cursor: pointer;
  transition: background 0.1s;
}
.data-table-clickable tbody tr:hover td { background: rgba(255, 140, 66, 0.05); }

.preview-cell {
  max-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-ok {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* ============================================================
   TEXT EDITOR
   ============================================================ */

.text-editor { display: block; }

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.editor-pane {
  display: flex;
  flex-direction: column;
}

.pane-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.text-textarea {
  width: 100%;
  min-height: 480px;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s;
}
.text-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.editor-meta {
  margin-top: 6px;
  font-size: 12px;
}

.text-preview {
  min-height: 480px;
  padding: 16px;
  background: #181c2a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  overflow-y: auto;
  white-space: normal;
  word-break: break-word;
}
.text-preview b, .text-preview strong { font-weight: 700; color: var(--text); }
.text-preview i, .text-preview em { font-style: italic; }
.text-preview u { text-decoration: underline; }
.text-preview s { text-decoration: line-through; }
.text-preview code {
  font-family: var(--mono);
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
  color: #e5e7ec;
}
.text-preview a {
  color: #4a9eff;
  text-decoration: none;
  border-bottom: 1px solid rgba(74,158,255,0.3);
}
.text-preview blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 140, 66, 0.06);
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 14px 0;
}

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #0f1115;
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-secondary:hover {
  color: var(--text);
  border-color: var(--line-2);
  text-decoration: none;
}

.btn-warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.4);
}
.btn-warning:hover {
  background: rgba(251, 191, 36, 0.25);
}

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { filter: brightness(1.1); }

.hint {
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 6px 6px 0;
  margin: 12px 0;
  font-size: 14px;
}
.hint code { background: var(--bg-3); padding: 1px 5px; border-radius: 3px; }
.hint a { font-weight: 600; }

.small { font-size: 12px; }

/* ============================================================
   SERVICE PAGE
   ============================================================ */

.service-status { padding: 18px 20px; }
.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
}
.status-label {
  color: var(--muted);
  min-width: 110px;
  font-size: 13px;
}

.service-action {
  padding: 18px 20px;
}
.service-action p { margin-top: 0; color: var(--muted); }

.pin-box {
  margin-top: 16px;
  padding: 18px;
  background: rgba(255, 140, 66, 0.06);
  border: 1px solid rgba(255, 140, 66, 0.3);
  border-radius: 8px;
}

.pin-code {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.pin-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.pin-input {
  width: 100px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  text-align: center;
  letter-spacing: 0.1em;
}
.pin-input:focus {
  outline: none;
  border-color: var(--accent);
}

.alert-warn code,
.alert-error code,
.alert-ok code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 3px;
}

@media (max-width: 720px) {
  .editor-grid { grid-template-columns: 1fr; gap: 12px; }
  .text-textarea, .text-preview { min-height: 280px; }
  .form-actions { padding: 12px 0; }
  .btn { padding: 10px 18px; font-size: 13px; }
}

/* ============================================================
   ИТЕРАЦИЯ 2: тексты, редактор, сервис
   ============================================================ */

/* Alert OK */
.alert-ok {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
}

/* Кликабельные строки таблицы */
.data-table-clickable tbody tr {
  cursor: pointer;
}
.data-table-clickable tbody tr:hover td {
  background: rgba(255, 140, 66, 0.05);
}
.preview-cell {
  font-family: var(--mono);
  font-size: 12px;
  max-width: 1px;  /* трюк для truncate */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Заголовок страницы с ссылкой Back */
.back-link {
  color: var(--muted);
  font-weight: 500;
  font-size: 16px;
  margin-right: 12px;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

/* Редактор: две колонки на десктопе, одна на мобильном */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.editor-col {
  display: flex;
  flex-direction: column;
}
.editor-col > form {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.text-editor {
  width: 100%;
  flex: 1;
  min-height: 380px;
  resize: vertical;
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  border: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  outline: none;
}
.text-editor:focus {
  background: #0d0e12;
}

.editor-actions {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: filter 0.15s, background 0.15s;
}
.btn-primary { background: var(--accent); color: #0f1115; }
.btn-primary:hover { filter: brightness(1.1); text-decoration: none; }
.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-secondary:hover { border-color: var(--line-2); text-decoration: none; }
.btn-warn {
  background: var(--warn);
  color: #0f1115;
}
.btn-warn:hover { filter: brightness(1.1); }
.btn-danger {
  background: var(--error);
  color: #0f1115;
}
.btn-danger:hover { filter: brightness(1.1); }

/* Превью Telegram */
.tg-preview-wrap {
  padding: 22px;
  background: linear-gradient(135deg, #1d2733 0%, #243240 100%);
  flex: 1;
  min-height: 380px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
}
.tg-message {
  background: #182533;
  color: #e6edf3;
  padding: 12px 14px;
  border-radius: 12px 12px 12px 4px;
  max-width: 92%;
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.tg-message b, .tg-message strong { font-weight: 700; }
.tg-message i, .tg-message em { font-style: italic; }
.tg-message u { text-decoration: underline; }
.tg-message s, .tg-message del { text-decoration: line-through; }
.tg-message a { color: #62baf6; text-decoration: none; }
.tg-message a:hover { text-decoration: underline; }
.tg-message code {
  background: rgba(255,255,255,0.1);
  color: #e6edf3;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12.5px;
}
.tg-message pre {
  background: rgba(0,0,0,0.3);
  color: #e6edf3;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 6px 0;
  white-space: pre-wrap;
}
.tg-message blockquote {
  border-left: 3px solid #62baf6;
  padding: 4px 10px;
  margin: 6px 0;
  background: rgba(98, 186, 246, 0.08);
  border-radius: 0 4px 4px 0;
}

/* Hint */
.hint {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 24px;
}
.hint summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  user-select: none;
}
.hint summary:hover { color: var(--text); }
.hint[open] summary {
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.hint-body {
  padding: 16px 22px 18px;
  font-size: 13.5px;
  color: var(--muted);
}
.hint-body ul { margin: 8px 0; padding-left: 22px; }
.hint-body li { margin: 4px 0; }
.hint-body .small { font-size: 12px; }

/* Service: status grid */
.card-body {
  padding: 16px 20px 18px;
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

/* Подтверждение ПИН */
.confirm-box {
  margin-top: 6px;
  padding: 18px 20px;
  background: rgba(248, 113, 113, 0.06);
  border: 1px dashed rgba(248, 113, 113, 0.4);
  border-radius: 8px;
}
.confirm-pin {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
}
.pin-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--error);
  letter-spacing: 0.2em;
  background: rgba(0,0,0,0.25);
  padding: 6px 14px;
  border-radius: 5px;
}
.confirm-form {
  display: flex;
  gap: 8px;
}
.confirm-form input {
  flex: 1;
  max-width: 220px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.15em;
  text-align: center;
}
.confirm-form input:focus {
  outline: none;
  border-color: var(--error);
}

.small { font-size: 12px; }

/* На мобильных колонки в одну */
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .text-editor { min-height: 280px; }
  .tg-preview-wrap { min-height: 180px; }
  .confirm-pin { flex-direction: column; gap: 6px; }
  .confirm-form { flex-direction: column; }
  .confirm-form input { max-width: 100%; }
}


/* ============================================================
   BUTTONS LIST + EDITOR
   ============================================================ */

.btn-text-link {
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px dashed transparent;
}
.btn-text-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.row-saved {
  background: rgba(74, 222, 128, 0.06);
  animation: rowFlash 1.5s ease-out;
}
@keyframes rowFlash {
  0%   { background: rgba(74, 222, 128, 0.25); }
  100% { background: rgba(74, 222, 128, 0.06); }
}

.badge-locked {
  display: inline-block;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  margin-left: 6px;
}

.move-cell {
  text-align: right;
  white-space: nowrap;
}

.btn-move {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  margin-left: 2px;
}
.btn-move:hover:not(:disabled) {
  background: var(--accent);
  color: #0f1115;
  border-color: var(--accent);
}
.btn-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ============================================================
   FORM (button editor)
   ============================================================ */

.button-form {
  max-width: 720px;
  padding: 8px 0;
}

.form-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: flex-start;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.form-row > label {
  display: block;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-input.mono { font-family: var(--mono); font-size: 13.5px; }
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input:read-only { background: var(--bg-3); cursor: not-allowed; color: var(--muted); }

.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-card {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.radio-card:hover { border-color: var(--line-2); }
.radio-card.selected {
  border-color: var(--accent);
  background: rgba(255, 140, 66, 0.06);
}
.radio-card input { display: none; }
.radio-card strong { font-weight: 600; font-size: 14px; }

.form-actions { padding: 20px 0 8px; }

@media (max-width: 720px) {
  .form-row { grid-template-columns: 1fr; gap: 8px; padding: 14px 0; }
  .radio-card { min-width: 0; }
}


/* ============================================================
   TICKETS LIST
   ============================================================ */

.ticket-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.ticket-filters .form-input {
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
}

.filter-tab {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.filter-tab:hover { color: var(--text); text-decoration: none; }
.filter-tab.active {
  background: var(--bg-3);
  color: var(--text);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  margin-top: 8px;
  font-size: 14px;
}
.pagination a {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
}
.pagination a:hover { border-color: var(--accent); }

/* ============================================================
   TICKET VIEW (chat-like)
   ============================================================ */

.ticket-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.chat {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 70vh;
  overflow-y: auto;
}

.msg {
  display: flex;
  width: 100%;
}

.msg-in { justify-content: flex-start; }
.msg-out { justify-content: flex-end; }

.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg-in .msg-bubble {
  border-bottom-left-radius: 4px;
}

.msg-out .msg-bubble {
  background: rgba(255, 140, 66, 0.10);
  border-color: rgba(255, 140, 66, 0.25);
  border-bottom-right-radius: 4px;
}

.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.msg-head strong {
  font-weight: 600;
  color: var(--text);
}

.msg-time {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--mono);
}

.kind-tag {
  background: var(--bg-2);
  color: var(--muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--line);
}

.msg-text {
  white-space: pre-wrap;
}

.empty-state {
  padding: 60px 30px;
  text-align: center;
  color: var(--muted);
}
.empty-state p { margin: 6px 0; }

@media (max-width: 720px) {
  .msg-bubble { max-width: 88%; font-size: 13px; }
  .ticket-filters { flex-direction: column; align-items: stretch; }
  .ticket-filters .form-input { max-width: none; }
  .filter-tabs { justify-content: center; }
}
