:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f2ef;
  --line: #e6e4df;
  --text: #18191d;
  --muted: #787b86;
  --muted-2: #9b9da6;
  --green: #14a46c;
  --blue: #2563eb;
  --amber: #c17900;
  --red: #d72f4b;
  --shadow: 0 18px 42px rgba(21, 23, 28, 0.06);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1800px, calc(100% - 56px));
  margin: 0 auto;
  padding: 56px 0 64px;
}

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

.brand-block,
.top-actions,
.panel-head,
.form-actions,
.form-options,
.quick-expiry,
.checkbox-line,
.warning-setting {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 16px;
}

.brand-icon {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #1d1d21;
  box-shadow: var(--shadow);
}

.brand-icon span {
  position: absolute;
  border: 2px solid #fff;
  border-radius: 999px;
}

.brand-icon span:nth-child(1) {
  width: 11px;
  height: 11px;
  left: 17px;
  top: 15px;
}

.brand-icon span:nth-child(2) {
  width: 9px;
  height: 9px;
  right: 17px;
  top: 17px;
}

.brand-icon span:nth-child(3) {
  width: 27px;
  height: 16px;
  left: 15px;
  bottom: 15px;
  border-top-color: transparent;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 38px;
  line-height: 1.05;
}

h2 {
  font-size: 21px;
  line-height: 1.15;
}

.top-actions {
  gap: 10px;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.page-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.76);
  color: #555965;
  font-weight: 780;
}

.page-tabs button.active {
  border-color: #191a1f;
  background: #191a1f;
  color: #fff;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.icon-button,
.primary-button,
.ghost-button,
.quick-expiry button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 20px;
}

.primary-button {
  background: #191a1f;
  color: #fff;
  font-weight: 760;
}

.ghost-button,
.quick-expiry button {
  border-color: var(--line);
  color: #555965;
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.quick-expiry button:hover {
  transform: translateY(-1px);
  border-color: #cfcac1;
}

.platform-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.platform-card {
  position: relative;
  min-height: 218px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.platform-card::after {
  content: "";
  position: absolute;
  inset: auto 20px 20px auto;
  width: 70px;
  height: 70px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--platform-color) 10%, transparent);
  opacity: 0;
  transition: opacity 160ms ease;
}

.platform-card:hover::after {
  opacity: 1;
}

.platform-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
}

.platform-icon {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 18px;
  background: var(--platform-color);
  color: #fff;
  font-size: 24px;
  font-weight: 850;
}

.external-link {
  border: 0;
  background: transparent;
  color: #c7c8cd;
  font-size: 26px;
  line-height: 1;
}

.metric {
  margin-bottom: 10px;
  font-size: 40px;
  font-weight: 780;
  line-height: 1;
  overflow-wrap: anywhere;
}

.metric-label {
  margin-bottom: 14px;
  color: var(--muted-2);
  font-size: 18px;
}

.platform-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #565965;
  font-size: 22px;
}

.platform-credential {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.platform-countdown {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: #343741;
  font-size: 13px;
  font-weight: 800;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #a8abb4;
}

.status-dot.success {
  background: var(--green);
}

.status-dot.info {
  background: var(--blue);
}

.status-dot.warning {
  background: var(--amber);
}

.status-dot.danger {
  background: var(--red);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: #61636b;
  font-size: 16px;
  font-weight: 760;
  white-space: nowrap;
}

.badge.success {
  background: #dff8ec;
  color: var(--green);
}

.badge.info {
  background: #e8f0ff;
  color: var(--blue);
}

.badge.warning {
  background: #fff2d8;
  color: var(--amber);
}

.badge.danger {
  background: #ffe5eb;
  color: var(--red);
}

.badge.muted {
  background: #ededed;
  color: #777982;
}

.dashboard-grid,
.insight-grid,
.lower-grid,
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 24px;
  margin-bottom: 24px;
}

.page-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.85fr);
}

.insight-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.45fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.compact-select {
  width: min(220px, 46vw);
  padding: 10px 12px;
}

.trend-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.cookie-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.trend-stat {
  min-height: 72px;
  border: 1px solid #eceae5;
  border-radius: 16px;
  padding: 13px 14px;
  background: #fff;
}

.trend-stat strong {
  display: block;
  margin-bottom: 5px;
  font-size: 24px;
  line-height: 1;
}

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

