:root {
  --page: #f7f1eb;
  --page-alt: #fffaf5;
  --ink: #231f20;
  --muted: rgba(35, 31, 32, 0.64);
  --line: rgba(35, 31, 32, 0.1);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --rose: #dd3f88;
  --rose-deep: #b9306d;
  --sand: #f2d7c4;
  --green: #1e7b63;
  --red: #ac4153;
  --blue: #1f6d97;
  --shadow: 0 28px 80px rgba(69, 38, 52, 0.14);
  --shadow-soft: 0 16px 42px rgba(69, 38, 52, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(221, 63, 136, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(242, 215, 196, 0.52), transparent 30%),
    linear-gradient(180deg, #fffaf5 0%, #f7f1eb 42%, #f4eee7 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Poppins", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ink), #40393b);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 0 18px;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(35, 31, 32, 0.18);
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
}

.danger-button {
  background: linear-gradient(135deg, #be4557, #8d2d3f);
}

.danger-button:hover {
  background: linear-gradient(135deg, #9b2439, #6f1a2b);
  color: #ffffff;
}

.secondary-action {
  background: rgba(35, 31, 32, 0.08);
  color: var(--ink);
}

.secondary-action:hover {
  background: rgba(221, 63, 136, 0.16);
  color: var(--ink);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.device-card:focus-visible {
  outline: 3px solid rgba(221, 63, 136, 0.28);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 4.4vw, 4.35rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
}

.dashboard-shell {
  width: min(1380px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.dashboard-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 244, 248, 0.92)),
    linear-gradient(180deg, rgba(221, 63, 136, 0.06), rgba(242, 215, 196, 0.16));
  box-shadow: var(--shadow);
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.dashboard-header::after {
  content: "";
  position: absolute;
  inset: auto -8% -26% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(221, 63, 136, 0.14), transparent 70%);
  pointer-events: none;
}

.brand-lockup,
.hero-copy {
  position: relative;
  z-index: 1;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.brand-logo {
  width: clamp(150px, 18vw, 194px);
  height: auto;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(35, 31, 32, 0.05);
  padding: 10px;
}

.hero-copy {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.hero-text {
  max-width: 65ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  font-weight: 650;
}

.eyebrow {
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.header-tag,
.portal-pill,
.status-chip,
.device-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 900;
  padding: 0 14px;
}

.header-tag {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(35, 31, 32, 0.06);
}

.header-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-width: 220px;
}

.portal-pill {
  max-width: min(320px, 100%);
  justify-content: center;
  background: rgba(35, 31, 32, 0.92);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(35, 31, 32, 0.14);
  text-align: center;
}

.status-banner {
  margin-top: 18px;
  border: 1px solid rgba(35, 31, 32, 0.06);
  border-left: 6px solid var(--sand);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-weight: 800;
  padding: 15px 18px;
  box-shadow: var(--shadow-soft);
}

.status-banner.success {
  border-left-color: var(--green);
  color: var(--green);
}

.status-banner.warning {
  border-left-color: var(--rose);
  color: var(--rose-deep);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.metric-tile {
  position: relative;
  min-height: 132px;
  display: grid;
  align-content: end;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(35, 31, 32, 0.07);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.metric-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--sand);
}

.metric-tile span {
  color: var(--muted);
  font-weight: 900;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-tile strong {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.metric-tile.accent-gold::before {
  background: linear-gradient(90deg, #f1c59e, #e2a35d);
}

.metric-tile.accent-green::before {
  background: linear-gradient(90deg, #6ed0ae, #1e7b63);
}

.metric-tile.accent-red::before {
  background: linear-gradient(90deg, #f08ca2, #ac4153);
}

.metric-tile.accent-blue::before {
  background: linear-gradient(90deg, #75bfe4, #1f6d97);
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 360px;
  gap: 18px;
  align-items: start;
  margin-top: 20px;
}

.device-panel,
.detail-panel {
  border: 1px solid rgba(35, 31, 32, 0.07);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.device-panel {
  overflow: hidden;
}

.detail-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  position: sticky;
  top: 18px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 0;
}

.detail-heading {
  padding: 0;
}

.panel-meta {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
  gap: 12px;
  padding: 18px 22px 20px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 11px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  padding: 0 22px 22px;
}

.device-card {
  min-height: 266px;
  display: grid;
  align-content: start;
  gap: 16px;
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 246, 242, 0.96));
  cursor: pointer;
  padding: 18px;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.device-card:hover,
.selected-card {
  transform: translateY(-2px);
  border-color: rgba(221, 63, 136, 0.44);
  box-shadow: 0 18px 34px rgba(102, 58, 79, 0.14);
}

.device-card.is-compliant {
  box-shadow: inset 0 4px 0 rgba(30, 123, 99, 0.86);
}

.device-card.needs-attention {
  box-shadow: inset 0 4px 0 rgba(172, 65, 83, 0.86);
}

.device-card.is-inactive {
  box-shadow: inset 0 4px 0 rgba(31, 109, 151, 0.86);
}

.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cast-icon {
  width: 58px;
  height: 44px;
  border: 2px solid rgba(35, 31, 32, 0.7);
  border-radius: 12px;
  position: relative;
  background: linear-gradient(180deg, #fff7fb, #fffefc);
}

.cast-icon::before,
.cast-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 8px;
  border: 2px solid rgba(221, 63, 136, 0.85);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 10px 0 0;
}

.cast-icon::before {
  width: 16px;
  height: 16px;
}

.cast-icon::after {
  width: 26px;
  height: 26px;
}

.device-card-main {
  display: grid;
  gap: 8px;
}

.device-kicker {
  color: var(--rose-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.device-card-main h2 {
  overflow-wrap: anywhere;
  font-size: 1.28rem;
}

.device-card-main p,
.device-card-meta {
  color: var(--muted);
  font-weight: 800;
}

.device-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.device-pill {
  min-height: 30px;
  background: rgba(35, 31, 32, 0.06);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(35, 31, 32, 0.05);
}

.strong-pill {
  background: rgba(221, 63, 136, 0.12);
  color: var(--rose-deep);
  box-shadow: inset 0 0 0 1px rgba(221, 63, 136, 0.12);
}

.device-card-meta {
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
}

.device-card-meta span {
  overflow-wrap: anywhere;
}

.portal-pill,
.status-chip {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-chip.compliant {
  background: rgba(30, 123, 99, 0.14);
  color: var(--green);
}

.status-chip.attention {
  background: rgba(172, 65, 83, 0.14);
  color: var(--red);
}

.status-chip.inactive {
  background: rgba(31, 109, 151, 0.14);
  color: var(--blue);
}

.device-detail {
  display: grid;
  gap: 14px;
}

.detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(35, 31, 32, 0.07);
  border-left: 6px solid var(--sand);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.85);
  padding: 12px 14px;
}

.detail-status.is-compliant {
  border-left-color: var(--green);
}

.detail-status.needs-attention {
  border-left-color: var(--red);
}

.detail-status.is-inactive {
  border-left-color: var(--blue);
}

.detail-status span:last-child {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  text-align: right;
}

.detail-hero {
  display: grid;
  gap: 12px;
  padding-bottom: 4px;
}

.detail-hero p {
  color: var(--muted);
}

.detail-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

dl div {
  display: grid;
  gap: 6px;
  border-top: 1px solid rgba(35, 31, 32, 0.08);
  padding-top: 12px;
}

dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.action-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(35, 31, 32, 0.08);
  padding-top: 16px;
}

.action-cluster {
  display: grid;
  gap: 10px;
}

.action-cluster-danger {
  padding-top: 4px;
}

.action-panel button {
  width: 100%;
}

.action-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.action-message.empty {
  visibility: hidden;
}

.action-history {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(35, 31, 32, 0.08);
  padding-top: 14px;
}

.action-history > strong {
  font-size: 0.9rem;
}

.action-history article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px;
}

.action-history article span {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.action-history small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

.empty-history span {
  color: var(--muted);
  font-weight: 800;
}

.history-status {
  border-radius: 999px;
  background: rgba(35, 31, 32, 0.08);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
  padding: 4px 9px;
}

.history-status.success {
  background: rgba(30, 123, 99, 0.14);
  color: var(--green);
}

.history-status.failed,
.history-status.error {
  background: rgba(172, 65, 83, 0.14);
  color: var(--red);
}

.history-status.pending {
  background: rgba(242, 215, 196, 0.5);
  color: #865940;
}

.empty-table {
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  padding: 30px 22px;
}

@media (max-width: 1080px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 980px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
  }

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

@media (max-width: 720px) {
  .brand-lockup {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar,
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .dashboard-shell {
    width: min(100% - 18px, 100%);
    padding-top: 18px;
  }

  .dashboard-header,
  .device-panel,
  .detail-panel {
    border-radius: 20px;
  }
}
