:root {
  --accent: #2563eb;
  --ink: #132033;
  --muted: #64748b;
  --line: #d8e0ea;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --success: #0f766e;
  --danger: #b42318;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f7f9fc;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(216, 224, 234, 0.8);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 800;
}

.brand-logo,
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.brand-logo {
  object-fit: cover;
}

.brand-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #13a38b);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-actions a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav-actions a:hover {
  color: var(--ink);
  background: #eef3f8;
}

.hero {
  padding: clamp(36px, 7vw, 88px) clamp(18px, 4vw, 56px) 34px;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.09), rgba(19, 163, 139, 0.09) 58%, rgba(255, 255, 255, 0)),
    #fff;
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.tagline {
  max-width: 760px;
  margin: 18px 0 0;
  color: #24364e;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 750;
  line-height: 1.28;
}

.hero-description {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-panel {
  min-width: 180px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.metric-value,
.metric-label {
  display: block;
}

.metric-value {
  color: var(--accent);
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.metric-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.apps-section,
.admin-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.apps-section {
  padding: 34px 0 56px;
}

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

.section-heading h2,
.panel-heading h2,
.panel-heading h3 {
  margin: 0;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(var(--app-columns), minmax(0, 1fr));
  gap: 18px;
}

.layout-compact .app-grid {
  grid-template-columns: 1fr;
}

.layout-compact .app-card {
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
}

.layout-compact .app-visual {
  height: 86px;
}

.app-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  min-height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.card-solid .app-card {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: none;
}

.card-outline .app-card {
  background: transparent;
  box-shadow: none;
}

.card-soft .app-card {
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.app-visual {
  height: 142px;
  overflow: hidden;
  border-radius: 8px;
  background: #e9eef5;
}

.app-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 48px;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(19, 163, 139, 0.92)),
    #2563eb;
}

.app-content h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.app-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-method {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.login-method span,
.login-method strong {
  display: block;
}

.login-method span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-method strong {
  margin-top: 4px;
  color: #203047;
  font-size: 14px;
}

.launch-link,
.primary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.launch-link,
.primary-button {
  color: #fff;
  background: var(--accent);
}

.launch-link:hover,
.primary-button:hover {
  filter: brightness(0.95);
}

.launch-link.disabled {
  color: var(--muted);
  background: #e9eef5;
  cursor: default;
}

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

.empty-state {
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 26px clamp(18px, 4vw, 56px);
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #fff;
}

.admin {
  background: #f4f7fb;
}

.admin-shell {
  padding: 34px 0 64px;
}

.admin-heading {
  margin-bottom: 24px;
}

.admin-heading h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
}

.admin-heading > p:last-of-type {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.notice.success {
  color: var(--success);
  background: #e6fffb;
}

.notice.error {
  color: var(--danger);
  background: #fff1f0;
}

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

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

form label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

form label span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

input[type="color"] {
  padding: 4px;
}

.app-editor {
  margin-bottom: 18px;
}

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

.app-form .wide {
  grid-column: span 4;
}

.switch-label {
  align-self: end;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.switch-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.switch-label span {
  font-size: 14px;
}

.app-list {
  margin-top: 28px;
}

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

  .hero-panel {
    width: 100%;
  }

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

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

  .app-form .wide {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .topbar,
  .footer,
  .section-heading,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 30px;
  }

  .app-grid,
  .layout-compact .app-grid,
  .layout-compact .app-card,
  .app-form {
    grid-template-columns: 1fr;
  }

  .app-form .wide {
    grid-column: span 1;
  }

  .layout-compact .app-visual {
    height: 142px;
  }
}
