:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #1d4ed8;
  --green: #047857;
  --red: #dc2626;
  --yellow: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.brand {
  display: block;
  padding: 24px 20px;
  border-bottom: 1px solid var(--line);
}

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

.brand span,
.topbar span,
small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.sidebar nav {
  padding: 16px 12px;
  display: grid;
  gap: 4px;
  overflow-y: auto;
}

.sidebar nav a,
.logout button {
  border: 0;
  width: 100%;
  display: block;
  text-align: left;
  border-radius: 6px;
  padding: 10px 12px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar nav a:hover,
.sidebar nav a.active,
.logout button:hover {
  background: #f1f5f9;
  color: var(--text);
}

.logout {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.topbar {
  margin-left: 260px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.content {
  margin-left: 260px;
  padding: 28px;
  max-width: 1680px;
}

.page-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.page-header p {
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.6;
}

.actions,
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.inline {
  display: inline;
}

.button,
button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  height: 40px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  background: #020617;
  color: white;
}

.button.secondary:hover,
button:hover {
  background: #f8fafc;
}

.kpis,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.kpi,
.table-card,
.filters,
.alert-card,
.empty,
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.kpi {
  padding: 16px;
}

.kpi strong {
  display: block;
  font-size: 24px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.tabs {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.tabs a {
  padding: 10px 14px;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 700;
  color: #475569;
}

.tabs a.active {
  background: #020617;
  color: white;
}

.filters {
  padding: 14px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr repeat(4, auto);
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
}

.filters label {
  font-size: 14px;
  color: #475569;
  white-space: nowrap;
}

.filters input[type="checkbox"] {
  width: auto;
  height: auto;
}

.table-card {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #eef2f7;
  padding: 12px;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.short-url {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--blue);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #475569;
}

.badge.green,
.ok {
  color: var(--green);
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.badge.red,
.bad {
  color: var(--red);
  background: #fef2f2;
  border-color: #fecaca;
}

.badge.yellow {
  color: var(--yellow);
  background: #fffbeb;
  border-color: #fde68a;
}

.badge.blue {
  color: var(--blue);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.alert,
.empty,
.alert-card {
  padding: 16px;
  margin-bottom: 18px;
}

.alert.info {
  color: var(--blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

.alert.danger {
  color: var(--red);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.alert-card h2 {
  margin: 10px 0 4px;
  font-size: 16px;
}

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

.login-card {
  width: min(100%, 440px);
  padding: 28px;
}

.login-card h1 {
  margin: 8px 0;
}

.login-card p {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 8px;
  margin: 20px 0 12px;
  font-weight: 700;
}

.login-card .button {
  width: 100%;
}

.brand-small {
  color: var(--blue);
  font-weight: 700;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
  }

  .logout {
    display: none;
  }

  .topbar,
  .content {
    margin-left: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 18px 14px;
  }

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

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

  .page-header h1 {
    font-size: 26px;
  }
}

@media (max-width: 560px) {
  .kpis,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
