:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #eef3f7;
  --ink: #10253a;
  --muted: #506578;
  --line: #d5e0ea;
  --accent: #0e7c66;
  --accent-2: #0c5a83;
  --warning: #8a5a00;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(16, 37, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #f8fafc, #edf2f7 55%, #e5edf5);
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.narrow {
  max-width: 760px;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn-outline {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.public-topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(3px);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
}

.brand-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--muted);
  max-width: 620px;
  line-height: 1.25;
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero {
  padding: 54px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: start;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.hero h1 {
  font-size: 2.2rem;
  margin: 0 0 10px;
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
}

.hero-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-card,
.legal,
.auth-card,
.error-card,
.panel,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 22px;
}

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

.legal {
  margin-top: 28px;
  margin-bottom: 38px;
  padding: 30px;
  line-height: 1.55;
}

.auth-card,
.error-card {
  margin: 46px auto;
  padding: 26px;
}

.alert {
  padding: 12px;
  border-radius: 10px;
  margin: 14px 0;
}

.alert-warning {
  background: #fff8eb;
  border: 1px solid #f4d7a3;
  color: var(--warning);
}

.public-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  color: var(--muted);
  background: #fff;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #09263a;
  color: #e6f1f8;
  padding: 26px 20px;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: 20px;
}

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

.sidebar-nav a {
  color: #d1e6f5;
  padding: 10px 12px;
  border-radius: 9px;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.app-main {
  padding: 22px;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.app-topbar h1 {
  margin: 0;
  font-size: 1.5rem;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-card {
  padding: 16px;
}

.stat-card h2 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-card p {
  margin: 10px 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.keyword-form {
  display: grid;
  gap: 10px;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 260px));
  gap: 12px;
}

.status-message {
  margin-top: 12px;
  padding: 11px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--muted);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1160px;
  background: #fff;
}

th,
td {
  border: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: #f3f8fc;
}

.placeholder-row {
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .sidebar {
    padding-bottom: 14px;
  }

  .app-main {
    padding: 16px;
  }

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

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

  .public-nav {
    gap: 10px;
  }

  .brand-subtitle {
    display: none;
  }
}
