:root {
  --bg: #eef3fb;
  --ink: #162032;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.24);
  --panel: rgba(255, 255, 255, 0.92);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --danger: #c2410c;
  --danger-soft: rgba(251, 146, 60, 0.14);
  --success: #15803d;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 24%),
    linear-gradient(180deg, #eef4fb 0%, #f7faff 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.table-card,
.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(520px, 100%);
  padding: 30px;
  border-radius: 28px;
}

.eyebrow {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
}

.login-card h1,
.topbar h1,
.table-head h2 {
  margin: 16px 0 0;
  font-size: 2rem;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.login-card p,
.table-head p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(191, 219, 254, 0.7);
  background: #fff;
  font: inherit;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(191, 219, 254, 0.7);
}

.btn-ghost.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.24);
}

.btn-notify {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.btn-install {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-notify.is-enabled {
  background: rgba(21, 128, 61, 0.12);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.24);
}

.btn-notify:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.alert {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
}

.alert-error {
  background: rgba(254, 226, 226, 0.9);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.24);
}

.alert-success {
  background: rgba(220, 252, 231, 0.9);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 8px;
}

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

.whoami {
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard {
  padding: 8px 32px 32px;
  display: grid;
  gap: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.summary-card {
  border-radius: 22px;
  padding: 18px;
}

.summary-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-value {
  margin-top: 10px;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.table-card {
  border-radius: 24px;
  padding: 20px;
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 20px;
}

.profile-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.profile-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-form input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(191, 219, 254, 0.7);
  background: #fff;
  font: inherit;
}

.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(191, 219, 254, 0.42);
  background: #fff;
}

.event-row.is-failed-login {
  background: rgba(254, 242, 242, 0.96);
}

.event-row.is-blocked-attempt {
  background: rgba(254, 226, 226, 0.98);
}

.event-row.is-successful-login {
  background: rgba(240, 253, 244, 0.96);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-action {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  background: rgba(248, 250, 252, 0.88);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.password-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.state-pill {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(254, 226, 226, 0.82);
  color: #991b1b;
  font-size: 0.74rem;
  font-weight: 700;
}

.state-pill.is-blocked {
  background: rgba(252, 165, 165, 0.42);
  color: #7f1d1d;
}

.state-pill.is-success {
  background: rgba(220, 252, 231, 0.95);
  color: #166534;
}

.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.96);
  color: #9a3412;
  border: 1px solid rgba(251, 146, 60, 0.24);
  font-size: 0.74rem;
  font-weight: 700;
}

.countdown-pill.is-expired {
  background: rgba(220, 252, 231, 0.92);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.22);
}

.countdown-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.row-action {
  margin: 0;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

code {
  background: rgba(226, 232, 240, 0.72);
  padding: 2px 6px;
  border-radius: 8px;
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .dashboard {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    align-items: flex-start;
    padding-top: 18px;
    gap: 14px;
  }

  .topbar h1 {
    font-size: 1.7rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
    gap: 10px;
  }

  .topbar-actions .btn,
  .topbar-actions .whoami {
    width: 100%;
  }

  .whoami {
    padding: 0 4px;
  }

  .table-card,
  .profile-card,
  .summary-card,
  .login-card {
    border-radius: 20px;
    padding: 16px;
  }

  .table-head {
    flex-direction: column;
    align-items: stretch;
  }

  .table-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.42);
    background: #fff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.07);
  }

  td {
    display: grid;
    grid-template-columns: minmax(84px, 96px) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: none;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  td[data-label="Action"] {
    grid-template-columns: 1fr;
    padding-top: 10px;
  }

  td[data-label="Action"]::before {
    margin-bottom: 2px;
  }

  .row-actions {
    width: 100%;
    flex-direction: column;
  }

  .row-action,
  .row-action .btn {
    width: 100%;
  }

  .notify-toast {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }
}

.notify-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notify-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.notify-toast.is-success {
  background: rgba(21, 128, 61, 0.94);
}

.notify-toast.is-error {
  background: rgba(185, 28, 28, 0.96);
}

.notify-toast.is-info {
  background: rgba(37, 99, 235, 0.96);
}
