:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #dce3ee;
  --line-strong: #cbd5e1;
  --sidebar: #060b17;
  --sidebar-line: #1b2233;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #027a48;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 650;
}

button:hover {
  background: var(--accent-strong);
}

button.ghost {
  background: #eef3fb;
  color: #1e293b;
}

button.ghost:hover {
  background: #e2e8f0;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 24% 18%, rgba(37, 99, 235, 0.12), transparent 32%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  justify-self: center;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 28px;
  text-align: center;
}

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

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

.brand {
  height: 88px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: block;
  flex: 0 0 auto;
}

.brand strong {
  font-size: 16px;
}

nav {
  display: grid;
  gap: 6px;
  padding: 18px 14px;
}

.nav {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  color: #aab4c4;
  border-radius: 8px;
  padding: 0 14px;
  text-align: left;
}

.nav.active,
.nav:hover {
  background: #111827;
  color: #fff;
}

main {
  min-width: 0;
  padding: 0 32px 32px;
}

.topbar {
  height: 88px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin: 0 -32px 28px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.user-menu {
  position: relative;
}

.user-pill {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  padding: 4px 7px 4px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.user-pill:hover {
  background: #fff;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
}

.user-popover {
  position: absolute;
  top: 52px;
  right: 0;
  width: 220px;
  display: grid;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.user-popover span {
  color: var(--muted);
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.metric b {
  display: block;
  font-size: 28px;
  margin-bottom: 5px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.overview-grid,
.analysis-grid,
.settings-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  padding: 18px;
}

.overview-grid > div,
.analysis-grid > div,
.settings-list > div {
  display: grid;
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.eyebrow,
.settings-list span {
  color: var(--muted);
  font-size: 13px;
}

.overview-grid strong,
.analysis-grid strong,
.settings-list strong {
  font-size: 20px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}

td.actions {
  display: flex;
  gap: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.status.success,
.status.logged_in,
.status.active {
  background: #ecfdf3;
  color: var(--ok);
}

.status.failed,
.status.expired {
  background: #fef3f2;
  color: var(--danger);
}

.status.pending,
.status.accepted,
.status.running {
  background: #fffaeb;
  color: var(--warn);
}

dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(560px, calc(100vw - 28px));
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.modal-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .brand {
    height: 72px;
  }

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

  main {
    padding: 0 16px 24px;
  }

  .topbar {
    margin: 0 -16px 20px;
    padding: 0 16px;
  }

  .metrics,
  .overview-grid,
  .settings-list,
  .grid2 {
    grid-template-columns: 1fr;
  }
}
