* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", Tahoma, sans-serif;
  background:
    radial-gradient(1200px 650px at 10% -15%, #ffffff 0%, transparent 65%),
    radial-gradient(900px 500px at 90% 0%, #c8ecd9 0%, transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.panel {
  width: min(1120px, 100%);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid #ffffff;
  border-radius: 20px;
  box-shadow: 0 28px 60px rgba(14, 54, 36, 0.18);
  overflow: hidden;
}

.hero {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 28px 28px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-session {
  display: grid;
  gap: 8px;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 170px;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.session-pill.is-active {
  background: rgba(236, 255, 246, 0.2);
  color: #e9fff3;
  border-color: rgba(203, 245, 222, 0.55);
}

.session-pill.is-idle {
  background: rgba(8, 66, 44, 0.28);
  color: rgba(236, 251, 243, 0.9);
  border-color: rgba(178, 224, 200, 0.35);
}

.hero img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 8px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  letter-spacing: 0.04em;
}

.hero p {
  margin: 6px 0 0;
  opacity: 0.95;
  font-size: clamp(0.92rem, 2vw, 1.02rem);
}

.content {
  padding: 28px;
}

.section-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.login-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #d4e7db;
  border-radius: 14px;
  background: linear-gradient(120deg, #f7fcf9, #edf8f2);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.login-area-affiliate {
  border-color: #cae6d7;
  background: linear-gradient(120deg, #f5fdf8, #eaf8f1);
}

.login-area-admin {
  border-color: #d8e4dd;
  background: linear-gradient(120deg, #f8fbf9, #eef4f1);
  margin-top: 10px;
}

.module-divider {
  margin: 24px 0 16px;
  border-top: 2px dashed #c8dbd0;
}

.login-title {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #4a7a64;
}

.login-text {
  margin: 4px 0 0;
  color: #355a49;
  font-size: 0.93rem;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-content: flex-end;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(100deg, var(--brand), var(--brand-deep));
  border: 1px solid #0e6646;
  box-shadow: 0 8px 18px rgba(14, 80, 53, 0.16);
}

.login-btn-secondary {
  background: #f7fffb;
  color: #0f6f4a;
  border-color: #c6e2d3;
  box-shadow: none;
}

.module-row {
  display: grid;
  gap: 18px;
}

.role-note {
  margin-top: 18px;
  border: 1px solid #d2e4d9;
  border-radius: 12px;
  background: #f4fbf7;
  color: #35634f;
  font-size: 0.92rem;
  padding: 12px 14px;
}

.module-row + .module-row {
  margin-top: 18px;
}

.module-row-primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-row-affiliate {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-row-admin-main {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-row-secondary {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.maintenance {
  margin-top: 24px;
  border-top: 1px dashed #cfe1d6;
  padding-top: 16px;
}

.maintenance-title {
  margin: 0 0 12px;
  color: #6f867b;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.77rem;
  font-weight: 800;
}

.admin-tool-flash-ok {
  border-color: #b9e2c8;
  background: linear-gradient(120deg, #effcf4, #e6f7ed);
}

.admin-tool-flash-err {
  border-color: #edc7c7;
  background: linear-gradient(120deg, #fff4f4, #fdeaea);
}

.maintenance-danger {
  margin-top: 18px;
  border-top: 1px dashed #e1bebe;
}

.temp-tools-note {
  margin: 0 0 12px;
  color: #7b2d2d;
  font-size: 0.9rem;
  font-weight: 700;
}

.temp-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.temp-tool-card {
  border: 1px solid #efcccc;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffefe, #fff7f7);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.temp-tool-card h3 {
  margin: 0;
  font-size: 1rem;
  color: #8a2323;
}

.temp-tool-card p {
  margin: 0;
  color: #704040;
  font-size: 0.88rem;
}

.temp-tool-card label {
  font-size: 0.78rem;
  color: #613131;
  font-weight: 700;
}

.temp-tool-card input {
  width: 100%;
  border: 1px solid #e8c2c2;
  border-radius: 10px;
  padding: 10px;
  outline: none;
  font-size: 0.92rem;
}

.temp-tool-card input:focus {
  border-color: #cf7070;
  box-shadow: 0 0 0 2px rgba(207, 112, 112, 0.18);
}

.temp-tool-card button {
  border: 0;
  border-radius: 10px;
  padding: 10px;
  font-weight: 800;
  cursor: pointer;
  background: #b34747;
  color: #fff;
}

.temp-tool-card button.danger-btn {
  background: #8f1e1e;
}

.module-row-maintenance {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.module-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 10px 24px rgba(17, 66, 45, 0.08);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  opacity: 0.75;
}

.module-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.module-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.module-kicker {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5e8874;
  font-weight: 700;
}

.module-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f5fcf8 0%, #e3f4ea 100%);
  border: 1px solid #c7e3d2;
  box-shadow: inset 0 1px 0 #ffffff, 0 4px 10px rgba(14, 68, 46, 0.08);
  flex-shrink: 0;
}

.module-icon svg {
  width: 33px;
  height: 33px;
  stroke: var(--brand-deep);
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: #8ec7ab;
  box-shadow: 0 16px 32px rgba(17, 66, 45, 0.15);
}

.module-card-featured {
  border-color: #9fceb6;
  background: linear-gradient(180deg, #ffffff 0%, #f5fcf8 100%);
  box-shadow: 0 14px 28px rgba(16, 78, 51, 0.14);
}

.module-card-featured .module-icon {
  width: 70px;
  height: 70px;
  border-radius: 18px;
}

.module-card-featured strong {
  font-size: 1.18rem;
}

.module-card-featured .module-desc {
  font-size: 0.98rem;
}

.module-card-muted {
  opacity: 0.82;
  border-color: #dbe8e1;
  background: linear-gradient(180deg, #fbfdfc 0%, #f5faf7 100%);
  box-shadow: 0 7px 16px rgba(17, 66, 45, 0.07);
}

.module-card-muted::before {
  opacity: 0.4;
}

.module-card-muted .module-kicker {
  color: #7c9489;
}

.module-card-muted strong {
  color: #3a6452;
}

.module-card-muted .module-desc {
  color: #688276;
}

.module-card-muted .module-chip {
  background: #f7fbf9;
  border-color: #d7e6df;
  color: #4d7360;
}

.module-card-muted:hover {
  opacity: 1;
  border-color: #b7d3c4;
  box-shadow: 0 12px 22px rgba(17, 66, 45, 0.1);
}

.module-card strong {
  display: block;
  font-size: 1.07rem;
  margin-bottom: 0;
  color: #0e5a3e;
  line-height: 1.2;
}

.module-desc {
  display: block;
  color: #4f6f5f;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 20px;
  flex-grow: 1;
}

.module-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 11px;
  background: #f3fbf7;
  border: 1px solid #c9e4d5;
  color: #146845;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.module-chip::after {
  content: ">";
  font-size: 0.9rem;
  line-height: 1;
}

.module-card:hover .module-chip {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #ffffff;
}

@media (max-width: 700px) {
  body {
    padding: 16px;
  }

  .hero {
    padding: 20px 18px 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-main {
    width: 100%;
  }

  .hero-session {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }

  .login-area {
    flex-direction: column;
    align-items: stretch;
  }

  .login-actions {
    justify-content: stretch;
  }

  .login-btn {
    width: 100%;
  }

  .module-row-primary,
  .module-row-secondary,
  .module-row-affiliate,
  .module-row-admin-main,
  .module-row-maintenance,
  .temp-tools-grid {
    grid-template-columns: 1fr;
  }

  .module-card {
    padding: 18px;
  }
}
