:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #637083;
  --line: #d9dee7;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #c2410c;
  --danger-hover: #9a3412;
  --focus: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 16px;
  flex: 1;
}

.nav a {
  color: var(--muted);
  font-weight: 600;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.language {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 8px;
}

.language.is-active {
  border-color: var(--primary);
  color: var(--primary);
}

.user-name {
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 32px;
}

.page-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-heading h1,
.auth-panel h1,
.form-panel h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

.page-heading p {
  color: var(--muted);
  margin: 0;
}

.auth-panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 48px auto 0;
  max-width: 440px;
  padding: 28px;
}

.form {
  display: grid;
  gap: 16px;
}

.form label,
.filters label {
  display: grid;
  gap: 6px;
}

.form span,
.filters span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--focus);
  outline: 2px solid rgba(37, 99, 235, 0.16);
}

.form-actions,
.actions-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  align-items: center;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  text-decoration: none;
}

.button:hover {
  background: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
}

.button-small {
  min-height: 32px;
  padding: 5px 10px;
}

.button-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.button-ghost:hover {
  background: #edf1f7;
  color: var(--text);
}

.button-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button-danger:hover {
  background: var(--danger-hover);
}

.alert {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  color: #9f1239;
  margin: 0 0 16px;
  padding: 10px 12px;
}

.notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1e40af;
  margin: 0 0 16px;
  padding: 10px 12px;
}

.notice-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.filters {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1fr) minmax(180px, 1.2fr) auto;
  margin-bottom: 18px;
  padding: 16px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

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

.admin-promocodes-table {
  min-width: 820px;
}

.blogger-promocodes-table {
  min-width: 960px;
  table-layout: fixed;
}

.blogger-promocodes-table th:nth-child(1),
.blogger-promocodes-table td:nth-child(1) {
  width: 19%;
}

.blogger-promocodes-table th:nth-child(2),
.blogger-promocodes-table td:nth-child(2) {
  width: 13%;
}

.blogger-promocodes-table th:nth-child(3),
.blogger-promocodes-table td:nth-child(3),
.blogger-promocodes-table th:nth-child(4),
.blogger-promocodes-table td:nth-child(4),
.blogger-promocodes-table th:nth-child(7),
.blogger-promocodes-table td:nth-child(7) {
  width: 12%;
}

.blogger-promocodes-table th:nth-child(5),
.blogger-promocodes-table td:nth-child(5),
.blogger-promocodes-table th:nth-child(6),
.blogger-promocodes-table td:nth-child(6) {
  width: 9%;
}

.blogger-promocodes-table th:nth-child(8),
.blogger-promocodes-table td:nth-child(8) {
  width: 14%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: uppercase;
  white-space: normal;
  word-break: normal;
}

.date-cell {
  white-space: normal;
}

.number-cell {
  text-align: center;
}

.actions-cell .button {
  white-space: normal;
}

tr:last-child td {
  border-bottom: 0;
}

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

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-deactivation_requested {
  background: #e0f2fe;
  color: #075985;
}

.badge-inactive {
  background: #e5e7eb;
  color: #374151;
}

.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.detail-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 20px;
}

.detail-grid > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 16px;
}

.detail-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.actions-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .nav,
  .topbar-actions,
  .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page {
    padding: 20px 14px;
  }

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