.trend-chart {
  height: 310px;
  padding: 10px 20px 22px;
}

.trend-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid {
  stroke: #ebe8e1;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #8f929b;
  font-size: 11px;
}

.chart-area {
  fill: rgba(37, 99, 235, 0.12);
}

.chart-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: #fff;
  stroke: #2563eb;
  stroke-width: 2.5;
}

.health-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.health-item {
  min-height: 70px;
  border: 1px solid #eceae5;
  border-radius: 16px;
  padding: 14px 15px;
  background: #fff;
}

.health-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-weight: 800;
}

.credential-list,
.sync-list,
.cookie-status-list,
.event-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.cookie-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.22fr);
  gap: 18px;
  align-items: center;
  border: 1px solid #eceae5;
  border-radius: 16px;
  padding: 16px;
  background: #fff;
}

.cookie-status-card.warning {
  border-color: #f3d49b;
}

.cookie-status-card.danger {
  border-color: #f4adbc;
}

.cookie-name {
  margin-bottom: 7px;
  color: #343741;
  font-size: 16px;
  font-weight: 840;
}

.cookie-countdown {
  display: grid;
  min-height: 74px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-soft);
  color: #555965;
  font-size: 20px;
  font-weight: 860;
  text-align: center;
}

.cookie-countdown.success {
  background: #dff8ec;
  color: var(--green);
}

.cookie-countdown.info {
  background: #e8f0ff;
  color: var(--blue);
}

.cookie-countdown.warning {
  background: #fff2d8;
  color: var(--amber);
}

.cookie-countdown.danger {
  background: #ffe5eb;
  color: var(--red);
}

.cookie-progress {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #efede8;
}

.cookie-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 78px;
  border: 1px solid #eceae5;
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
}

.row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 7px;
  font-weight: 800;
}

.row-meta,
.row-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-width: 38px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.form-panel {
  padding-bottom: 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 0;
}

label {
  display: grid;
  gap: 8px;
  color: #4c505b;
  font-size: 13px;
  font-weight: 760;
}

.stacked {
  padding: 16px 20px 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ddd9d1;
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 138px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #18191d;
}

.form-actions {
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 0;
}

.form-options {
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
}

.quick-expiry {
  flex-wrap: wrap;
  gap: 8px;
}

.quick-expiry button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.checkbox-line {
  grid-template-columns: auto 1fr;
  gap: 8px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.warning-setting {
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.warning-setting input {
  width: 74px;
  padding: 9px 10px;
}

.event-panel {
  overflow: hidden;
}

.event-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  border-bottom: 1px solid #eeeeea;
  padding: 4px 0 14px;
}

.event-item:last-child {
  border-bottom: 0;
}

.event-time {
  color: var(--muted-2);
  font-size: 12px;
}

.empty-state {
  min-height: 118px;
  display: grid;
  place-items: center;
  border: 1px dashed #d8d5ce;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  border-radius: 16px;
  padding: 14px 16px;
  background: #18191d;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #202127;
}

.login-shell {
  width: min(100% - 28px, 430px);
}

.login-card {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 30px;
  background: #f7f7f4;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
  margin-bottom: 4px;
  font-size: 32px;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 4px;
}

.login-card .primary-button:disabled {
  cursor: default;
  opacity: 0.65;
}

.login-mark {
  width: 54px;
  height: 54px;
}

.login-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 760;
}

@media (max-width: 1380px) {
  .platform-strip {
    grid-template-columns: repeat(4, minmax(190px, 1fr));
  }
}

@media (max-width: 960px) {
  .app-shell {
    width: min(100% - 28px, 780px);
    padding-top: 28px;
  }

  .topbar,
  .dashboard-grid,
  .insight-grid,
  .lower-grid,
  .page-grid {
    grid-template-columns: 1fr;
  }

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

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

  .trend-summary {
    grid-template-columns: 1fr;
  }

  .cookie-summary,
  .cookie-status-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 30px;
  }

  .platform-strip,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .platform-card {
    min-height: 188px;
    padding: 22px;
  }

  .platform-icon {
    width: 58px;
    height: 58px;
  }

  .metric {
    font-size: 34px;
  }

  .row-card,
  .event-item {
    grid-template-columns: 1fr;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
