:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #60706c;
  --line: #d9e1dc;
  --panel: #ffffff;
  --field: #f7faf8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --nav-surface: rgba(255, 255, 255, 0.72);
  --body-bg: #eef4f1;
  --tab-active: #ffffff;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --amber: #f59e0b;
  --rose: #e11d48;
  --shadow: 0 24px 80px rgba(24, 38, 35, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef8f5;
  --muted: #9fb2ad;
  --line: #2b3d38;
  --panel: #111c19;
  --field: #172521;
  --surface: rgba(17, 28, 25, 0.9);
  --surface-strong: rgba(22, 34, 31, 0.96);
  --nav-surface: rgba(17, 28, 25, 0.82);
  --body-bg: #0c1412;
  --tab-active: #22332f;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --amber: #fbbf24;
  --rose: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.14), transparent 36%),
    var(--body-bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 28px;
  align-items: center;
  padding: 32px 0;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 0 4px;
}

.brand-link {
  font-weight: 900;
}

.topbar nav {
  display: flex;
  gap: 10px;
}

.topbar nav a {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--nav-surface);
  color: var(--muted);
  font-weight: 750;
}

.preference-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.preference-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.preference-controls select {
  width: auto;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--nav-surface);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 28px;
  align-items: stretch;
}

.brand-panel,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-panel {
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.brand-panel.compact {
  min-height: 480px;
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto -20% -30% 20%;
  height: 280px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.24), rgba(245, 158, 11, 0.18)),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(23, 33, 31, 0.08) 32px 34px);
  transform: rotate(-8deg);
}

.brand-panel > * {
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 18px;
  font-size: clamp(3.4rem, 7vw, 6.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.lead {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stats div {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.stats span {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
  color: var(--ink);
}

.stats small {
  color: var(--muted);
  line-height: 1.5;
}

.auth-panel {
  border-radius: 8px;
  padding: 24px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 750;
}

.tab.active {
  background: var(--tab-active);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(24, 38, 35, 0.1);
}

.form {
  display: none;
}

.form.active {
  display: grid;
  gap: 16px;
}

.form-head h2,
.dashboard h2 {
  margin-bottom: 8px;
  font-size: 1.65rem;
}

.form-head p,
.dashboard p {
  color: var(--muted);
  line-height: 1.55;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--field);
  color: var(--ink);
}

textarea {
  min-height: 120px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.primary,
.secondary,
.danger {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.link-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.primary {
  margin-top: 4px;
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.danger {
  padding: 0 14px;
  border: 1px solid rgba(225, 29, 72, 0.32);
  background: #fff1f2;
  color: var(--rose);
}

.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.86rem;
}

.dashboard {
  display: none;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.dashboard.active {
  display: grid;
}

.message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.message.success {
  color: var(--accent-strong);
}

.message.error {
  color: var(--rose);
}

.hidden {
  display: none !important;
}

.workspace,
.manager-panel,
.data-card,
.intro-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 58px rgba(24, 38, 35, 0.1);
}

.workspace {
  margin-top: 24px;
  padding: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h1,
.section-head h2 {
  margin-bottom: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-login-panel {
  width: min(460px, 100%);
  margin: 48px auto 0;
}

.admin-login-panel .form-head h1 {
  max-width: none;
  margin-bottom: 4px;
  font-size: clamp(2rem, 5vw, 2.55rem);
  line-height: 1.08;
  text-wrap: balance;
}

.google-login {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.admin-login-panel #adminLoginMessage:empty {
  display: none;
}

.manager-panel {
  padding: 22px;
}

.manager-panel.wide {
  grid-column: 1 / -1;
}

.manager-panel h2 {
  margin-bottom: 18px;
  font-size: 1.3rem;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.inline-form label {
  font-size: 0.88rem;
}

.company-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.button-row {
  display: flex;
  align-items: end;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.check-grid,
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.company-list {
  display: grid;
  gap: 10px;
}

.company-row {
  width: 100%;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.company-row strong,
.company-row small {
  display: block;
}

.company-row small {
  margin-top: 4px;
  color: var(--muted);
}

.company-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.company-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.company-meta .pill-row {
  margin: 0;
}

.active-pill {
  background: var(--ink);
  color: white;
}

.workspace-tabs {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wide-field {
  grid-column: 1 / -1;
}

.sticky-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.sticky-note {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(23, 33, 31, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(24, 38, 35, 0.1);
  color: #17211f;
}

.sticky-note p {
  white-space: pre-wrap;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.check-item input {
  width: 18px;
  min-height: 18px;
}

.check-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.data-card,
.intro-panel {
  padding: 18px;
}

.data-card h3,
.intro-panel h3 {
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.muted-pill {
  background: var(--field);
  color: var(--muted);
}

@media (max-width: 900px) {
  .shell,
  .hero-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .brand-panel {
    min-height: auto;
    gap: 36px;
  }

  .brand-panel::after {
    display: none;
  }

  .admin-grid,
  .inline-form,
  .company-form,
  .check-grid,
  .item-grid,
  .sticky-grid {
    grid-template-columns: 1fr;
  }

  .company-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .preference-controls {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
    gap: 10px;
  }

  .brand-panel,
  .auth-panel {
    padding: 20px;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
  }

  h1 {
    font-size: 3rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}
