:root {
  --bg: #eff3f8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #102033;
  --muted: #66758a;
  --line: rgba(16, 32, 51, 0.1);
  --primary: #0f4c81;
  --primary-strong: #0a3a63;
  --accent: #0f766e;
  --danger: #b42318;
  --success: #067647;
  --warning: #b54708;
  --shadow: 0 24px 60px rgba(15, 35, 62, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 76, 129, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.14), transparent 30%),
    linear-gradient(160deg, #eef4fb 0%, #f7fafc 42%, #edf1f7 100%);
  color: var(--text);
}

.theme-shell {
  min-height: 100vh;
}

.theme-login {
  display: grid;
  place-items: center;
}

.backdrop {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.35;
  pointer-events: none;
}

.aura-left {
  top: -8rem;
  left: -8rem;
  background: rgba(15, 76, 129, 0.28);
}

.aura-right {
  right: -8rem;
  bottom: -8rem;
  background: rgba(15, 118, 110, 0.22);
}

.login-layout {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
}

.login-brand,
.login-card,
.content-shell,
.panel-card,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-brand,
.login-card {
  border-radius: var(--radius-xl);
  padding: 36px;
}

.login-brand h1 {
  margin: 16px 0;
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 0.95;
}

.login-brand p,
.subtle,
.pagination-row,
.detail-value,
.stack-list p {
  color: var(--muted);
}

.pill,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
}

