:root {
  --ink: #142033;
  --muted: #66758a;
  --line: #d6e1ea;
  --paper: #f6f9fb;
  --card: #ffffff;
  --brand: #0c9488;
  --brand-dark: #0f5f61;
  --night: #101d2d;
  --mist: #e7f4f2;
  --shadow: 0 24px 80px rgba(20, 32, 51, 0.16);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(12, 148, 136, 0.22), transparent 34rem),
    linear-gradient(135deg, #eef7f5 0%, #f7f8fb 52%, #f3efe8 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  font-weight: 800;
  cursor: pointer;
}

a {
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ghost {
  margin-top: 0.8rem;
  color: var(--brand-dark);
  background: transparent;
  border: 1px solid var(--line);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 1.4rem;
  width: min(1120px, 100%);
}

.hero-card,
.login-card,
.intro-panel,
.calculator-card,
.empty-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: clamp(2rem, 4vw, 4rem);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(16, 29, 45, 0.96), rgba(15, 95, 97, 0.88)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.25), transparent 18rem);
}

.hero-card h1 {
  max-width: 760px;
  margin: 0.4rem 0 1rem;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
}

.lead {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.12rem;
  line-height: 1.7;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}


.pill {
  border-radius: 999px;
  padding: 0.48rem 0.78rem;
  color: var(--brand-dark);
  background: var(--mist);
  font-size: 0.85rem;
  font-weight: 800;
}

.login-card {
  align-self: stretch;
  padding: 2rem;
}

