:root {
  --bg: #efede8;
  --surface: #fffdfa;
  --surface-2: #f6f2eb;
  --ink: #17130f;
  --ink-2: #3a3128;
  --muted: #756d63;
  --border: #ded6c9;
  --border-strong: #c8bdac;
  --amber: #c7832b;
  --amber-dark: #8f5a1d;
  --amber-light: #fff3dd;
  --amber-ring: rgba(199, 131, 43, .24);
  --charcoal: #15120e;
  --charcoal-2: #242019;
  --paper-shadow: 0 14px 40px rgba(46, 38, 28, .10);
  --lift-shadow: 0 18px 44px rgba(28, 22, 16, .16);
  --radius: 8px;
  --radius-lg: 8px;
}

html {
  background: var(--charcoal);
}

body {
  background:
    radial-gradient(circle at 8% 8%, rgba(199, 131, 43, .12), transparent 26rem),
    linear-gradient(145deg, #f4f1eb 0%, #ebe7df 58%, #f8f6f1 100%);
  color: var(--ink);
}

.app-header {
  height: 72px;
  padding: 0 28px;
  background:
    linear-gradient(90deg, rgba(199, 131, 43, .16), transparent 28%),
    linear-gradient(180deg, #17130f, #0f0d0a);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 14px 30px rgba(17, 13, 9, .20);
}

.logo {
  min-width: 210px;
  gap: 14px;
}

.logo-mark {
  display: none;
}

.logo-img {
  display: block;
  width: 150px;
  height: auto;
  max-height: 40px;
  object-fit: contain;
}

.logo-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.logo-text {
  font-size: 16px;
  line-height: 1;
}

.logo-sub {
  color: rgba(255, 255, 255, .58);
}

.header-nav {
  gap: 8px;
}

.header-nav a,
.header-nav button {
  min-height: 36px;
  padding: 8px 15px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.header-nav .btn-calc,
.header-nav .active {
  background: linear-gradient(135deg, #dfa044, var(--amber));
  color: #15110d;
  box-shadow: 0 8px 22px rgba(199, 131, 43, .30);
}

.user-chip {
  min-height: 36px;
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .15);
}

.user-avatar {
  background: linear-gradient(135deg, #dfa044, var(--amber));
}

.page {
  max-width: 1440px;
  padding: 30px 32px 56px;
}

.admin-hero,
.settings-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 28px 32px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(105deg, rgba(17, 13, 9, .96), rgba(36, 32, 25, .88)),
    linear-gradient(135deg, rgba(199, 131, 43, .30), transparent);
  box-shadow: var(--lift-shadow);
}

.admin-hero::after,
.settings-hero::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -42px;
  width: 330px;
  height: 150px;
  background: url("/static/img/nuvo-logo-white.png") center / contain no-repeat;
  opacity: .075;
}

.admin-hero > *,
.settings-hero > * {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  color: #dfa044;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.admin-hero h1,
.settings-hero h1 {
  margin: 8px 0 8px;
  font-size: clamp(26px, 3.6vw, 44px);
  line-height: 1;
  color: #fff;
}

.admin-hero p,
.settings-hero p {
  max-width: 620px;
  color: rgba(255, 255, 255, .72);
  font-size: 15px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
  font-weight: 700;
}

.card,
.collapsible-card,
.section-block,
.user-panel,
.recent-card,
.mfr-group,
.opt-group {
  border-color: rgba(90, 75, 56, .16);
  border-radius: 8px;
  background: rgba(255, 253, 250, .94);
  box-shadow: var(--paper-shadow);
}

.card-hd,
.section-block-hd,
.panel-hd,
.recent-hd,
.opt-group-hd,
.mfr-group-hd {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .84), rgba(246, 242, 235, .92));
}

.card-hd h2,
.section-block-hd h2,
.panel-hd h2,
.recent-hd,
.collapsible-trigger h2 {
  color: var(--ink);
  letter-spacing: 0;
}

.kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 16px;
}

.kpi-card {
  min-height: 116px;
  padding: 18px 20px;
  border-radius: 8px;
  border-color: rgba(90, 75, 56, .16);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(248, 244, 237, .94));
  box-shadow: var(--paper-shadow);
}

.kpi-card::before {
  width: 5px;
  height: 100%;
  right: auto;
  bottom: 0;
}

.kpi-card:hover {
  box-shadow: var(--lift-shadow);
}

.kpi-badge,
.brand-badge {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24);
}

.kpi-value {
  font-size: 30px;
}

.collapsible-trigger {
  min-height: 58px;
}

