:root {
  --bg: #f4efe7;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: #fff9f1;
  --text: #1f2937;
  --muted: #6b7280;
  --line: rgba(123, 92, 59, 0.16);
  --shadow: 0 20px 50px rgba(105, 77, 46, 0.12);
  --accent: #c96f2d;
  --accent-strong: #8f3f17;
  --danger: #b9381f;
  --warning: #dd8b18;
  --success: #1f8a56;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(250, 212, 164, 0.8), transparent 28%),
    radial-gradient(circle at top right, rgba(234, 153, 88, 0.28), transparent 32%),
    linear-gradient(180deg, #f8f2e9 0%, #f2ede6 48%, #ece7df 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 85%);
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
  animation: rise-in 700ms ease-out;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 3vw, 3.9rem);
  line-height: 1.05;
  max-width: 14ch;
}

.hero-copy,
.panel-heading p,
.hero-panel span,
.metric-copy,
.warning-copy,
td small {
  color: var(--muted);
}

td small {
  display: block;
  margin-top: 4px;
}

.toolbar,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar {
  margin-top: 24px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.sync-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(221, 139, 24, 0.12);
}

.sync-status.success i {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(31, 138, 86, 0.12);
}

.sync-status.error i {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(185, 56, 31, 0.12);
}

button {
  font: inherit;
}

#refresh-button,
.filter-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease;
}

#refresh-button {
  padding: 10px 16px;
  color: #fff;
  background: var(--accent-strong);
}

#refresh-button:hover,
.filter-button:hover {
  transform: translateY(-1px);
}

#refresh-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.filter-button {
  padding: 7px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.filter-button.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.hero-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-panel {
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(160deg, rgba(201, 111, 45, 0.95), rgba(143, 63, 23, 0.9)),
    var(--surface);
  color: #fff7ef;
}

.hero-panel-label {
  margin-bottom: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}