.login-points {
  margin: 28px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.login-card-header h2,
.topbar h2,
.panel-head h3,
.panel-card h3 {
  margin: 8px 0 6px;
}

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

label span {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
}

select {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
}

button,
.ghost-link {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.secondary-button {
  color: white;
  background: linear-gradient(135deg, var(--accent), #0b5c56);
}

.ghost-button,
.ghost-link {
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.error-text {
  min-height: 20px;
  color: var(--danger);
}

.app-shell {
  width: min(1440px, calc(100% - 16px));
  margin: 0 auto;
  padding: 8px 0 16px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(15, 76, 129, 0.1);
  color: var(--primary);
}

.content-shell {
  border-radius: var(--radius-xl);
  padding: 18px;
}

.content-shell-full {
  width: 100%;
}

.topbar,
.panel-head,
.topbar-actions,
.pagination-row,
.search-form {
  display: flex;
  align-items: center;
}

.topbar,
.panel-head,
.pagination-row {
  justify-content: space-between;
}

.topbar {
  gap: 16px;
  margin-bottom: 12px;
}

.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-actions,
.search-form {
  gap: 12px;
  flex-wrap: wrap;
}

.chart-filter-row {
  justify-content: flex-end;
  align-items: center;
  min-height: 42px;
  row-gap: 10px;
}

.chart-filter-input,
.chart-filter-select {
  min-height: 42px;
}

.chart-filter-input {
  width: 148px;
  padding: 10px 14px;
}

.chart-filter-select {
  min-width: 220px;
}

.chart-filter-select-tight {
  min-width: 152px;
}

.chart-filter-select-wide {
  min-width: 196px;
}

.chart-filter-button {
  min-height: 42px;
  white-space: nowrap;
}

.panel-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  width: 100%;
}

.search-form-inline {
  display: flex;
  align-items: flex-end;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.export-form-inline {
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
}

.invoice-tools-row {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 14px;
}

.invoice-export-form {
  justify-content: flex-start;
  width: 100%;
}

.invoice-export-field {
  width: min(920px, 100%);
}

.invoice-input-row {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.invoice-month-select {
  min-width: 260px;
  flex: 0 0 260px;
}

.invoice-input-row .export-date-input {
  flex: 0 0 128px;
}

.invoice-input-row .export-button {
  flex: 0 0 auto;
}

.reset-password-form {
  width: 100%;
}

.subscription-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.subscription-side-stack {
  display: contents;
}

.reset-password-grid {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.reset-password-grid .search-field {
  width: min(280px, 100%);
}

#extend-subscription-form .search-field-label,
#account-limit-form .search-field-label,
#amount-per-client-form .search-field-label {
  min-height: 38px;
  display: flex;
  align-items: center;
}

#extend-subscription-form .search-field,
#account-limit-form .search-field {
  width: min(180px, 100%);
}

.field-helper {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.label-helper {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

#amount-per-client-form .search-field-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
}

#extend-subscription-form input,
#account-limit-form input,
#amount-per-client-form input {
  min-height: 56px;
}

#amount-per-client-form .reset-password-grid {
  justify-content: flex-start;
}

#amount-per-client-form .search-field {
  width: min(260px, 100%);
  margin-inline: 0;
  text-align: left;
}

.reset-password-status {
  margin-top: 10px;
}

.status-text {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.status-text.success {
  color: var(--success);
  background: rgba(6, 118, 71, 0.12);
  border-color: rgba(6, 118, 71, 0.24);
}

.status-text.warning {
  color: var(--warning);
  background: rgba(181, 71, 8, 0.14);
  border-color: rgba(181, 71, 8, 0.22);
}

.status-text.danger {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
  border-color: rgba(180, 35, 24, 0.24);
}

.app-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  min-width: 240px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  box-shadow: 0 20px 40px rgba(18, 38, 63, 0.16);
  font-weight: 700;
  backdrop-filter: blur(14px);
}

.app-toast.success {
  color: #f4fff8;
  background: linear-gradient(135deg, #0d6b4d, #15836e);
}

.app-toast.warning {
  color: #fff9ef;
  background: linear-gradient(135deg, #a6540d, #c46b17);
}

.app-toast.danger {
  color: #fff5f4;
  background: linear-gradient(135deg, #a82822, #c3422b);
}

.wastage-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.search-field {
  width: min(320px, 100%);
}

.sort-field {
  width: min(220px, 100%);
}

.export-field {
  width: min(430px, 100%);
}

.export-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-date-input {
  width: 128px;
  min-height: 42px;
  padding: 10px 12px;
}

.export-button {
  min-height: 42px;
  white-space: nowrap;
}

.range-toggle-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.range-toggle-button.active-toggle {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
}

.search-input-wrap {
  width: 100%;
}

.search-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.tab-toggle-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.account-filter-row {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.account-filter-input {
  width: min(320px, 100%);
  min-height: 42px;
  padding: 10px 14px;
}

.active-toggle {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
}

.wastage-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.inline-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
  white-space: nowrap;
}

.wastage-meta {
  align-self: center;
  margin-right: 4px;
}

.search-input-wrap input {
  min-width: 0;
  width: 100%;
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(16, 32, 51, 0.04);
}

.search-submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.search-submit-block {
  margin-top: 8px;
  min-height: 40px;
  min-width: 92px;
}

#download-wastage-report.compact-button {
  padding-inline: 12px;
  min-height: 40px;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.dashboard-grid-tight {
  margin-bottom: 14px;
}

.user-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.stats-grid,
.dashboard-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.user-page-stack {
  grid-template-columns: 1fr;
}

.dashboard-grid-compact {
  grid-template-columns: minmax(320px, 420px);
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card,
.panel-card {
  border-radius: var(--radius-lg);
}

.stat-card {
  padding: 20px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 800;
}

.panel-card {
  padding: 22px;
}

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

.panel-full {
  grid-column: 1 / -1;
}

.compact-button {
  padding: 9px 14px;
  font-size: 13px;
}

.icon-button {
  min-width: 44px;
  padding: 10px 12px;
}

.chart-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.chart-meta {
  margin-top: 8px;
}

.chart-svg-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.chart-svg {
  display: block;
  min-width: 100%;
}

.chart-grid-line-svg {
  stroke: rgba(15, 76, 129, 0.16);
  stroke-width: 1;
}

.chart-axis-text-svg {
  font-size: 12px;
  font-weight: 700;
  fill: #5f738f;
}

.chart-bar-svg {
  filter: drop-shadow(0 10px 18px rgba(15, 76, 129, 0.12));
}

.chart-bar-value-svg {
  font-size: 12px;
  font-weight: 800;
  fill: #1f2f44;
}

.chart-bar-label-svg {
  font-size: 11px;
  fill: #627692;
}

.chart-bar-growth-svg {
  font-size: 10px;
  fill: #627692;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-top: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.72);
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: rgba(15, 76, 129, 0.06);
}

.data-table tbody tr.highlight-row {
  background: rgba(15, 76, 129, 0.12);
  box-shadow: inset 3px 0 0 var(--primary);
}

.stack-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stack-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
}

.stack-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-chip.success {
  color: var(--success);
  background: rgba(6, 118, 71, 0.12);
}

.status-chip.warning {
  color: var(--warning);
  background: rgba(181, 71, 8, 0.14);
}

.status-chip.danger {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
}

.table-action-button {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 10px;
}

.detail-field {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-value {
  margin-top: 8px;
  color: var(--text);
  font-weight: 700;
}

.billing-detail-block {
  display: grid;
  gap: 6px;
}

.billing-detail-line {
  color: var(--text);
  font-weight: 700;
  line-height: 1.4;
}

.billing-detail-meta {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 76, 129, 0.08);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.output-box {
  min-height: 140px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #112133;
  color: #e6eef9;
  white-space: pre-wrap;
  overflow: auto;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .login-layout,
  .app-shell {
    width: min(100% - 12px, 1440px);
  }

  .panel-wide {
    grid-column: span 1;
  }

  .panel-full {
    grid-column: span 1;
  }

  .dashboard-grid-compact {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-filter-row {
    width: 100%;
    justify-content: flex-start;
  }

  .chart-filter-input,
  .chart-filter-select,
  .chart-filter-select-tight,
  .chart-filter-select-wide {
    width: 100%;
    min-width: 0;
  }

  .chart-svg {
    min-width: 640px;
  }

  .panel-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .search-form-inline {
    width: 100%;
    justify-content: flex-start;
  }

  .export-form-inline {
    width: 100%;
    justify-content: flex-start;
  }

  .invoice-tools-row {
    justify-content: flex-start;
  }

  .invoice-input-row {
    justify-content: flex-start;
  }

  .wastage-action {
    align-items: flex-start;
  }

  .reset-password-grid .search-field {
    width: 100%;
  }

  .subscription-tools-grid {
    grid-template-columns: 1fr;
  }

  .search-field,
  .sort-field,
  .export-field {
    width: 100%;
  }

  .export-input-row {
    flex-wrap: wrap;
  }

  .export-date-input {
    width: 100%;
  }

  .search-input-wrap {
    width: 100%;
  }

  .search-input-wrap input {
    min-width: 220px;
  }
}
