/* BuryGram Account Manager — restrained, utilitarian UI.
   Flat surfaces, one accent, system font, small radii. No gradients/glass. */

:root {
  --bg:            #0c0d0f;
  --surface:       #141518;
  --surface-2:     #191b1f;
  --surface-3:     #1f2227;
  --border:        #26292f;
  --border-strong: #343941;
  --text:          #e3e5e8;
  --muted:         #8a9099;
  --muted-2:       #666d77;
  --accent:        #5c8df6;
  --accent-hover:  #4a7ce6;
  --green:         #3fb950;
  --red:           #e5534b;
  --radius:        8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

/* ------------------------------------------------------------- shell ---- */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
}
.brand-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.brand-name small {
  display: block; font-size: 11px; font-weight: 400; color: var(--muted);
}
.topnav { display: flex; align-items: center; gap: 14px; }
.navlink { font-size: 13px; color: var(--muted); }
.navlink:hover { color: var(--text); text-decoration: none; }
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
}
.user-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
}
.main { flex: 1; }

/* ---------------------------------------------------------- surfaces ---- */
.glass, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel { margin-bottom: 16px; }
.panel-hd {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.panel-bd { padding: 14px; }
.panel-pad { padding: 8px; }
.toolbar-bd { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); font-weight: 400; }

/* ----------------------------------------------------------- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------ fields ---- */
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-hint { display: block; font-size: 11px; color: var(--muted-2); margin-top: 5px; }
.input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #0e0f12;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted-2); }

/* ------------------------------------------------------------ alerts ---- */
.alert {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  color: #f0b8b3;
  background: rgba(229, 83, 75, .1);
  border: 1px solid rgba(229, 83, 75, .35);
}
.note {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
}

/* -------------------------------------------------------------- auth ---- */
.auth-wrap { display: flex; justify-content: center; padding: 24px 0 40px; }
.auth-card { width: 100%; max-width: 380px; padding: 24px; }
.auth-head { margin-bottom: 18px; }
.auth-head h1 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.auth-head p { margin: 0; font-size: 13px; color: var(--muted); }
.auth-alt {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.auth-card .btn-block { margin-top: 4px; }

/* ------------------------------------------------------------- hero ----- */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.hero-text h1 { margin: 0 0 4px; font-size: 21px; font-weight: 600; }
.sub { margin: 0; font-size: 13px; color: var(--muted); }
.sub b { color: var(--text); font-weight: 600; }
.hero-phone {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px !important;
  font-weight: 500;
  color: var(--text);
}
.hero-actions { display: flex; align-items: center; gap: 12px; }
.stamp { font-size: 12px; color: var(--muted-2); }
.backlink {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.backlink:hover { color: var(--text); }

/* ------------------------------------------------------------ cards ----- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.acct-card { padding: 16px; }
.acct-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.acct-index { font-size: 12px; color: var(--muted-2); }
.acct-badge {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.acct-phone {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.acct-meta { font-size: 12px; color: var(--muted-2); margin-bottom: 14px; }

/* ------------------------------------------------------------ empty ----- */
.empty {
  padding: 44px 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.empty-inline { padding: 36px 20px; }
.empty-icon { color: var(--muted-2); margin-bottom: 12px; }
.empty h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.empty p { margin: 0; font-size: 13px; color: var(--muted); max-width: 420px; }

/* ------------------------------------------------------------ codes ----- */
.codes { padding: 4px; }
.code-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 12px;
  border-radius: 6px;
}
.code-row + .code-row { border-top: 1px solid var(--border); }
.code-row:hover { background: var(--surface-2); }
.code-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.code-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.code-type { font-size: 12px; color: var(--muted); white-space: nowrap; }
.code-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.code-time { font-size: 12.5px; color: var(--text); }
.code-exp { font-size: 11.5px; color: var(--muted-2); }

/* ------------------------------------------------------------ modal ----- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0, 0, 0, .62);
}
.overlay[hidden] { display: none; }
.overlay-dark { background: rgba(0, 0, 0, .78); }
.modal { width: 100%; max-width: 400px; padding: 20px; }
.modal-head { margin-bottom: 16px; }
.modal-head h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.modal-head p { margin: 0; font-size: 13px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* -------------------------------------------------- generation modal ---- */
.modal-gen {
  width: 100%; max-width: 400px;
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.gen-title {
  font-size: 12px; font-weight: 500; color: var(--muted);
  margin-bottom: 18px;
}
.gen-screen {
  display: flex; align-items: center; justify-content: center; gap: 1px;
  padding: 18px 10px;
  background: #0e0f12;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.gen-prefix, .gen-digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
}
.gen-bar {
  height: 4px; margin-top: 16px; border-radius: 2px; overflow: hidden;
  background: var(--surface-3);
}
.gen-bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  transition: width .12s linear;
}
.gen-status {
  margin-top: 12px; min-height: 16px;
  font-size: 12px; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ----------------------------------------------------------- footer ----- */
.footer {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: center;
  font-size: 12px; color: var(--muted-2);
}
.footer .dot { opacity: .5; }

/* ------------------------------------------------------------- docs ----- */
.docs-hero { padding: 22px 22px 20px; margin-bottom: 14px; }
.docs-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.docs-hero h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.docs-lead { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); max-width: 720px; }
.docs-base {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.docs-base code { color: var(--text); }

.docs-toc {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px; margin-bottom: 14px;
}
.docs-toc a {
  font-size: 12px; color: var(--muted);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.docs-toc a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.docs-section { padding: 18px 20px; margin-bottom: 14px; scroll-margin-top: 16px; }
.docs-section h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.docs-section p, .docs-section li { font-size: 13.5px; color: var(--text); line-height: 1.6; }
.docs-section ul, .docs-section ol { margin: 8px 0; padding-left: 20px; }
.docs-section li { margin: 3px 0; }
.docs-section code {
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}
.docs-section pre {
  margin: 10px 0;
  padding: 12px 14px;
  overflow-x: auto;
  background: #0e0f12;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.docs-section pre code {
  background: none; border: none; padding: 0;
  font-size: 12px; line-height: 1.55; color: #cfd4da;
  white-space: pre;
}
.docs-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.docs-table th, .docs-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.docs-table th { background: var(--surface-2); color: var(--text); font-weight: 600; }
.docs-table td { color: var(--muted); }
.docs-table td code { white-space: nowrap; }

/* -------------------------------------------------------- responsive ---- */
@media (max-width: 620px) {
  .app { padding: 0 14px 32px; }
  .hero h1 { font-size: 19px; }
  .hero-phone { font-size: 16px !important; }
  .code-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .code-right { align-items: flex-start; text-align: left; }
  .docs-hero { padding: 18px 16px; }
  .docs-section { padding: 14px 14px; }
}
