:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --text: #111827;
  --muted: #667085;
  --line: #e5eaf2;
  --brand: #2f6fed;
  --brand-strong: #1f5fd5;
  --brand-soft: #eef5ff;
  --green: #139b66;
  --green-soft: #e9f8f1;
  --amber: #b46b00;
  --amber-soft: #fff4df;
  --red: #c33a3a;
  --shadow: 0 16px 40px rgba(25, 36, 61, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(320px, 1fr);
  align-items: center;
  gap: 64px;
  padding: 48px clamp(20px, 6vw, 96px);
}

.auth-panel,
.security-window,
.panel,
.stat-card,
.sidebar-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 32px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.eyebrow {
  margin: 24px 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.auth-copy,
.panel-heading p,
.stat-card p,
.sidebar-card p {
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.top-search span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 700;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-strong);
}

.secondary-btn,
.ghost-btn {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.ghost-btn {
  color: var(--muted);
}

.bot-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--brand-soft);
}

.bot-note span {
  color: var(--brand);
  font-weight: 800;
}

.bot-note p {
  margin: 0;
  color: var(--muted);
}

.auth-preview {
  display: grid;
  place-items: center;
}

.security-window {
  width: min(100%, 520px);
  padding: 24px;
}

.window-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.security-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--panel-soft), var(--brand-soft));
}

.security-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.security-head strong {
  display: block;
  font-size: 18px;
}

.security-head p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.security-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.security-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.security-item strong {
  font-size: 15px;
}

.security-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--green-soft);
  border: 1px solid rgba(19, 155, 102, 0.18);
}

.security-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(19, 155, 102, 0.12);
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.sidebar-card {
  margin-top: 30px;
  padding: 16px;
  box-shadow: none;
}

.sidebar-card span,
.badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-card strong {
  display: block;
  margin-top: 12px;
}

.main-area {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.topbar {
  margin-bottom: 24px;
}

.topbar .eyebrow {
  margin-top: 0;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: end;
}

.top-search {
  min-width: 280px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 18px;
  box-shadow: none;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.stat-card p {
  margin: 8px 0 0;
  font-size: 13px;
}

.panel {
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: none;
}

.activity-bars {
  display: grid;
  grid-template-columns: repeat(10, minmax(22px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 130px;
  margin-top: 20px;
  padding-top: 10px;
}

.bar {
  display: grid;
  align-content: end;
  gap: 8px;
  min-width: 0;
}

.bar-fill {
  min-height: 10px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #5d8ff2 0%, var(--brand) 100%);
}

.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

th button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
  padding: 0;
}

tbody tr:hover {
  background: #fbfdff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.user-cell strong,
.nick-cell strong {
  display: block;
}

.user-cell span,
.log-line,
.date-cell span {
  color: var(--muted);
  font-size: 13px;
}

.log-line {
  max-width: 430px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.chip.auth {
  background: var(--green-soft);
  color: var(--green);
}

.chip.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.open-log {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand);
  padding: 8px 10px;
  font-weight: 800;
}

.empty-row {
  padding: 30px !important;
  color: var(--muted);
  text-align: center;
}

.log-dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

.log-dialog::backdrop {
  background: rgba(17, 24, 39, 0.35);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.dialog-inner {
  padding: 24px;
}

.dialog-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.meta-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meta-box strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.full-log {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  color: #e5eefc;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-card {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .auth-screen {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
  }

  .auth-preview {
    display: none;
  }

  .main-area,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .topbar-actions {
    display: grid;
    width: 100%;
  }

  .top-search {
    min-width: 0;
  }

  .sidebar-nav,
  .stats-grid,
  .filters,
  .dialog-meta {
    grid-template-columns: 1fr;
  }

  .activity-bars {
    grid-template-columns: repeat(5, minmax(22px, 1fr));
  }
}

.auth-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(195, 58, 58, 0.22);
  border-radius: var(--radius);
  background: #fff1f1;
  color: var(--red);
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.pagination {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.page-size {
  width: 140px;
}

.page-size select {
  height: 42px;
}

@media (max-width: 760px) {
  .pagination {
    display: grid;
    justify-content: stretch;
  }

  .page-size {
    width: 100%;
  }
}


.security-item-wide {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .security-item-wide {
    grid-column: span 1;
  }
}
