:root {
  --bg: #eef0ec;
  --panel: #ffffff;
  --panel2: #f5f7f3;
  --line: #e3e6df;
  --line2: #d2d7cc;
  --txt: #191c18;
  --dim: #6a7166;
  --acc: #0d5742;
  --acc-soft: #e7efe9;
  --red: #b03a2e;
  --gold: #8c6126;
  --gold2: #a67830;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--txt);
  background: var(--bg);
  font: 14px/1.45 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

button, input, select { font: inherit; }

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(238, 240, 236, .55) 78%, var(--bg) 100%);
}

.public-landing,
.sso-complete {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.card {
  width: 380px;
  max-width: 90vw;
  padding: 34px 32px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 20px 60px rgba(25, 28, 24, .12);
  backdrop-filter: blur(6px);
}

.logochip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--acc);
  color: #fff;
  font-weight: 800;
}

.brand { margin-bottom: 22px; text-align: center; }
.brand .logochip { margin: 0 auto 16px; }
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.brand h1 span { color: var(--gold); }
.brand .sub {
  margin-top: 4px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .08em;
}

.landing-status {
  margin: 0 0 16px;
  color: var(--dim);
  font-size: 13px;
}

.auth-form { display: grid; gap: 10px; }
.auth-form[hidden] { display: none; }
.auth-form h2 { margin: 0; font-size: 16px; }
.auth-form p { margin: 0 0 4px; color: var(--dim); font-size: 12.5px; }
.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel2);
  color: var(--txt);
  outline: none;
}
.auth-form input:focus { border-color: var(--gold); }
.auth-submit {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--gold);
  color: #fff;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.auth-submit:hover { background: var(--gold2); }
.auth-submit:disabled { opacity: .55; cursor: default; }
.auth-secondary {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--txt);
  cursor: pointer;
  font-weight: 650;
}
.auth-error {
  margin: 12px 0 0;
  color: var(--red);
  font-size: 12px;
}
.auth-split {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.auth-split::before,
.auth-split::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.landing-sign-in {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--gold);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.foot {
  margin-top: 22px;
  color: var(--dim);
  font-size: 11px;
  text-align: center;
}
.foot a { color: var(--dim); }

body:has(#app-shell:not([hidden])) #bg,
body:has(#app-shell:not([hidden])) #vignette,
body:has(#app-shell:not([hidden])) .public-landing {
  display: none;
}

.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 56px 44px minmax(0, 1fr);
  height: 100%;
  background: var(--bg);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.app-header .logochip {
  flex: none;
  width: 34px;
  height: 34px;
  font-size: 16px;
}
.app-header .brand-copy { display: grid; min-width: 0; }
.app-header .brand-copy strong { font-size: 15px; line-height: 1.2; }
.app-header .eyebrow {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tenant-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: 4px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.tenant-cluster:has(#tenant-switcher[hidden]) { display: none; }
.tenant-switcher-label {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tenant-switcher {
  min-width: 180px;
  max-width: 280px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--panel2);
  color: var(--txt);
}

.home-nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.home-nav button {
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 16px;
  background: none;
  color: var(--dim);
  cursor: pointer;
  font-weight: 600;
}
.home-nav button[aria-current="page"] {
  color: var(--txt);
  border-bottom-color: var(--acc);
}

.header-spacer { flex: 1; min-width: 12px; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.user-identity {
  display: grid;
  font-size: 12px;
  text-align: right;
  line-height: 1.25;
}
.user-identity span { color: var(--dim); font-size: 11px; text-transform: capitalize; }
.platform-link { color: var(--dim); font-size: 12px; white-space: nowrap; }
.logout-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  background: none;
  color: var(--dim);
  cursor: pointer;
}
.logout-button:hover { border-color: var(--red); color: var(--red); }

.workspace {
  min-height: 0;
  overflow: auto;
  padding: 22px 24px 28px;
}

.workspace-heading { max-width: 720px; margin-bottom: 18px; }
.workspace-kicker {
  margin: 0 0 4px;
  color: var(--acc);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.workspace h1 { margin: 0 0 8px; font-size: 22px; }
.workspace .lede { margin: 0; color: var(--dim); }

#operator-home,
#buyer-home {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
}

.orbit-stage {
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px dashed var(--line2);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(245, 247, 243, .9)),
    var(--panel);
  color: var(--dim);
  font-size: 13px;
}
.orbit-stage p { margin: 0; }

.packet-list { display: grid; gap: 8px; max-width: 720px; }
.packet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel);
}
.packet-card strong { display: block; }
.packet-card small { color: var(--dim); }

.empty-state {
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  color: var(--dim);
}

@media (max-width: 820px) {
  .app-header { gap: 10px; padding-inline: 12px; }
  .app-header .eyebrow { display: none; }
  .tenant-switcher { min-width: 140px; }
  .platform-link { display: none; }
  .home-nav { padding-inline: 12px; }
  .workspace { padding-inline: 12px; }
}