.hero-panel strong {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.hero-panel span {
  color: rgba(255, 247, 239, 0.82);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.control-panel {
  grid-column: 1 / -1;
  position: relative;
  z-index: 2;
  overflow: visible;
}

.control-panel.calendar-open {
  z-index: 50;
}

.panel {
  padding: 24px;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(280px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.control-grid label,
.range-picker {
  display: grid;
  gap: 8px;
}

.control-grid label > span,
.control-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.control-grid input,
.control-grid select,
.range-display {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 250, 243, 0.92);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  outline: none;
}

.control-grid input:focus,
.control-grid select:focus,
.range-display:focus-visible {
  border-color: rgba(201, 111, 45, 0.65);
  box-shadow: 0 0 0 4px rgba(201, 111, 45, 0.1);
}

.ad-channel-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ad-channel-tab {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 13px 15px;
  color: var(--text);
  background: rgba(255, 250, 243, 0.74);
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ad-channel-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(143, 63, 23, 0.34);
}

.ad-channel-tab.active {
  color: #fff9f2;
  border-color: transparent;
  background: linear-gradient(135deg, #9a481f, #c9793e);
  box-shadow: 0 16px 30px rgba(143, 63, 23, 0.18);
}

.channel-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
}

.channel-icon.facebook {
  background: #1877f2;
}

.channel-icon.instagram {
  background: linear-gradient(135deg, #f9ce34, #ee2a7b 56%, #6228d7);
}

.channel-tab-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.channel-tab-copy strong {
  font-size: 0.94rem;
}

.channel-tab-copy small {
  color: var(--muted);
  line-height: 1.35;
}

.ad-channel-tab.active .channel-tab-copy small {
  color: rgba(255, 249, 242, 0.78);
}

.ad-channel-tab b {
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.range-preset {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  color: var(--accent-strong);
  background: rgba(255, 250, 243, 0.82);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.range-preset:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: #fff7ed;
}

.range-preset.active {
  color: #fff8ef;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: 0 12px 24px rgba(143, 63, 23, 0.16);
}

.range-picker {
  position: relative;
}

.range-picker > input[type="date"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.range-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.range-display span {
  color: var(--text);
  font-weight: 800;
}

.range-display strong {
  color: var(--accent-strong);
  font-size: 0.76rem;
  white-space: nowrap;
}

.range-calendar {
  position: absolute;
  z-index: 60;
  top: calc(100% + 12px);
  left: 0;
  width: min(360px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 28px 70px rgba(105, 77, 46, 0.2);
  backdrop-filter: blur(18px);
}

.calendar-nav,
.calendar-weekdays,
.calendar-days,
.calendar-footer {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-nav {
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  margin-bottom: 14px;
}

.calendar-nav strong {
  text-align: center;
  text-transform: capitalize;
}

.calendar-nav button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--accent-strong);
  background: rgba(143, 63, 23, 0.08);
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 800;
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: rgba(123, 92, 59, 0.72);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.calendar-weekdays span:last-child {
  color: var(--danger);
}

.calendar-days {
  gap: 5px;
}

.calendar-day,
.calendar-blank {
  width: 100%;
  aspect-ratio: 1;
}

.calendar-day {
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.calendar-day:hover {
  border-color: rgba(143, 63, 23, 0.28);
  background: rgba(143, 63, 23, 0.08);
}

.calendar-day.is-weekend {
  color: var(--danger);
}

.calendar-day.is-in-range {
  border-radius: 12px;
  background: rgba(201, 111, 45, 0.12);
}

.calendar-day.is-selected {
  color: #fff8ef;
  background: var(--accent-strong);
  box-shadow: 0 10px 22px rgba(143, 63, 23, 0.18);
}

.calendar-footer {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.calendar-footer span {
  display: block;
  margin-bottom: 4px;
  color: rgba(123, 92, 59, 0.72);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-footer strong {
  font-size: 0.82rem;
}

.stats-panel,
.account-panel {
  grid-column: span 6;
}

.warning-panel {
  grid-column: 1 / -1;
}

.table-panel,
.trend-panel,
.performance-panel,
.creative-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin-bottom: 4px;
  font-size: 1.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 250, 243, 0.9);
  border: 1px solid rgba(123, 92, 59, 0.14);
  transform: translateY(12px);
  opacity: 0;
  animation: rise-in 650ms ease-out forwards;
}

.stat-card:nth-child(2) {
  animation-delay: 80ms;
}

.stat-card:nth-child(3) {
  animation-delay: 140ms;
}

.stat-card:nth-child(4) {
  animation-delay: 200ms;
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}

.metric-value {
  margin-bottom: 8px;
  font-size: 1.9rem;
  font-weight: 800;
}

.warning-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.warning-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 248, 240, 0.95);
  border: 1px solid rgba(185, 56, 31, 0.12);
  animation: rise-in 600ms ease-out both;
}

.warning-card.critical {
  border-color: rgba(185, 56, 31, 0.34);
  background: rgba(255, 237, 232, 0.98);
}

.warning-card.warning {
  border-color: rgba(221, 139, 24, 0.32);
  background: rgba(255, 244, 222, 0.98);
}

.warning-topline,
.campaign-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.warning-topline strong,
.campaign-name {
  font-size: 1rem;
  font-weight: 700;
}

.warning-copy {
  margin: 10px 0 14px;
  line-height: 1.5;
}

.account-card {
  display: flex;
  justify-content: flex-start;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid rgba(123, 92, 59, 0.14);
  border-radius: 22px;
  background: rgba(255, 250, 243, 0.88);
}

.account-card + .account-card {
  margin-top: 12px;
}

.account-card.critical {
  border-color: rgba(185, 56, 31, 0.32);
  background: rgba(255, 237, 232, 0.9);
}

.account-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.account-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.account-meta {
  min-width: 160px;
  text-align: right;
}

.account-meta span,
.alert-log-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.account-meta strong {
  display: block;
  margin-top: 8px;
}

.read-step {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.alert-log {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.alert-log-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
}

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

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.pill {
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-strong);
}

.status-badge.normal {
  background: rgba(31, 138, 86, 0.12);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(221, 139, 24, 0.14);
  color: var(--warning);
}

.status-badge.critical {
  background: rgba(185, 56, 31, 0.14);
  color: var(--danger);
}

.status-badge.inactive {
  background: rgba(107, 114, 128, 0.12);
  color: var(--muted);
}

.status-badge.source-channel {
  border: 1px solid transparent;
}

.status-badge.source-channel.facebook,
.campaign-source.facebook {
  color: #1459a6;
  background: rgba(24, 119, 242, 0.1);
}

.status-badge.source-channel.instagram,
.campaign-source.instagram {
  color: #a72d61;
  background: rgba(225, 48, 108, 0.1);
}

.campaign-source {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.69rem;
  font-weight: 800;
}

.safe-card {
  grid-column: 1 / -1;
  border-color: rgba(31, 138, 86, 0.24);
  background: rgba(235, 248, 240, 0.94);
}

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

.result-note,
.performance-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(123, 92, 59, 0.14);
  background: rgba(255, 250, 243, 0.88);
}

.result-note {
  grid-column: 1 / -1;
}

.result-note.info {
  border-color: rgba(72, 94, 122, 0.18);
  background: rgba(244, 247, 250, 0.92);
}

.result-note p,
.performance-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.performance-card {
  display: grid;
  gap: 18px;
}

.performance-card h3 {
  margin: 12px 0 0;
  font-size: 1rem;
  line-height: 1.35;
}

.result-grid {
  display: grid;
  gap: 10px;
}

.result-grid div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(123, 92, 59, 0.1);
}

.result-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-grid strong {
  text-align: right;
}

.section-chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--accent-strong);
  background: rgba(255, 250, 243, 0.8);
  font-size: 0.78rem;
  font-weight: 800;
}

.creative-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.creative-card,
.creative-empty {
  border: 1px solid rgba(123, 92, 59, 0.14);
  border-radius: 24px;
  background: rgba(255, 250, 243, 0.9);
  overflow: hidden;
}

.creative-empty {
  grid-column: 1 / -1;
  padding: 22px;
}

.creative-empty p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.creative-empty code {
  color: var(--accent-strong);
  font-weight: 800;
}

.creative-preview-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
  text-align: inherit;
}

.creative-image-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 14px;
  background:
    radial-gradient(circle at top left, rgba(234, 168, 94, 0.25), transparent 46%),
    rgba(255, 255, 255, 0.7);
}

