@import url('https://fonts.googleapis.com/css2?family=Rye&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --hq-bg: #eceff3;
  --hq-main: #f4f6f8;
  --hq-panel: #fff;
  --hq-text: #1f2328;
  --hq-muted: #66707a;
  --hq-line: #e4e7ec;
  --hq-line-2: #eef1f4;
  --hq-input: #fff;
  --hq-side: #2c3035;
  --hq-side-text: #d5dbe3;
  --hq-side-muted: #8b949e;
  --hq-side-hover: #3a4048;
  --hq-accent: #c0392b;
  --hq-ok: #1f9d55;
  --hq-danger: #b42318;
  --hq-top-btn: #3d444c;
  --hq-off: #f3f4f6;
}
html.hq-dark {
  --hq-bg: #101216;
  --hq-main: #12151a;
  --hq-panel: #1b2027;
  --hq-text: #e8edf2;
  --hq-muted: #9aa3ad;
  --hq-line: #2c333c;
  --hq-line-2: #252b33;
  --hq-input: #15191f;
  --hq-side: #0d0f12;
  --hq-side-text: #c9d0d8;
  --hq-side-muted: #7d8691;
  --hq-side-hover: #1c232c;
  --hq-accent: #c0392b;
  --hq-ok: #3dd68c;
  --hq-danger: #ff6b6b;
  --hq-top-btn: #2a3139;
  --hq-off: #171b21;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.hq {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--hq-text);
  background: var(--hq-bg);
  font: 16px/1.45 'Source Sans 3', sans-serif;
}
a { color: var(--hq-text); }

.hq-login {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #1f2328;
}
.hq-login .hq-login-card { margin: auto; }
.hq-login .hq-foot { background: #1f2328; color: #8b949e; }
.hq-login-card {
  width: min(380px, calc(100% - 32px));
  padding: 36px 32px;
  text-align: center;
  color: #1f2328;
  background: #fff;
  border-radius: 8px;
}
.hq-login-card img { width: 72px; height: 72px; object-fit: contain; }
.hq-login-card h1 { margin: 12px 0 4px; font: 400 28px/1 'Rye', Georgia, serif; }
.hq-login-card p { margin: 0 0 18px; color: #66707a; }
.hq-login-card strong { display: block; margin-bottom: 10px; color: #b42318; }
.hq-login-card input,
.hq-login-card button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font: 16px 'Source Sans 3', sans-serif;
}
.hq-login-card button {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
  cursor: pointer;
  font-weight: 700;
}

.hq-top {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 56px;
  padding: 0 18px;
  color: #fff;
  background: var(--hq-side);
}
.hq-brand { display: flex; align-items: center; gap: 10px; }
.hq-brand img { width: 34px; height: 34px; object-fit: contain; }
.hq-brand strong { font: 400 18px/1 'Rye', Georgia, serif; }
.hq-online { color: var(--hq-side-muted); font-size: 14px; }
.hq-online b { color: #fff; }
.hq-who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hq-who a,
.hq-theme {
  padding: 6px 12px;
  color: #fff;
  background: var(--hq-top-btn);
  border: 0;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  font: 14px 'Source Sans 3', sans-serif;
}
.hq-theme { min-width: 40px; }

.hq-foot {
  padding: 14px 18px;
  text-align: center;
  color: var(--hq-side-muted);
  background: var(--hq-side);
  font-size: 12px;
  letter-spacing: .02em;
}
.hq-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); flex: 1; }
.hq-side {
  color: var(--hq-side-text);
  background: var(--hq-side);
  padding: 12px 0 32px;
}
.hq-side p {
  margin: 16px 16px 6px;
  color: var(--hq-side-muted);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hq-side nav { display: grid; }
.hq-side a,
.hq-side span.is-off {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 16px;
  color: var(--hq-side-text);
  text-decoration: none;
  line-height: 1.25;
}
.hq-side a:hover { background: var(--hq-side-hover); }
.hq-side a.is-on { color: #fff; background: var(--hq-accent); }
.hq-side span.is-off {
  color: #6d7680;
  opacity: .55;
  cursor: not-allowed;
  user-select: none;
}

.hq-cards span.is-off {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  color: var(--hq-muted);
  background: var(--hq-off);
  border: 1px dashed var(--hq-line);
  border-radius: 8px;
  cursor: not-allowed;
}

.hq-users {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.hq-user-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-user-list a {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
}
.hq-user-list a strong { font-size: 14px; }
.hq-user-list a small { color: var(--hq-muted); font-size: 12px; }
.hq-user-list a:hover { background: var(--hq-off); }
.hq-user-list a.is-on { color: #fff; background: var(--hq-accent); }
.hq-user-list a.is-on small { color: rgba(255,255,255,.8); }
.hq-sub {
  margin: 8px 0 10px;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hq-muted);
  font-weight: 700;
}
.hq-switch-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
.hq-switch-board section {
  padding: 12px;
  background: var(--hq-off);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-switch-board h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--hq-muted);
}
.hq-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  font-size: 14px;
}
.hq-switch input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--hq-accent);
}

