:root {
  --primary: #4f46e5;
  --primary-dark: #3b3fc7;
  --bg: #f5f7fb;
  --card: #ffffff;
  --muted: #6c7686;
  --sidebar: #1a2339;
  --sidebar-soft: #f3f5ff;
  --border: #e9edf5;
  --success: #2ea36a;
  --warning: #eea23a;
  --danger: #dc4e5d;
  --text: #212b36;
  --shadow: 0 12px 30px rgba(33, 43, 54, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Public Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

button, input {
  font: inherit;
}

.auth-screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f7ff 0%, #eef2ff 100%);
}

.auth-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-wrapper {
  width: min(100%, 480px);
  padding: 24px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(95, 110, 150, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-body {
  padding: 24px 28px 28px;
}

.login-header h4 {
  margin: 0;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.brand-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
}

.brand-logo img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.brand-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  margin: 0 0 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.field-group input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 14px;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-group input:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.6);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-shell {
  display: none;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
}

.app-shell.active {
  display: flex;
}

.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: #eef2ff;
  padding: 18px 16px;
  position: relative;
}

.brand-panel {
  margin-bottom: 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-inline img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-icon {
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 12px;
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.04);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f8d399, #ff9a76);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #3a2a1f;
}

.page-content {
  padding: 26px 22px 36px;
}

.page-header {
  margin-bottom: 18px;
}

.page-header h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid rgba(95, 110, 150, 0.08);
  border-radius: 18px;
  box-shadow: 0 8px 18px rgba(33, 43, 54, 0.04);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #eef2ff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.stat-meta {
  flex: 1;
  text-align: right;
}

.stat-meta h3 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.stat-meta p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.card-panel {
  background: var(--card);
  border-radius: 18px;
  border: 1px solid rgba(95, 110, 150, 0.08);
  box-shadow: 0 8px 18px rgba(33, 43, 54, 0.04);
  overflow: hidden;
}

.panel-header {
  padding: 20px 22px 0;
}

.panel-header h4 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.form-panel {
  margin-bottom: 24px;
}

.data-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  padding: 0 22px 22px;
  align-items: end;
}

.data-form .btn {
  height: 46px;
}

.data-form .form-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--success);
  font-size: 0.9rem;
}

select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 14px;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  padding: 0 0 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

thead th {
  background: #f6f8ff;
  color: #485569;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
}

tbody tr:hover {
  background: rgba(79, 70, 229, 0.025);
}

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-new {
  background: rgba(235, 116, 104, 0.1);
  color: var(--danger);
}

.badge-dnc {
  background: rgba(220, 78, 93, 0.1);
  color: var(--danger);
}

.badge-approved {
  background: rgba(46, 163, 106, 0.12);
  color: var(--success);
}

.badge-callback {
  background: rgba(238, 162, 58, 0.12);
  color: var(--warning);
}

@media (max-width: 980px) {
  .app-shell,
  .app-shell.active {
    display: block;
  }

  .sidebar {
    width: 100%;
    padding-bottom: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .data-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 560px) {
  .auth-body {
    padding: 20px 18px 28px;
  }

  .login-header h4 {
    font-size: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .brand-link {
    flex-direction: column;
  }

  .data-form {
    grid-template-columns: 1fr;
  }
}