.login-card h2 {
  margin-top: 0;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

form {
  display: grid;
  gap: 0.9rem;
}

label {
  color: #344862;
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  color: var(--ink);
  background: #fff;
}

.hint,
.message {
  color: var(--muted);
}

.profile-note {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.message[data-tone="success"] {
  color: var(--brand-dark);
}

.message[data-tone="error"] {
  color: #a33b3b;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1rem, 3vw, 3rem);
  color: #fff;
  background: var(--night);
}

.topbar h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  letter-spacing: -0.07em;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.workspace {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto;
}

.intro-panel {
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.intro-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 1.5rem;
  align-items: start;
}

.intro-panel-head h2 {
  margin: 0 0 0.65rem;
}

.intro-panel-head p {
  max-width: 720px;
  margin: 0;
  line-height: 1.55;
}

.search-field {
  display: grid;
  gap: 0.45rem;
  align-self: start;
  color: #344862;
  font-weight: 800;
}

.search-field span {
  font-size: 0.85rem;
}

.search-field input {
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 54px;
  padding: 0.95rem 1.05rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.compact-search {
  width: min(360px, 100%);
  justify-self: end;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.calculator-list {
  display: grid;
  gap: 0.7rem;
}

.calculator-list-header,
.calculator-list-row {
  display: grid;
  grid-template-columns: 52px minmax(230px, 1.25fr) 0.38fr 0.3fr 0.38fr 0.55fr minmax(210px, 0.8fr) 250px;
  gap: 1rem;
  align-items: center;
}

.calculator-list-header {
  border-radius: 18px;
  padding: 1rem 1.2rem;
  color: #496077;
  background: #eaf4f4;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculator-list-row {
  border: 1px solid rgba(214, 225, 234, 0.95);
  border-radius: 24px;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(20, 32, 51, 0.11);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.pagination-button {
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: none;
}

.pagination-button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.calculator-main-cell {
  display: grid;
  gap: 0.45rem;
}

.number-cell {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 15px;
  color: var(--brand-dark);
  background: var(--mist);
  font-weight: 900;
}

.number-cell span {
  display: none;
}

.card-number {
  display: inline-grid;
  width: max-content;
  min-width: 42px;
  place-items: center;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  margin-bottom: 0.7rem;
  color: var(--brand-dark);
  background: var(--mist);
  font-weight: 900;
}

.calculator-main-cell .pill {
  justify-self: start;
}

.calculator-main-cell strong {
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.calculator-main-cell small,
.metric-cell span,
.price-cell span {
  color: var(--muted);
}

.metric-cell,
.price-cell {
  display: grid;
  gap: 0.25rem;
}

.metric-cell span,
.price-cell span {
  display: none;
  font-size: 0.78rem;
  font-weight: 800;
}

.metric-cell strong {
  font-size: 1.05rem;
}

.price-cell strong {
  font-size: 1.12rem;
}

.price-cell small {
  color: #344862;
  font-weight: 800;
}

.row-actions,
.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.row-action,
.small-action {
  min-width: 76px;
  padding: 0.72rem 0.9rem;
  border-radius: 14px;
  font-size: 0.9rem;
}

.small-action {
  color: var(--brand-dark);
  background: var(--mist);
}

.ghost-action {
  color: var(--brand-dark);
  background: #eef5f7;
  border: 1px solid var(--line);
}

.danger-action {
  color: #8a2f2f;
  background: #f8e9e9;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(16, 29, 45, 0.46);
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  padding: 1.6rem;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}

.calculator-card,
.empty-card {
  padding: 1.4rem;
}

.calculator-card h3 {
  margin: 1rem 0 0.45rem;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.calculator-card p {
  color: var(--muted);
  line-height: 1.6;
}

.primary-link,
.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  font-weight: 900;
  text-decoration: none;
}

.top-link {
  color: var(--night);
  background: #fff;
}

dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin: 1.2rem 0;
}

dl div {
  border-radius: 16px;
  padding: 0.8rem;
  background: var(--paper);
}

.wide-definition {
  grid-column: 1 / -1;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
}

dd {
  margin: 0.2rem 0 0;
  font-weight: 900;
}

.calculator-workspace {
  display: grid;
  gap: 1rem;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 1rem;
}

.quote-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px;
  padding: 1.4rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-title-row h2,
.result-card h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.05em;
}

.card-title-row p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem;
  background: #eef5f7;
}

.mode-button {
  color: #496077;
  background: transparent;
  box-shadow: none;
}

.mode-button.active {
  color: var(--night);
  background: #fff;
  box-shadow: 0 10px 30px rgba(20, 32, 51, 0.12);
}

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

.portal-summary {
  margin-top: 1.2rem;
}

.result-card {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.result-stack {
  display: grid;
  gap: 0.8rem;
}

.result-stack > div {
  border-radius: 22px;
  padding: 1rem;
  background: var(--paper);
}

.result-stack span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-stack strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.5rem;
}

.result-stack small {
  display: block;
  margin-top: 0.25rem;
  color: #344862;
  font-weight: 800;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.mini-grid span {
  color: var(--muted);
}

.mini-grid strong {
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.82rem;
  text-align: left;
}

th {
  color: #344862;
  background: #edf5f7;
}

td:nth-child(2),
td:nth-child(3) {
  text-align: right;
  font-weight: 800;
}

.admin-data-table td,
.admin-data-table td:nth-child(2),
.admin-data-table td:nth-child(3) {
  text-align: left;
}

.admin-data-table th:last-child,
.admin-data-table td:last-child {
  text-align: right;
}

.archived-calculators-table th:nth-child(2),
.archived-calculators-table td:nth-child(2) {
  min-width: 170px;
  padding-left: 1.5rem;
}

.quote-history-card {
  margin-top: 1.2rem;
}

.quote-history-head {
  align-items: start;
}

.quote-history-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 0.75rem;
}

.export-link {
  min-height: 54px;
  white-space: nowrap;
}

.quote-history-table th:first-child,
.quote-history-table td:first-child {
  width: 58px;
  color: var(--brand-dark);
}

.quote-history-table small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-weight: 700;
}

.wide-modal {
  width: min(920px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
}

.quote-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.4rem;
}

.quote-detail-section {
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  background: var(--paper);
}

.quote-detail-section h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.detail-metric {
  display: grid;
  gap: 0.2rem;
  border-radius: 16px;
  padding: 0.75rem;
  background: #fff;
}

.detail-metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-metric strong {
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  transition: grid-template-columns 0.2s ease;
}

.admin-shell.sidebar-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 30px;
  padding: 1.1rem;
  color: #fff;
  background:
    radial-gradient(circle at 20% 15%, rgba(34, 211, 238, 0.24), transparent 32%),
    linear-gradient(145deg, #071928, #0d463f);
  box-shadow: var(--shadow);
}

.admin-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-sidebar .eyebrow {
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 0.25rem;
}

.sidebar-title {
  display: block;
  font-size: 1.18rem;
}

.sidebar-toggle {
  display: grid;
  min-width: 42px;
  min-height: 42px;
  place-items: center;
  border-radius: 14px;
  padding: 0.55rem;
  color: var(--brand-dark);
  background: #fff;
  box-shadow: none;
}

.admin-nav {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 0.78rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.admin-nav-item.active {
  color: var(--brand-dark);
  background: var(--mist);
}

.nav-short {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.75rem;
  font-weight: 900;
}

.admin-nav-item.active .nav-short {
  color: var(--brand-dark);
  background: #fff;
}

.admin-content {
  min-width: 0;
}

.admin-view {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-view.active {
  display: grid;
}

.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .admin-sidebar .eyebrow,
.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-collapsed .admin-sidebar {
  padding: 0.8rem;
}

.sidebar-collapsed .admin-sidebar-head {
  justify-content: center;
}

.sidebar-collapsed .admin-nav-item {
  justify-content: center;
  padding: 0.75rem;
}

.admin-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.wide-card {
  grid-column: 1 / -1;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.calculator-admin-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field.wide {
  grid-column: span 2;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #344862;
  font-weight: 800;
}

.check-row input {
  width: auto;
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .topbar,
  .user-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .quote-layout,
  .quote-detail-grid,
  .intro-panel-head,
  .compact-form,
  .admin-workspace,
  .admin-view,
  .admin-form,
  .calculator-admin-form,
  .card-title-row {
    grid-template-columns: 1fr;
  }

  .admin-shell,
  .admin-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .sidebar-collapsed .sidebar-title,
  .sidebar-collapsed .admin-sidebar .eyebrow,
  .sidebar-collapsed .nav-label {
    display: inline;
  }

  .sidebar-collapsed .admin-sidebar-head {
    justify-content: space-between;
  }

  .sidebar-collapsed .admin-nav-item {
    justify-content: flex-start;
  }

  .compact-search {
    width: 100%;
    justify-self: stretch;
  }

  .calculator-list-header {
    display: none;
  }

  .calculator-list-row {
    grid-template-columns: 1fr;
  }

  .number-cell {
    width: max-content;
    min-width: 42px;
    padding: 0 0.75rem;
  }

  .number-cell span {
    display: inline;
    margin-right: 0.2rem;
  }

  .metric-cell span,
  .price-cell span {
    display: block;
  }

  .row-action {
    width: 100%;
  }

  .row-actions,
  .action-cell {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-history-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .small-action {
    width: 100%;
  }

  .card-title-row {
    display: grid;
  }

  .field.wide {
    grid-column: auto;
  }
}
