/* BitGRootForwarder panel — design system (Mikhak) */

@font-face {
  font-family: "Mikhak";
  src: url("/css/Mikhak.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a0c11;
  --surface: #11141b;
  --surface-2: #161a23;
  --surface-3: #1c212c;
  --border: #232a37;
  --border-strong: #313a4c;
  --text: #e9ecf3;
  --muted: #8a93a6;
  --muted-2: #616a7e;
  --accent: #f5a524;
  --accent-2: #ffc15e;
  --accent-soft: rgba(245, 165, 36, 0.13);
  --on-accent: #1c1305;
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.13);
  --info: #7dd3fc;
  --info-soft: rgba(125, 211, 252, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 55px -24px rgba(0, 0, 0, 0.85);
  --ring: 0 0 0 3px rgba(245, 165, 36, 0.22);
  --input-bg: #0d1017;
  --surface-end: #0f121a;
  --hover-bg: #242b3a;
  --hover-border: #3a465a;
  --popover-bg: #0d1017;
  --row-hover: rgba(255, 255, 255, 0.025);
  --text-soft: #cfd6e2;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Mikhak", "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
  background:
    radial-gradient(1200px 620px at 88% -12%, rgba(245, 165, 36, 0.11), transparent 58%),
    radial-gradient(950px 560px at 4% 108%, rgba(125, 211, 252, 0.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.85;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--text); }
h1, h2, h3 { line-height: 1.5; }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 26px;
  background: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 16px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-2), #b26f00);
  color: var(--on-accent); font-weight: 800; font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 8px 20px -8px rgba(245,165,36,.8);
}
.brand small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.4; }

.nav { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.nav a {
  position: relative; color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px; transition: all .18s ease;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--on-accent); background: var(--accent); box-shadow: 0 8px 20px -12px rgba(245,165,36,.9); }
.nav form { margin: 0; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 30px 26px 80px; }

.page-head { margin-bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; margin: 0 0 6px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin: 0; }

/* Guide */
.guide {
  display: flex; gap: 13px; align-items: flex-start;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 22px;
  font-size: 13.5px; color: var(--text-soft);
}
.guide .ico {
  flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.guide b { color: var(--text); font-weight: 600; }
.guide ul { margin: 8px 0 0; padding-inline-start: 18px; }
.guide li { margin: 3px 0; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-end));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.card-hint { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }

/* Section title with step number */
.step-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; border: 1px solid rgba(245,165,36,.3);
}