input,
select,
textarea {
  min-height: 42px;
  border-radius: 8px;
  background: #fffefc;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b8aa96;
}

.btn,
button {
  border-radius: 8px;
}

.btn-primary,
.btn-view-active {
  background: linear-gradient(135deg, #dfa044, var(--amber)) !important;
  color: #15110d !important;
  box-shadow: 0 8px 20px rgba(199, 131, 43, .24);
}

.btn-ghost {
  background: rgba(255, 253, 250, .72);
}

.table-wrap {
  border-color: rgba(90, 75, 56, .16);
  border-radius: 8px;
}

th {
  background: #f4efe7;
  color: #6f6254;
}

tr:hover td {
  background: #fbf7ef;
}

.thumb,
.thumb-empty {
  border-radius: 8px;
}

.mfr-group-hd {
  min-height: 58px;
}

.mfr-group-hd:hover,
.opt-group-hd:hover,
.collapsible-trigger:hover {
  background: #efe8dd;
}

.user-hero {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 30px 34px;
  margin-bottom: 22px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(105deg, rgba(17, 13, 9, .96), rgba(36, 32, 25, .90)),
    linear-gradient(135deg, rgba(199, 131, 43, .28), transparent);
  box-shadow: var(--lift-shadow);
}

.user-hero::after {
  content: "";
  position: absolute;
  inset: auto 30px -42px auto;
  width: 260px;
  height: 120px;
  background: url("/static/img/nuvo-logo-white.png") center / contain no-repeat;
  opacity: .08;
}

.user-hero h1 {
  position: relative;
  z-index: 1;
  color: #fff;
}

.user-hero p {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, .70);
}

.panel-hd p,
.helper,
.note {
  color: var(--muted);
}

.modal {
  border-radius: 8px;
}

.overlay {
  background: rgba(17, 13, 9, .68);
}

.diagram-card,
.result-box,
.check-result.none,
#calcNewMaterialForm,
#calcSummary {
  border-radius: 8px !important;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, .88fr) minmax(440px, 1.12fr);
  background:
    linear-gradient(90deg, rgba(17, 13, 9, .94), rgba(17, 13, 9, .76)),
    radial-gradient(circle at 20% 24%, rgba(199, 131, 43, .22), transparent 24rem),
    #17130f;
  color: #fff;
}

.login-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px;
  overflow: hidden;
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: 40px;
  width: min(54vw, 720px);
  height: 240px;
  background: url("/static/img/nuvo-logo-white.png") center / contain no-repeat;
  opacity: .08;
}

.login-logo {
  width: 190px;
  max-width: 72vw;
  height: auto;
  position: relative;
  z-index: 1;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.login-kicker {
  color: #dfa044;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.login-copy h1 {
  margin: 14px 0 14px;
  font-size: clamp(34px, 5vw, 66px);
  line-height: .96;
  color: #fff;
}

.login-copy p {
  max-width: 480px;
  color: rgba(255, 255, 255, .72);
  font-size: 16px;
  line-height: 1.55;
}

.login-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
}

.login-metric {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
}

.login-metric strong {
  display: block;
  color: #fff;
  font-size: 18px;
}

.login-metric span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, .58);
  font-size: 12px;
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 70% 18%, rgba(199, 131, 43, .12), transparent 20rem),
    linear-gradient(145deg, #f4f1eb, #ebe7df);
}

.login-card {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid rgba(90, 75, 56, .18);
  border-radius: 8px;
  background: rgba(255, 253, 250, .96);
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(28, 22, 16, .20);
}

.login-card h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.login-card .subtitle {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.login-card label {
  display: block;
  margin-bottom: 7px;
}

.login-card .field {
  margin-bottom: 15px;
}

.login-card input,
.login-card button {
  width: 100%;
}

.login-card button {
  min-height: 46px;
  margin-top: 4px;
  border: 0;
  background: linear-gradient(135deg, #dfa044, var(--amber));
  color: #15110d;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(199, 131, 43, .24);
}

.login-card .flash {
  margin-bottom: 16px;
}

.login-card .hint {
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 360px;
    padding: 28px;
  }

  .login-metrics {
    grid-template-columns: 1fr;
  }

  .app-header {
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .logo {
    min-width: auto;
  }

  .logo-img {
    width: 132px;
  }

  .header-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .page {
    padding: 22px 16px 42px;
  }

  .admin-hero,
  .settings-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
  }

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

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .user-hero {
    padding: 24px 22px;
  }

  .login-form-panel {
    padding: 22px 16px 30px;
  }

  .login-card {
    padding: 24px;
  }
}
