/* Admin panel */
body { min-height: 100%; }
h1, h2 { margin: 0; }
h2 { font-size: 17px; }
code { background: var(--panel-3); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 18px; margin: 6px 0 8px; }
.form-error { color: var(--red); min-height: 18px; font-size: 13px; }

.a-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 20px;
  background: rgba(7,7,10,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.a-brand { display: flex; align-items: baseline; gap: 8px; }
.a-brand .logo-mark { font-size: 22px; }
.a-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; }
.a-nav { display: flex; gap: 4px; }
.a-nav button { height: 34px; padding: 0 12px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.a-nav button:hover { color: var(--text); }
.a-nav button.active { background: var(--panel-3); color: var(--text); }
.a-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(46,212,122,.2); }
.live-dot.reconnecting { background: #f5b942; }

.a-main { max-width: 1400px; margin: 0 auto; padding: 20px; }
.a-main section { display: flex; flex-direction: column; gap: 16px; }

.seg { display: inline-flex; gap: 2px; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.seg button { height: 28px; padding: 0 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.active { background: var(--panel-3); color: var(--text); }

/* add */
.add-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.add-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 220px; }
#add-single, #add-bulk { display: flex; flex-direction: column; gap: 10px; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-inline input { accent-color: var(--accent); }
.add-opts { justify-content: space-between; }
.bm-hint { font-size: 12.5px; }
.metric-hint { font-size: 12px; line-height: 1.5; }
.bm {
  display: inline-block; padding: 1px 9px; margin: 0 2px; border-radius: 7px; border: 1px dashed var(--accent);
  color: var(--accent); background: var(--accent-soft); font-weight: 600; text-decoration: none; cursor: grab;
}
.bulk-text { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.candidates { display: flex; flex-direction: column; gap: 8px; }
.cand {
  display: grid; grid-template-columns: 40px minmax(160px, 1.3fr) repeat(4, minmax(80px, .6fr)) minmax(170px, 1fr) auto; gap: 14px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border);
}
.cand .nm b { font-size: 15px; }
.cand .nm .addr { font-size: 12px; color: var(--dim); }
.cand-metrics { display: contents; }
.kv span { display: block; font-size: 11px; color: var(--muted); }
.kv b { font-size: 13.5px; }
.cand select { height: 32px; font-size: 12.5px; width: 100%; }
.cand-state { color: var(--muted); padding: 14px; text-align: center; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.bulk-results { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.bulk-results div { display: flex; gap: 8px; }
.bulk-results .ok { color: var(--green); }
.bulk-results .fail { color: var(--red); }
.bulk-results code { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* list */
.list-card { padding: 0; overflow: hidden; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; flex-wrap: wrap; }
.list-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.list-tools .input, .list-tools .btn { height: 34px; }
.table-wrap { overflow-x: auto; }
.tok-table { width: 100%; border-collapse: collapse; }
.tok-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tok-table td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.035); white-space: nowrap; }
.tok-table tr:last-child td { border-bottom: 0; }
.tok-table tbody tr:hover { background: rgba(255,255,255,.015); }
.tok-table .r { text-align: right; }
.tok-table .c { text-align: center; }
.w-drag { width: 28px; }
.drag { cursor: grab; color: var(--dim); user-select: none; font-size: 16px; letter-spacing: -3px; }
tr.dragging { opacity: .4; }
tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
tr.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
tr.hidden-row .tk { opacity: .45; }
.tk { display: flex; align-items: center; gap: 10px; }
.tk b { display: block; }
.tk .sub { font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.tk .addr { font-size: 11.5px; color: var(--dim); cursor: pointer; }
.tk .addr:hover { color: var(--text); }
.acts { display: inline-flex; gap: 2px; }
.acts .icon-btn { width: 30px; height: 30px; }
.acts .icon-btn svg { width: 16px; height: 16px; }
.acts .del:hover { color: var(--red); background: var(--red-bg); }
.tok-empty { padding: 30px; text-align: center; }
.hint { font-size: 12px; padding: 10px 18px 14px; }

/* status */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.stat-card { padding: 16px; }
.stat-card span { font-size: 12.5px; color: var(--muted); }
.stat-card b { display: block; font-size: 24px; margin-top: 4px; }
.stat-card small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.prov-table td:last-child { white-space: normal; color: var(--muted); font-size: 12.5px; max-width: 480px; word-break: break-word; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.warn { background: #33280b; color: #f5b942; }

/* settings */
.settings-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.help { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; overflow: auto; }
.modal { width: min(720px, 100%); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.edit-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.form-grid .input { color: var(--text); width: 100%; }
.span2 { grid-column: span 2; }
.img-row { display: flex; gap: 8px; align-items: center; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
  .a-top { gap: 12px; padding: 0 12px; overflow-x: auto; }
  .a-user .muted, .a-user a { display: none; }
  .a-main { padding: 12px; }
  .cand { grid-template-columns: 40px 1fr auto; }
  .cand-metrics { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cand select { grid-column: 1 / -1; }
  .cand > .btn { grid-column: 3; grid-row: 1; }
  .form-grid, .toggles { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}
