:root {
  --ink: #15181d;
  --muted: #667085;
  --line: #e1e6ee;
  --soft: #f6f8fb;
  --surface: #ffffff;
  --accent: #20242a;
  --danger: #a11420;
  --ok: #16794c;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: var(--accent);
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  color: var(--ink);
  font-size: 18px;
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.topnav form {
  margin: 0;
}

.topnav button,
.button,
.form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.topnav button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--accent);
  background: transparent;
}

.button.secondary {
  color: var(--accent);
  background: var(--surface);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
}

.shell-full {
  width: calc(100% - 12px);
  margin: 14px auto;
}

.manage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  color: #075bc4;
  background: #eff6ff;
  font-weight: 800;
}

.manage-banner form {
  margin: 0;
}

.manage-banner button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #075bc4;
  border-radius: var(--radius);
  color: #075bc4;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.panel {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-panel,
.form-panel {
  width: min(480px, 100%);
  padding: 24px;
}

.form-panel.wide {
  width: 100%;
  margin-bottom: 18px;
}

.auth-panel {
  margin: 64px auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-panel h1,
.install-panel h2 {
  margin: 0 0 8px;
}

.auth-panel p,
.install-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.form input,
.form textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
}

.form textarea {
  resize: vertical;
}

.form-note {
  margin-top: 16px;
}

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #f3c6cb;
  border-radius: var(--radius);
  color: var(--danger);
  background: #fff3f4;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 700;
}

.notice.ok {
  border: 1px solid #b9dfca;
  color: var(--ok);
  background: #eef9f3;
}

.notice.danger {
  border: 1px solid #f3c6cb;
  color: var(--danger);
  background: #fff3f4;
}

.muted {
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  text-decoration: none;
}

.tab.active {
  border-color: var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}

.settings-form {
  max-width: 620px;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  white-space: nowrap;
}

.actions form {
  margin: 0;
}

.actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}

.inline-form {
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
}

.admin-password-list {
  display: grid;
  gap: 10px;
}

.reset-password-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.reset-password-row button[data-open-reset] {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.install-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.install-panel {
  padding: 20px;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fafb;
}

.snippet-box {
  position: relative;
}

.snippet-box pre {
  padding-right: 76px;
  white-space: pre-wrap;
}

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.regenerate-box {
  display: block;
  margin-top: 14px;
}

.regenerate-box > button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 20, 25, 0.36);
}

.modal-backdrop[hidden] {
  display: none;
}

.confirm-modal {
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(16, 24, 40, 0.24);
}

.confirm-modal h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.confirm-modal p {
  margin: 0 0 18px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button-danger {
  border: 1px solid var(--danger);
  color: var(--danger);
}

.button-success {
  border: 1px solid var(--ok);
  color: var(--ok);
}

code {
  font-family: Consolas, Monaco, monospace;
}

.key-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.key-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.key-list dd {
  min-width: 0;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.visitors-panel {
  border-radius: 4px;
}

.visitors-table {
  table-layout: fixed;
}

.visitors-table .col-ip {
  width: 20%;
}

.visitors-table .col-device,
.visitors-table .col-last,
.visitors-table .col-first,
.visitors-table .col-events {
  width: 9%;
}

.visitors-table .col-details {
  width: 38%;
}

.visitors-table .col-status {
  width: 6%;
}

.visitors-table th {
  color: #0f1419;
  background: #eef4f2;
  text-transform: uppercase;
}

.visitors-table td {
  overflow-wrap: anywhere;
}

.mono-cell {
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

.cell-muted {
  display: block;
  color: var(--muted);
}

.details-cell {
  color: #111827;
  line-height: 1.25;
}

.detail-line {
  margin-bottom: 2px;
}

.muted-link {
  color: #667085;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-ok {
  background: #eef4f2;
}

.status-atentie {
  color: #7a4a00;
  background: #fff4d7;
}

.status-suspect {
  color: var(--danger);
  background: #fff3f4;
}

.mobile-visitor-row {
  display: none;
}

@media (max-width: 760px) {
  .topbar {
    align-items: center;
    flex-direction: column;
    justify-content: center;
    padding: 16px;
    text-align: center;
  }

  .brand {
    display: block;
    padding-top: 4px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }

  .install-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .sites-table,
  .sites-table tbody,
  .sites-table tr,
  .sites-table td {
    display: block;
    width: 100%;
  }

  .sites-table thead {
    display: none;
  }

  .sites-table tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  .sites-table td {
    display: grid;
    grid-template-columns: minmax(110px, 42%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  .sites-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }

  .sites-table td.actions {
    display: flex;
    padding-top: 12px;
  }

  .sites-table td.actions::before {
    content: none;
  }

  .shell-full {
    width: calc(100% - 16px);
    margin: 18px auto;
  }

  .visitors-table {
    min-width: 0;
  }

  .visitors-table colgroup,
  .visitors-table thead,
  .visitors-table tbody > tr:not(.mobile-visitor-row) {
    display: none;
  }

  .mobile-visitor-row {
    display: table-row;
  }

  .mobile-ip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-toggle {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--accent);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-visitor-row.is-open .mobile-toggle {
    transform: rotate(180deg);
  }

  .mobile-visitor-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: #111827;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .mobile-visitor-row.is-open .mobile-visitor-details {
    display: grid;
    gap: 8px;
  }

  .manage-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}