/* Stats */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset-inline-start: 0; top: 0; width: 3px; height: 100%; background: var(--accent); opacity: .5; }
.stat .n { font-size: 32px; font-weight: 700; letter-spacing: -.5px; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* Status */
.status-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(139,147,164,.15); }
.dot.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); animation: pulse 2.4s ease-in-out infinite; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface-2); white-space: nowrap;
}
.badge.ok { color: var(--success); border-color: transparent; background: var(--success-soft); }
.badge.warn { color: var(--warn); border-color: transparent; background: var(--warn-soft); }
.badge.err { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.badge.info { color: var(--info); border-color: transparent; background: var(--info-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-3); color: var(--text); font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .16s ease; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--hover-bg); border-color: var(--hover-border); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--on-accent); border-color: transparent; box-shadow: 0 10px 24px -12px rgba(245,165,36,.85); }
.btn.primary:hover { background: linear-gradient(180deg, #ffcf78, var(--accent-2)); }
.btn.danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn.danger:hover { background: rgba(248,113,113,.2); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text); border: 1px solid var(--border-strong);
  font-family: inherit; font-size: 14px; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.option-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: border-color .15s ease;
}
.option-row:hover { border-color: var(--border-strong); }
.option-row input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.option-row .opt-title { font-weight: 600; font-size: 14px; }
.option-row .opt-desc { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.option-row .opt-ico { font-size: 19px; line-height: 1.2; margin-top: 1px; flex: none; }
.options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }

.filter-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.filter-row:last-child { border-bottom: none; }
.filter-hint { font-size: 12.5px; color: var(--muted); margin-top: 7px; }

/* Tooltip */
.tip { position: relative; cursor: help; border-bottom: 1px dotted var(--muted-2); }
.tip:hover::after {
  content: attr(data-tip); position: absolute; inset-inline-start: 0; bottom: 130%;
  background: #12151c; color: #e9ecf3; border: 1px solid #313a4c; border-radius: 8px;
  padding: 8px 11px; font-size: 12px; width: max-content; max-width: 280px; z-index: 40; box-shadow: var(--shadow); line-height: 1.7;
}

/* Rows */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-top { align-items: flex-start; }
.spacer { flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { text-align: right; padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .3px; z-index: 2; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: var(--row-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
td.mono, .mono { font-variant-numeric: tabular-nums; color: var(--muted); }
.muted { color: var(--muted); }

/* Messages */
.msg { padding: 13px 17px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.msg.info { background: var(--success-soft); border-color: rgba(52,211,153,.3); color: #a7f3d0; }
.msg.error { background: var(--danger-soft); border-color: rgba(248,113,113,.3); color: #fecaca; }

/* Search + filters */
.searchbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.searchbar input[type=text] { max-width: 340px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters .field { min-width: 170px; }

.empty { text-align: center; color: var(--muted); padding: 38px 16px; font-size: 14px; }

/* Chat picker */
.picker { position: relative; }
.picker-box {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 48px;
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--input-bg);
}
.picker-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.picker-box input[type=text] { border: none; background: transparent; flex: 1; min-width: 120px; padding: 4px 6px; box-shadow: none; }
.picker-box input[type=text]:focus { border: none; box-shadow: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong); font-size: 13px; max-width: 100%;
}
.chip.dest { background: rgba(245,165,36,.12); border-color: rgba(245,165,36,.35); }
.chip .x { cursor: pointer; color: var(--muted); font-weight: 700; }
.chip .x:hover { color: var(--danger); }
.picker-results {
  position: absolute; z-index: 25; inset-inline: 0; top: calc(100% + 6px); max-height: 260px; overflow-y: auto;
  background: var(--popover-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); display: none;
}
.picker-results.open { display: block; }
.picker-results .item { padding: 9px 13px; cursor: pointer; font-size: 13.5px; display: flex; justify-content: space-between; gap: 10px; }
.picker-results .item:hover, .picker-results .item.active { background: var(--surface-2); }
.picker-results .item .t { color: var(--muted); font-size: 12px; }
.picker-results .none { padding: 12px; color: var(--muted); font-size: 13px; }

/* Health list */
.health { display: flex; flex-direction: column; gap: 5px; }
.health .h { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.health .h.ok { color: var(--success); }
.health .h.warn { color: var(--warn); }
.health .h.err { color: var(--danger); }

/* Live log */
.log-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

/* Watermark preview */
.wm-preview {
  position: relative; height: 180px; margin-top: 16px; border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(135deg, #2a3140, #46536b 45%, #2f6b52); border: 1px solid var(--border);
}
.wm-preview span { position: absolute; font-weight: 700; white-space: nowrap; }

/* Auth */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 18px; }

/* Reveal */
.reveal { animation: reveal .5s cubic-bezier(.16,1,.3,1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .btn:hover { transform: none; }
}

/* Light theme */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #eaeef5;
  --border: #dde3ec;
  --border-strong: #cbd3e0;
  --text: #1b2330;
  --muted: #5c6779;
  --muted-2: #8a93a4;
  --accent: #d98a00;
  --accent-2: #f0a52a;
  --accent-soft: rgba(217, 138, 0, 0.13);
  --on-accent: #ffffff;
  --success: #1f9d6b;
  --success-soft: rgba(31, 157, 107, 0.12);
  --warn: #b9860b;
  --warn-soft: rgba(185, 134, 11, 0.13);
  --danger: #d64545;
  --danger-soft: rgba(214, 69, 69, 0.1);
  --info: #2a7fb8;
  --info-soft: rgba(42, 127, 184, 0.1);
  --shadow: 0 16px 40px -24px rgba(30, 40, 60, 0.35);
  --input-bg: #ffffff;
  --surface-end: #f8fafc;
  --hover-bg: #e7ecf4;
  --hover-border: #b9c4d6;
  --popover-bg: #ffffff;
  --row-hover: rgba(20, 30, 50, 0.045);
  --text-soft: #3d4a5c;
}
[data-theme="light"] body {
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(240, 165, 42, 0.12), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(42, 127, 184, 0.08), transparent 55%),
    var(--bg);
}
[data-theme="light"] .app-header { background: rgba(255, 255, 255, 0.85); }
[data-theme="light"] .brand .mark { color: #fff; }
[data-theme="light"] .wm-preview { border-color: var(--border-strong); }
[data-theme="light"] .msg.info { color: #0f6b4a; }
[data-theme="light"] .msg.error { color: #9b1c1c; }
[data-theme="light"] .brand .mark { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 8px 18px -10px rgba(217,138,0,.8); }
[data-theme="light"] .nav a:hover { color: var(--text); }
[data-theme="light"] .nav a.active { color: #fff; }
[data-theme="light"] .btn.primary { color: #fff; }

@media (max-width: 760px) {
  .app-header { padding: 12px 16px; }
  .nav { width: 100%; margin-inline-start: 0; }
  .container { padding: 20px 16px 60px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
