:root {
  --bg: #f2ede5;
  --panel: rgba(255, 251, 245, 0.86);
  --panel-strong: #fffaf2;
  --text: #1f2528;
  --muted: #66706e;
  --line: rgba(31, 37, 40, 0.1);
  --accent: #c95f23;
  --accent-dark: #8b3f15;
  --teal: #1c676f;
  --success: #1f7a53;
  --warning: #a96707;
  --danger: #b6392f;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(49, 41, 24, 0.12);
  --font-display: "Aptos Display", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-body: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(201, 95, 35, 0.24), transparent 30%),
    radial-gradient(circle at top right, rgba(28, 103, 111, 0.18), transparent 28%),
    linear-gradient(180deg, #f6efe5 0%, #f1ece3 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.dashboard-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.45;
  mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
}

.dashboard-shell {
  min-height: 100vh;
  padding: 20px;
}

.login-screen {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
}

.login-brand,
.login-card,
.sidebar,
.workspace {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.login-brand {
  border-radius: var(--radius-xl);
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: auto -20% -20% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(28, 103, 111, 0.18), transparent 68%);
}

.brand-chip {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  box-shadow: 0 18px 36px rgba(28, 103, 111, 0.24);
}

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

.login-brand h1,
.login-card h2,
.workspace-topbar h1,
.sidebar-head h2,
.stat-card strong,
.view-title {
  font-family: var(--font-display);
}

.login-brand h1 {
  font-size: clamp(2.7rem, 5vw, 4.6rem);
  line-height: 0.95;
  margin: 16px 0 16px;
  max-width: 620px;
}

.supporting-text,
.login-card p,
.feature-list span,
.module-subtitle,
.stat-card small,
.empty-state p,
.table-wrap td,
.table-wrap th,
.list-card p,
.topbar-chip,
.metric-card span {
  color: var(--muted);
}

.feature-list {
  margin-top: 28px;
  display: grid;
  gap: 16px;
  max-width: 540px;
}

.feature-list article {
  padding: 18px 18px 18px 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(31, 37, 40, 0.07);
  display: grid;
  gap: 4px;
}

.login-card {
  border-radius: var(--radius-xl);
  padding: 36px;
  display: grid;
  align-content: center;
  gap: 20px;
}

.login-card__header h2 {
  font-size: 2.2rem;
  margin: 10px 0 8px;
}

.stack-form,
.form-grid,
.quote-form,
.sale-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(31, 37, 40, 0.1);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(28, 103, 111, 0.22);
  border-color: rgba(28, 103, 111, 0.32);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), #ea8e44);
  box-shadow: 0 16px 36px rgba(201, 95, 35, 0.26);
}

.btn-secondary {
  color: var(--text);
  background: white;
  border: 1px solid rgba(31, 37, 40, 0.08);
}

.btn-soft {
  color: var(--teal);
  background: rgba(28, 103, 111, 0.1);
}

.btn-danger {
  color: white;
  background: linear-gradient(135deg, #cf564d, #a53632);
}

.inline-message {
  min-height: 20px;
  font-weight: 700;
}

.demo-accounts {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed rgba(31, 37, 40, 0.12);
}

.demo-accounts h3 {
  margin: 0 0 10px;
}

.demo-accounts code {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(28, 103, 111, 0.1);
  color: var(--teal);
  font-weight: 800;
}

.app-shell {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
}

.hidden {
  display: none;
}

.sidebar {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.sidebar-head h2 {
  margin: 10px 0 0;
  font-size: 1.5rem;
}

.sidebar-user {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(31, 37, 40, 0.07);
  align-items: center;
}

.sidebar-user span {
  display: block;
  color: var(--muted);
}

.user-badge {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal), var(--accent));
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  color: var(--text);
  background: transparent;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(31, 37, 40, 0.08);
}

.nav-item small {
  color: var(--muted);
  font-weight: 700;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.workspace {
  border-radius: var(--radius-xl);
  padding: 24px;
  overflow: hidden;
}

.workspace-topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 24px;
}

.workspace-topbar h1 {
  margin: 10px 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.topbar-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(31, 37, 40, 0.08);
  font-weight: 700;
}

.topbar-chip--accent {
  background: rgba(201, 95, 35, 0.12);
  color: var(--accent-dark);
}

.view-root {
  display: grid;
  gap: 20px;
}

.stats-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card,
.metric-card,
.module-card,
.list-card,
.note-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(31, 37, 40, 0.08);
  box-shadow: 0 16px 38px rgba(49, 41, 24, 0.07);
}

.stat-card small,
.metric-card span {
  display: block;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
}

.stat-card strong,
.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 2rem;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.module-header h2,
.split-title {
  margin: 8px 0 0;
  font-size: 1.5rem;
  font-family: var(--font-display);
}

.split-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}

.form-actions,
.inline-actions,
.filters-row,
.summary-strip,
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

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

.table-wrap th,
.table-wrap td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(31, 37, 40, 0.08);
}

.table-wrap th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tag {
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(28, 103, 111, 0.12);
  color: var(--teal);
}

.tag.low {
  background: rgba(185, 57, 47, 0.12);
  color: var(--danger);
}

.tag.warn {
  background: rgba(169, 103, 7, 0.12);
  color: var(--warning);
}

.tag.success {
  background: rgba(31, 122, 83, 0.12);
  color: var(--success);
}

.muted {
  color: var(--muted);
}

.empty-state {
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(31, 37, 40, 0.16);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 10px;
}

.empty-state.compact {
  padding: 16px 18px;
  text-align: left;
}

.asset-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(31, 37, 40, 0.08);
}

.asset-preview img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 37, 40, 0.08);
  padding: 8px;
}

.asset-preview__copy {
  display: grid;
  gap: 4px;
}

.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  color: white;
  font-weight: 800;
  box-shadow: 0 16px 36px rgba(31, 37, 40, 0.22);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  background: linear-gradient(135deg, #1f7a53, #2f9f73);
}

.toast--error {
  background: linear-gradient(135deg, #b6392f, #d65b50);
}

.two-columns {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.line-builder {
  display: grid;
  gap: 12px;
}

.builder-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr auto;
  gap: 10px;
  align-items: end;
}

.builder-row--sale {
  grid-template-columns: 0.9fr 1.1fr 0.6fr 0.7fr auto;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.permission-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(31, 37, 40, 0.08);
}

.permission-pill input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.report-bars {
  display: grid;
  gap: 12px;
}

.report-bar {
  display: grid;
  gap: 8px;
}

.report-bar__track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(31, 37, 40, 0.08);
  overflow: hidden;
}

.report-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--teal), var(--accent));
}

@media (max-width: 1180px) {
  .login-screen,
  .app-shell,
  .split-layout,
  .two-columns,
  .stats-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-rows: auto auto auto auto;
  }
}

@media (max-width: 760px) {
  .dashboard-shell {
    padding: 12px;
  }

  .login-brand,
  .login-card,
  .sidebar,
  .workspace {
    padding: 20px;
    border-radius: 22px;
  }

  .workspace-topbar,
  .module-header {
    flex-direction: column;
  }

  .builder-row,
  .builder-row--sale,
  .permissions-grid {
    grid-template-columns: 1fr;
  }
}
