/* ==========================================================================
   Secret gate + sensitive management panels
   ========================================================================== */

/* --- Secret gate --- */
.secret-gate { min-height: 60vh; display: grid; place-items: center; padding: var(--sp-6) 0; }
.secret-card {
  width: 100%; max-width: 440px; text-align: center;
  padding: var(--sp-7); border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface), var(--bg-alt));
  box-shadow: var(--shadow-lg);
}
.secret-card--rotated { max-width: 520px; text-align: left; }
.secret-card__lockwrap {
  position: relative; width: 68px; height: 68px; margin: 0 auto var(--sp-4);
  display: grid; place-items: center; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold); border: 1px solid var(--border-gold);
}
.secret-card--rotated .secret-card__lockwrap { margin: 0 0 var(--sp-4); }
.secret-card__lockwrap--warn { background: var(--success-soft); color: var(--success); border-color: transparent; }
.secret-card__badge { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--gold); }
.secret-card h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.secret-card__sub { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-5); }
.secret-card .field { margin-bottom: var(--sp-3); }
.secret-card .input { text-align: center; letter-spacing: 0.05em; }
.secret-link { display: block; margin: var(--sp-4) auto 0; color: var(--gold); font-size: var(--fs-sm); font-weight: 500; }
.secret-link:hover { color: var(--text); }
.secret-note { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-4); }
.secret-error { display: none; align-items: center; gap: 8px; justify-content: center; color: #ffb3b7; background: var(--danger-soft); border: 1px solid rgba(229,72,77,0.3); border-radius: var(--radius); padding: 8px 12px; font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.secret-warn { display: flex; gap: 10px; align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); font-size: var(--fs-sm); margin-bottom: var(--sp-5); }
.secret-warn span { color: var(--text-secondary); }
.secret-key { margin-bottom: var(--sp-4); }
.secret-key__label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-wide); color: var(--text-muted); margin-bottom: 6px; }
.secret-key__row { display: flex; gap: var(--sp-2); align-items: stretch; }
.secret-key__val { flex: 1; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); font-family: var(--font-mono); color: var(--gold); word-break: break-all; font-size: var(--fs-sm); }
.secret-confirm { margin: var(--sp-4) 0; }

/* --- Shared panel layout --- */
.panel-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-top: var(--sp-5); align-items: start; }

/* --- Services (Website Management) --- */
.svc-list { display: flex; flex-direction: column; }
.svc-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.svc-row:last-child { border-bottom: none; }
.svc-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.svc-dot--ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.svc-dot--off { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.svc-name { flex: 1; color: var(--text); font-size: var(--fs-sm); }
.svc-status { color: var(--text-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-wide); }

/* --- Terminal --- */
.term { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.term__head { display: flex; align-items: center; gap: 8px; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); color: var(--text-secondary); font-weight: 600; font-size: var(--fs-sm); }
.term__out { flex: 1; min-height: 220px; max-height: 320px; overflow-y: auto; padding: var(--sp-4); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-secondary); background: #01060c; }
.term__line { padding: 1px 0; white-space: pre-wrap; word-break: break-word; }
.term__line--sys { color: var(--text-muted); }
.term__prompt { color: var(--success); }
.term__result { margin: 2px 0 8px; color: var(--text); white-space: pre-wrap; }
.term__result--err { color: var(--danger); }
.term__inputrow { display: flex; align-items: center; gap: 8px; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); background: #01060c; }
.term__inputrow .term__prompt { font-family: var(--font-mono); }
.term__input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: var(--font-mono); font-size: var(--fs-sm); }

/* --- Permission matrix --- */
.perm-table { width: 100%; border-collapse: collapse; min-width: 620px; }
.perm-table th { text-align: center; padding: var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; }
.perm-th-rank { text-align: left !important; }
.perm-table td { padding: var(--sp-2) var(--sp-3); text-align: center; border-bottom: 1px solid var(--border); }
.perm-table tbody tr:hover { background: var(--surface-2); }
.perm-rank { text-align: left !important; color: var(--text); font-weight: 500; }
.perm-rank small { display: block; color: var(--text-muted); font-size: 10px; font-weight: 400; }

/* Switch toggle */
.switch { display: inline-block; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { display: block; width: 40px; height: 22px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border-strong); position: relative; transition: background var(--transition-fast), border-color var(--transition-fast); }
.switch__thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform var(--transition), background var(--transition); }
.switch input:checked + .switch__track { background: var(--primary-soft); border-color: var(--primary); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(18px); background: var(--primary); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--primary-ring); outline-offset: 2px; }

/* --- Bot control --- */
.bot-control__head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.bot-control__head h3 { font-size: var(--fs-md); }
.bot-control__head .dash-status { margin-left: auto; }
.bot-control__btns { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* --- Config editor + files --- */
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-list__item { display: flex; align-items: center; gap: 8px; padding: var(--sp-3); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: var(--fs-sm); text-align: left; }
.file-list__item:hover { background: var(--surface-2); color: var(--text); }
.file-list__item.is-active { background: var(--primary-soft); color: var(--text); }
.file-list__item .msym { color: var(--text-muted); }
.config-editor__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.code-area { min-height: 300px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.5; resize: vertical; white-space: pre; }
.config-editor .btn { margin-top: var(--sp-3); }

.fm-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); font-size: var(--fs-sm); padding: 3px 8px; border-radius: var(--radius-sm); }
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb-sep { color: var(--text-muted); }
.fm-list { display: flex; flex-direction: column; gap: 2px; }
.fm-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--radius-sm); color: var(--text-secondary); text-align: left; }
.fm-row:hover { background: var(--surface-2); color: var(--text); }
.fm-row .msym { color: var(--gold); }
.fm-row--up .msym { color: var(--text-muted); }
.fm-row__name { flex: 1; font-size: var(--fs-sm); }
.fm-row__type { color: var(--text-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-wide); }
.code-view { max-height: 60vh; overflow: auto; padding: var(--sp-4); background: #01060c; border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-secondary); white-space: pre-wrap; }

@media (max-width: 820px) {
  .panel-split { grid-template-columns: 1fr; }
}
