:root {
  color-scheme: light;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-body-bg: #f5f7f8;
  --bs-body-color: #162321;
  --bs-border-color: #d8e0de;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f2;
  --text: #162321;
  --muted: #62716e;
  --line: #d8e0de;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #c2410c;
  --success: #15803d;
  --danger: #b91c1c;
  --warning: #b45309;
  --shadow: 0 16px 42px rgba(21, 32, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 44px;
  background: #0b2f2b;
  color: #f8fffd;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #f97316;
  color: #fff;
  font-weight: 900;
}

.auth-copy h1 {
  max-width: 620px;
  margin: 0 0 18px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 560px;
  color: #cde2de;
  font-size: 1.05rem;
  line-height: 1.65;
}

.auth-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.auth-stat {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.auth-stat strong {
  display: block;
  font-size: 1.5rem;
}

.auth-stat span {
  color: #b8d0cb;
  font-size: 0.84rem;
}

.auth-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.form-card {
  width: min(100%, 460px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-card h2,
.section-title h2 {
  margin: 0;
  font-size: 1.45rem;
}

.form-card p,
.section-title p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 22px 0;
  padding: 5px;
  border-radius: 8px;
  background: var(--surface-2);
}

.tab {
  height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #31413e;
  font-size: 0.84rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: 0;
}

.field .form-control,
.field .form-select,
.filters .form-control,
.filters .form-select,
.toolbar .form-select {
  min-height: 42px;
  border-color: var(--line);
  border-radius: var(--bs-border-radius);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field .form-control:focus,
.field .form-select:focus,
.filters .form-control:focus,
.filters .form-select:focus,
.toolbar .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.14);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--bs-border-radius);
  font-weight: 750;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
}

.btn-outline-secondary {
  --bs-btn-color: var(--text);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-border-color: var(--line);
  --bs-btn-hover-color: var(--text);
}

.btn-danger {
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
}

.muted-link {
  background: transparent;
  color: var(--primary-dark);
  font-weight: 800;
}

.app-shell {
  display: block;
  min-height: 100vh;
  padding-top: 72px;
}

.app-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 24px;
  backdrop-filter: blur(12px);
}

.header-brand,
.header-actions,
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--text);
  font-size: 0.9rem;
}

.header-user span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

.menu-toggle {
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(7, 20, 18, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.menu-open .menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 19;
  width: min(310px, 86vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid var(--line);
  border-left: 0;
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}

.menu-open .sidebar {
  transform: translateX(0);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-radius: 7px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 750;
}

.nav button.active,
.nav button:hover {
  background: var(--surface-2);
  color: var(--primary-dark);
}

.side-footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.86rem;
}

.content {
  min-width: 0;
  padding: 26px;
  width: min(1500px, 100%);
  margin: 0 auto;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: 0;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-entry {
  margin-bottom: 18px;
}

.quick-entry-panel .upload-box {
  min-height: 180px;
}

.metric,
.panel,
.table-wrap,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(21, 32, 30, 0.05);
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
}

.metric small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 16px;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  gap: 16px;
}

.panel {
  padding: 18px;
}

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

.panel h3 {
  margin: 0;
  font-size: 1.05rem;
}

.panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px dashed #9bb0ac;
  border-radius: 8px;
  background: #fbfdfc;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.upload-box:hover,
.upload-box.is-dragging {
  border-color: var(--primary);
  background: #f0fdfa;
  box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.12);
}

.upload-box strong {
  display: block;
  margin-bottom: 6px;
}

.upload-box input {
  width: 100%;
  margin-top: 12px;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

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

.quick-action {
  display: grid;
  gap: 8px;
  min-height: 108px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.quick-action b {
  color: var(--primary-dark);
}

.quick-action span {
  color: var(--muted);
  font-size: 0.87rem;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  background: #f8faf9;
  color: #41504d;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: #263532;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e7f4f2;
  color: var(--primary-dark);
  font-size: 0.79rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.warn {
  background: #fff0dc;
  color: var(--warning);
}

.pill.danger {
  background: #fee2e2;
  color: var(--danger);
}

.chart-panel {
  padding: 18px;
}

.chart {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr minmax(90px, auto);
  align-items: center;
  gap: 12px;
}

.bar-label {
  min-width: 0;
  color: #32413e;
  font-weight: 750;
}

.bar-track {
  height: 20px;
  border-radius: 999px;
  background: #e8eeee;
  overflow: hidden;
}

.bar {
  height: 100%;
  min-width: 3px;
  border-radius: 999px;
  background: var(--primary);
}

.bar-value {
  color: #263532;
  font-weight: 850;
  text-align: right;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 20, 18, 0.48);
}

.modal {
  position: static;
  display: block;
  width: min(680px, 100%);
  max-height: min(88vh, 880px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-body {
  padding: 20px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.alert {
  margin-top: 14px;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 750;
}

.hidden {
  display: none !important;
}

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

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

@media (max-width: 720px) {
  .auth-panel,
  .content {
    padding: 20px;
  }

  .app-shell {
    padding-top: 66px;
  }

  .app-header {
    min-height: 66px;
    padding: 10px 14px;
  }

  .app-header .mark {
    width: 34px;
    height: 34px;
  }

  .header-user {
    display: none;
  }

  .auth-stats,
  .metrics,
  .filters,
  .row,
  .quick-actions {
    grid-template-columns: 1fr;
  }

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

  .toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar .btn,
  .toolbar select {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .bar-value {
    text-align: left;
  }
}