.hq-ok-msg { color: var(--hq-ok); font-weight: 700; }

.hq-main {
  padding: 28px 32px 48px;
  background: var(--hq-main);
}
.hq-title {
  margin: 0 0 8px;
  font: 400 28px/1.1 'Rye', Georgia, serif;
}
.hq-lead { margin: 0 0 18px; color: var(--hq-muted); }
.hq-error { color: var(--hq-danger); }

.hq-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}
.hq-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hq-stats article {
  padding: 16px;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-stats span { display: block; color: var(--hq-muted); font-size: 13px; }
.hq-stats strong { font-size: 22px; }

.hq-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 28px;
}
.hq-cards a {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.hq-cards a i { font-size: 22px; }
.hq-cards a small { display: block; color: var(--hq-muted); font-size: 12px; font-weight: 400; }
.hq-cards a:hover { border-color: var(--hq-accent); }

.hq-table-wrap {
  overflow: auto;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-table { width: 100%; border-collapse: collapse; }
.hq-table th, .hq-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hq-line-2);
  text-align: left;
  vertical-align: top;
}
.hq-table th { color: var(--hq-muted); font-weight: 600; background: var(--hq-off); }
.hq-table small { color: var(--hq-muted); }

.hq-app, .hq-fresh, .hq-form {
  margin: 0 0 14px;
  padding: 16px;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-form h2 { margin: 0 0 10px; font-size: 20px; }
.hq-app header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hq-app small { color: var(--hq-muted); }
.hq-flag { margin-left: 8px; color: var(--hq-danger); font-style: normal; font-weight: 700; }
.hq-app-actions, .hq-form-row, .hq-search, .hq-codes, .hq-note { display: flex; flex-wrap: wrap; gap: 8px; }
.hq-btn, .hq-form button, .hq-search button, .hq-note button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--hq-text);
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  font: 600 13px 'Source Sans 3', sans-serif;
}
.hq-ok { color: #fff; background: #1f9d55; border-color: #1f9d55; }
.hq-warn { color: #fff; background: #b42318; border-color: #b42318; }
.hq-danger { color: var(--hq-danger); }
.hq-form label, .hq-note label, .hq-search input, .hq-form input, .hq-form select, .hq-form textarea, .hq-note textarea {
  display: grid;
  gap: 4px;
  flex: 1 1 180px;
  font-size: 13px;
  color: var(--hq-muted);
}
.hq-form input, .hq-form select, .hq-form textarea, .hq-note textarea, .hq-search input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--hq-text);
  background: var(--hq-input);
  border: 1px solid var(--hq-line);
  border-radius: 6px;
  font: 15px 'Source Sans 3', sans-serif;
}
.hq-form textarea, .hq-note textarea { min-height: 88px; }
.hq-search { margin: 0 0 18px; }
.hq-codes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hq-codes li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-codes .is-used { opacity: .62; }
.hq-codes form { margin: 0; }

.hq-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 24, 28, .55);
  z-index: 40;
}
.hq-modal[hidden] { display: none !important; }
.hq-modal-card {
  width: min(640px, calc(100% - 32px));
  max-height: 86vh;
  overflow: auto;
  padding: 22px;
  background: var(--hq-panel);
  color: var(--hq-text);
  border-radius: 10px;
}
.hq-modal-card p { margin: 0 0 10px; }
.hq-modal-card strong { display: block; color: var(--hq-muted); font-size: 12px; }

.hq-ptero { display: grid; gap: 14px; }
.hq-ptero-card {
  padding: 16px;
  background: var(--hq-panel);
  border: 1px solid var(--hq-line);
  border-radius: 8px;
}
.hq-ptero-card header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hq-ptero-state { color: var(--hq-muted); font-weight: 700; }
.hq-ptero-state.is-on { color: var(--hq-ok); }
.hq-ptero-meta { color: var(--hq-muted); }
.hq-console-wrap {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #11151a;
  border: 1px solid var(--hq-line);
  border-radius: 8px;
  color: #d7e0e8;
}
.hq-console-wrap header { display: flex; justify-content: space-between; gap: 12px; }
.hq-console-log {
  margin: 0;
  min-height: 420px;
  max-height: 62vh;
  overflow: auto;
  padding: 10px;
  background: #0b0e12;
  color: #c8f0c8;
  font: 13px/1.45 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.hq-console-form { display: flex; gap: 8px; }
.hq-console-form input {
  flex: 1;
  min-height: 40px;
  padding: 0 10px;
  color: #e8edf2;
  background: #151a21;
  border: 1px solid #2c333c;
  border-radius: 6px;
}

@media (max-width: 900px) {
  .hq-top, .hq-shell, .hq-users, .hq-switch-board { grid-template-columns: 1fr; }
  .hq-side { display: flex; overflow-x: auto; padding: 0; }
  .hq-side p { display: none; }
  .hq-side nav { display: flex; }
  .hq-side a { white-space: nowrap; }
  .hq-cards { grid-template-columns: 1fr 1fr; }
  .hq-main { padding: 18px 14px 32px; }
}