.creative-view-label {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(31, 41, 55, 0.82);
  backdrop-filter: blur(8px);
  font-size: 0.74rem;
  font-weight: 800;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.creative-preview-button:hover .creative-view-label,
.creative-preview-button:focus-visible .creative-view-label {
  opacity: 1;
  transform: translateY(0);
}

.creative-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.creative-image-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 18px;
}

.creative-image-wrap.is-thumbnail img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

.creative-source-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent-strong);
  background: rgba(255, 250, 243, 0.88);
  border: 1px solid rgba(123, 92, 59, 0.14);
  font-size: 0.7rem;
  font-weight: 900;
}

.creative-rank {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 22px rgba(143, 63, 23, 0.25);
  font-weight: 900;
}

.creative-content {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.creative-content h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.creative-content p,
.creative-content small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.creative-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.creative-metrics div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.creative-metrics span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.creative-metrics strong {
  display: block;
  font-size: 0.9rem;
}

.creative-modal[hidden] {
  display: none;
}

.creative-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.creative-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 23, 17, 0.72);
  backdrop-filter: blur(12px);
}

.creative-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(300px, 0.85fr);
  width: min(960px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  background: #fffaf3;
  box-shadow: 0 30px 90px rgba(25, 18, 12, 0.4);
}

.creative-modal-media {
  display: grid;
  min-height: 480px;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(234, 168, 94, 0.3), transparent 42%),
    #f1e8dc;
}

.creative-modal-media img {
  width: 100%;
  height: 100%;
  max-height: 680px;
  object-fit: contain;
  border-radius: 20px;
}

.creative-modal-body {
  align-content: center;
  display: grid;
  gap: 14px;
  padding: 36px;
}

.creative-modal-body h2,
.creative-modal-body p {
  margin: 0;
}

.creative-modal-body p {
  color: var(--muted);
  line-height: 1.5;
}

.creative-modal-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.creative-modal-metrics div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.creative-modal-metrics span,
.creative-modal-metrics strong {
  display: block;
}

.creative-modal-metrics span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 41, 55, 0.84);
  cursor: pointer;
  font-size: 1.7rem;
  line-height: 1;
}

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

.trend-wrap {
  display: grid;
  grid-template-columns: repeat(14, minmax(56px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 210px;
  overflow-x: auto;
  padding: 8px 4px 2px;
}

.trend-item {
  display: grid;
  gap: 8px;
  min-width: 56px;
  text-align: center;
}

.trend-bar-shell {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 118px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(123, 92, 59, 0.12);
  overflow: hidden;
}

.trend-bar {
  width: 100%;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, #eaa85e, var(--accent-strong));
}

.trend-item strong {
  font-size: 0.78rem;
}

.trend-item span,
.note-text {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.trend-empty {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(123, 92, 59, 0.12);
  vertical-align: top;
}

th {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

td {
  font-size: 0.94rem;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:hover {
  background: rgba(255, 250, 243, 0.72);
}

.empty-state {
  padding: 36px 12px;
  text-align: center;
  color: var(--muted);
}

.error-card {
  grid-column: 1 / -1;
}

td strong {
  display: block;
  margin-bottom: 4px;
}

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

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .warning-panel,
  .stats-panel,
  .account-panel,
  .table-panel,
  .trend-panel,
  .performance-panel,
  .creative-panel {
    grid-column: auto;
    grid-row: auto;
  }

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

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

  .warning-list {
    grid-template-columns: 1fr;
  }

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

  .creative-modal-card {
    grid-template-columns: 1fr;
  }

  .creative-modal-media {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0 40px;
  }

  .hero-panel,
  .panel {
    border-radius: 22px;
    padding: 20px;
  }

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

  .performance-list {
    grid-template-columns: 1fr;
  }

  .creative-list {
    grid-template-columns: 1fr;
  }

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

  .ad-channel-tabs {
    grid-template-columns: 1fr;
  }

  .range-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creative-modal {
    padding: 10px;
  }

  .creative-modal-card {
    max-height: calc(100vh - 20px);
    border-radius: 22px;
  }

  .creative-modal-media {
    min-height: 300px;
    padding: 16px;
  }

  .creative-modal-body {
    padding: 24px 20px;
  }

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

  .account-card,
  .alert-log-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-meta {
    min-width: 0;
    text-align: left;
  }

  th,
  td {
    padding-inline: 8px;
  }
}
