:root {
  --bg: #f3efe7;
  --surface: #fffdf8;
  --surface-strong: #fffaf0;
  --line: #ddd4c5;
  --ink: #1b2025;
  --muted: #6f675b;
  --brand: #0b6e5f;
  --brand-strong: #084d43;
  --brand-soft: #d9efe7;
  --accent: #d28b36;
  --danger: #9f3a2f;
  --shadow: 0 24px 60px rgba(35, 33, 27, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max: 1480px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(210, 139, 54, 0.14), transparent 24%),
    linear-gradient(180deg, #f8f4ed 0%, #f3efe7 100%);
  color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(248, 244, 237, 0.88);
  border-bottom: 1px solid rgba(221, 212, 197, 0.7);
}

.topbar-inner,
.hero,
.panel-grid,
.footer {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy span {
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.module-nav details {
  position: relative;
}

.module-nav summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.module-nav summary::-webkit-details-marker {
  display: none;
}

.module-nav details[open] summary,
.module-nav summary:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.module-nav-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  display: grid;
  gap: 2px;
  min-width: 215px;
  max-height: min(460px, calc(100vh - 150px));
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.module-nav details:not([open]) .module-nav-panel {
  display: none;
}

.module-nav details[open] .module-nav-panel {
  display: grid;
}

.module-nav-panel a {
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.module-nav-panel a:hover,
.module-nav-panel a:focus-visible {
  background: var(--brand-soft);
  outline: none;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  max-width: 245px;
  padding: 4px 8px 4px 5px;
  border-radius: 999px;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu summary:hover,
.user-menu[open] summary {
  background: var(--brand-soft);
}

.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a85a2a);
  box-shadow: 0 3px 10px rgba(90, 58, 27, 0.18);
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.avatar-photo {
  background: var(--surface);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-large {
  width: 44px;
  height: 44px;
  font-size: 14px;
}

.user-menu-label {
  min-width: 0;
  text-align: left;
}

.user-menu-label strong,
.user-menu-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-label strong {
  font-size: 13px;
}

.user-menu-label small {
  color: var(--muted);
  font-size: 11px;
}

.menu-caret {
  color: var(--muted);
  font-size: 15px;
}

.user-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  min-width: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-menu:not([open]) .user-menu-panel {
  display: none;
}

.user-menu-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 13px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.user-menu-identity strong,
.user-menu-identity span {
  display: block;
}

.user-menu-identity strong {
  font-size: 14px;
}

.user-menu-identity span:not(.avatar) {
  max-width: 178px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-panel a,
.user-menu-signout {
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-menu-panel a:hover,
.user-menu-panel a:focus-visible,
.user-menu-signout:hover,
.user-menu-signout:focus-visible {
  background: var(--brand-soft);
  outline: none;
}

.user-menu-panel form {
  margin: 3px 0 0;
  padding-top: 3px;
  border-top: 1px solid var(--line);
}

.user-menu-signout {
  color: var(--danger);
}

.profile-avatar-card {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 18px;
}

.profile-avatar-card .avatar-large {
  width: 88px;
  height: 88px;
  border-width: 3px;
  font-size: 22px;
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
}

.button,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}

.button {
  background: var(--brand);
  color: white;
  box-shadow: 0 16px 36px rgba(11, 110, 95, 0.2);
}

.button:hover {
  background: var(--brand-strong);
}

.was-validated :invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(159, 58, 47, 0.12);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 32px;
  padding: 56px 0 28px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

.hero-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.hero-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(246, 239, 228, 0.95));
  border: 1px solid rgba(221, 212, 197, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

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

.metric {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  border-radius: var(--radius-md);
  border: 1px solid rgba(221, 212, 197, 0.9);
}

.metric-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
}

.metric strong,
.metric span {
  display: block;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 18px 0 56px;
}

.panel {
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid rgba(221, 212, 197, 0.95);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.panel p,
.panel li {
  color: var(--muted);
}

.panel ul {
  padding-left: 18px;
  margin: 12px 0 0;
}

.panel-head,
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-bar {
  margin-bottom: 18px;
}

.filter-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.filter-inline .field,
.filter-inline .field-full {
  min-width: 180px;
  margin: 0;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

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

.data-table tfoot td {
  font-weight: 700;
}

.data-table .amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stack-note {
  display: grid;
  gap: 4px;
}

.stack-note small {
  color: var(--muted);
}

.period-status-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px dashed var(--line);
  color: var(--muted);
}

.status-grid {
  display: grid;
  gap: 12px;
}

.status-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.status-chip b {
  color: var(--brand-strong);
}

.footer {
  padding: 0 0 48px;
  color: var(--muted);
  font-size: 13px;
}

.footer-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(221, 212, 197, 0.8);
  border-radius: 18px;
  padding: 18px 20px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 760px);
  background: rgba(255, 253, 248, 0.95);
  border: 1px solid rgba(221, 212, 197, 0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(300px, 1.08fr);
}

.auth-aside {
  padding: 28px;
  background: linear-gradient(180deg, rgba(11, 110, 95, 0.94), rgba(8, 77, 67, 0.97));
  color: white;
}

.auth-form {
  padding: 30px;
}

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

.field,
.field-full {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

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

label {
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  min-height: 46px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(11, 110, 95, 0.16);
  border-color: var(--brand);
}

textarea {
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-size: 14px;
}

.alert-error {
  background: #fff1ef;
  color: #7b2d23;
  border: 1px solid #f1cbc6;
}

.alert-success {
  background: #e9f8f4;
  color: #0c5a4d;
  border: 1px solid #bee5db;
}

.helper-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.helper-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
}

.panel form {
  margin: 0;
}

.status-chip strong {
  display: block;
  color: var(--ink);
}

@media (max-width: 980px) {
  .hero,
  .panel-grid,
  .auth-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .stat-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .hero,
  .panel-grid,
  .footer {
    width: min(calc(100% - 20px), var(--max));
  }

  .hero {
    padding-top: 34px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .module-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .module-nav-panel {
    min-width: 210px;
    max-height: min(380px, calc(100vh - 140px));
  }

  .user-menu-label,
  .menu-caret {
    display: none;
  }

  .filter-inline {
    width: 100%;
  }

  .filter-inline .field,
  .filter-inline .field-full {
    min-width: 100%;
  }
}
