/* telegram-notify admin
   One accent, a strict spacing scale, and monospace anywhere a value gets
   copied. Light and dark share one set of tokens. */

:root {
  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #f0f2f5;
  --border:    #e2e5ea;
  --border-2:  #cfd4dc;
  --text:      #16191d;
  --text-2:    #5b6472;
  --text-3:    #8b95a3;
  --accent:    #3b5bdb;
  --accent-2:  #edf0fd;
  --ok:        #17803d;
  --ok-bg:     #e8f6ec;
  --warn:      #a05e03;
  --warn-bg:   #fdf3e2;
  --bad:       #c0392b;
  --bad-bg:    #fdecea;

  --r:    8px;
  --r-sm: 5px;
  --sp:   4px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1216;
    --surface:   #171b21;
    --surface-2: #1e232b;
    --border:    #272d36;
    --border-2:  #39414d;
    --text:      #e8eaed;
    --text-2:    #a3adbb;
    --text-3:    #6f7987;
    --accent:    #748ffc;
    --accent-2:  #1c2333;
    --ok:        #51cf66;
    --ok-bg:     #14291a;
    --warn:      #ffc078;
    --warn-bg:   #2b2113;
    --bad:       #ff8787;
    --bad-bg:    #2d1719;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 22px; font-weight: 620; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-2); }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px 20px;
  font-weight: 640;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  flex: 0 0 9px;
}
.brand small {
  display: block;
  font-weight: 450;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0;
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-2); color: var(--accent); font-weight: 560; }
.nav .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.sidebar-foot .who { color: var(--text-2); margin-bottom: 6px; word-break: break-all; }

.main { flex: 1; min-width: 0; padding: 28px 32px 64px; max-width: 1240px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head .sub { color: var(--text-2); font-size: 13px; }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 18px;
}
.card.tight { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 640; font-family: var(--mono); letter-spacing: -0.02em; margin-top: 3px; }
.stat .v.ok   { color: var(--ok); }
.stat .v.bad  { color: var(--bad); }
.stat .v.warn { color: var(--warn); }
.stat .note { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--mono); }
.mono { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--text-3); }

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-weight: 560; margin-bottom: 4px; }

/* ---------- pills ---------- */

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}
.pill.ok    { background: var(--ok-bg);   color: var(--ok); }
.pill.bad   { background: var(--bad-bg);  color: var(--bad); }
.pill.warn  { background: var(--warn-bg); color: var(--warn); }
.pill.muted { background: var(--surface-2); color: var(--text-3); }

/* ---------- forms ---------- */

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 560; font-size: 12px; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; line-height: 1.45; }

input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
textarea { min-height: 110px; resize: vertical; font-family: var(--mono); line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-2);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 560;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--border-2); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- notices ---------- */

.notice {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}
.notice.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: currentColor; }
.notice.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: currentColor; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: currentColor; }

/* A value the user must copy now because it will not be shown again. */
.secret {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  word-break: break-all;
  user-select: all;
  margin: 6px 0;
}

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 7px 18px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- filters & paging ---------- */

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 150px; width: auto; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 350px; }
.login-card .brand { justify-content: center; padding-bottom: 22px; }

/* ---------- misc ---------- */

.htmx-request .spin { opacity: 1; }
.spin { opacity: 0; transition: opacity 0.15s; font-size: 12px; color: var(--text-3); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
}
pre {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px 16px 48px; }
}

/* The code the admin compares against what the bot shows. Spaced and oversized
   so a mismatch is obvious at a glance rather than needing to be read carefully. */
.logincode {
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 640;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--accent);
  background: var(--accent-2);
  border-radius: var(--r);
  padding: 16px 12px;
  user-select: all;
}

/* ---------- copy buttons ---------- */

.copywrap { position: relative; }
.copywrap > pre { margin-top: 0; }

.copybtn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, border-color 0.12s;
}
.copywrap:hover .copybtn,
.copybtn:focus-visible { opacity: 1; }
.copybtn:hover { color: var(--text); border-color: var(--text-3); }
.copybtn.copied { opacity: 1; color: var(--ok); border-color: var(--ok); }
.copybtn.copyfail { opacity: 1; color: var(--bad); border-color: var(--bad); }

/* On touch there is no hover, so the button has to be visible from the start. */
@media (hover: none) {
  .copybtn { opacity: 1; }
}

/* The secret block already has its own padding; keep the button clear of the text. */
.copywrap > .secret { padding-right: 104px; }
.copywrap > pre { padding-right: 104px; }
