*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f2f2f7;
  --bg-gradient: linear-gradient(180deg, #f2f2f7 0%, #e8e8ee 100%);
  --card: #ffffff;
  --card-border: rgba(0, 0, 0, 0.06);
  --card-hover-border: rgba(0, 0, 0, 0.1);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #006edb;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --accent-soft-hover: rgba(0, 113, 227, 0.12);
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.08);
  --success: #34c759;
  --success-soft: rgba(52, 199, 89, 0.08);
  --warning: #ff9500;
  --warning-soft: rgba(255, 149, 0, 0.08);
  --info: #007aff;
  --info-soft: rgba(0, 122, 255, 0.08);
  --line: #d2d2d7;
  --line-light: #e5e5ea;
  --shadow-xs: 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'SFMono-Regular', 'JetBrains Mono', 'Fira Code', monospace;
  --topbar-blur: saturate(180%) blur(20px);
  --topbar-bg: rgba(242, 242, 247, 0.8);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --pie-empty: #e8e8ed;
  --level-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-gradient: linear-gradient(180deg, #000000 0%, #0a0a0a 100%);
  --card: #1c1c1e;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #636366;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-active: #007aff;
  --accent-soft: rgba(10, 132, 255, 0.12);
  --accent-soft-hover: rgba(10, 132, 255, 0.18);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.12);
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.12);
  --warning: #ff9f0a;
  --warning-soft: rgba(255, 159, 10, 0.12);
  --info: #0a84ff;
  --info-soft: rgba(10, 132, 255, 0.12);
  --line: #38383a;
  --line-light: #2c2c2e;
  --shadow-xs: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(0, 0, 0, 0.8);
  --pie-empty: #2c2c2e;
  --level-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

::placeholder {
  color: var(--text-tertiary);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  height: 56px;
  background: var(--topbar-bg);
  backdrop-filter: var(--topbar-blur);
  -webkit-backdrop-filter: var(--topbar-blur);
  border-bottom: 1px solid var(--line-light);
}

.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #5856d6);
  flex-shrink: 0;
}

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

.nav-link,
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover,
.nav-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-btn-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-full);
  font-size: 15px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-toggle .icon {
  line-height: 1;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 32px 48px;
}

.container.narrow {
  max-width: 640px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

section.card {
  margin-bottom: 20px;
}

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

.card-header h2 {
  margin: 0;
}

.card-header .badge {
  flex-shrink: 0;
}

.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  padding: 32px 36px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.hero h1 {
  margin: 2px 0 4px;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.hero-number {
  text-align: right;
  flex-shrink: 0;
}

.hero-number span {
  display: block;
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), #5856d6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-number small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  -webkit-text-fill-color: var(--text-secondary);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--accent);
  font-size: 11px;
}

.muted {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3 {
  margin-top: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}

h2 {
  font-size: 18px;
  font-weight: 650;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

label {
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--text-tertiary);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2398989d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

textarea {
  resize: vertical;
  font-family: var(--font);
  line-height: 1.5;
}

button,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.btn-primary:active {
  background: var(--accent-active);
  transform: translateY(0);
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft-hover);
  color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-tertiary);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition-fast);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-icon {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--accent-soft-hover);
  color: var(--accent-hover);
}

.inline-form {
  display: inline;
  margin: 0;
}

.stack {
  display: grid;
  gap: 16px;
}

.stack-sm {
  display: grid;
  gap: 10px;
}

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

.grid-form .span-2 {
  grid-column: 1 / -1;
}

.level-form {
  display: grid;
  gap: 12px;
}

.level-form-header {
  display: flex;
  gap: 12px;
  align-items: end;
}

.level-form-header label {
  flex: 1;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
}

.level-form-header .btn-primary {
  flex-shrink: 0;
  align-self: flex-end;
  min-height: 38px;
}

.level-target-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.target-label {
  flex: 1;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
}

.level-bucket-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.level-bucket-row:hover {
  border-color: var(--line);
}

.bucket-label {
  flex: 1;
  min-width: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
}

.monthly-label {
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
  width: 140px;
}

.money-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.money-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.money-input .currency {
  padding: 0 0 0 10px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  user-select: none;
}

.money-input input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 10px 10px 6px;
  outline: none;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.money-input input:focus {
  box-shadow: none;
  border-color: transparent;
}

.money-input.sm input {
  padding: 8px 8px 8px 4px;
  font-size: 13px;
}

.money-input.sm .currency {
  font-size: 13px;
  padding-left: 8px;
}

.target-status {
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.3;
}

.badge.deficit {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.surplus {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.met {
  background: var(--success-soft);
  color: var(--success);
}

.product-form {
  display: grid;
  gap: 16px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-row {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr 0.9fr 1fr 36px;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-md);
  background: var(--card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.product-row:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.product-row label {
  text-transform: none;
  letter-spacing: normal;
  font-size: 11px;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--line-light);
}

.form-footer label {
  flex: 1;
}

.grid {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

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

.bar {
  height: 6px;
  background: var(--line-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar.large {
  height: 10px;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5856d6);
  border-radius: inherit;
  transition: width var(--transition-slow);
}

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

.alloc-pie {
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-lg);
  background: var(--card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.alloc-pie:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.alloc-pie .pie-chart {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
}

.alloc-pie .pie-chart::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--card);
  z-index: 1;
}

.alloc-pie .pie-chart span {
  position: relative;
  z-index: 2;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.alloc-pie .pie-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text);
}

.alloc-pie .pie-amounts {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.alloc-pie .pie-amounts strong {
  color: var(--text);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.alert.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(255, 59, 48, 0.12);
}

.alert.success {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(52, 199, 89, 0.12);
}

.alert.info {
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid rgba(0, 122, 255, 0.12);
}

.levels {
  display: grid;
  gap: 10px;
}

details.level {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

details.level[open] {
  box-shadow: var(--level-shadow);
  border-color: var(--line-light);
}

details.level summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background var(--transition-fast);
}

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

details.level summary:hover {
  background: var(--accent-soft);
}

details.level summary::before {
  content: '';
  width: 4px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--line-light);
  flex-shrink: 0;
  transition: background var(--transition);
}

details.level[open] summary::before {
  background: var(--accent);
}

details.level.achieved summary::before {
  background: var(--success);
}

details.level summary .level-info {
  flex: 1;
  min-width: 0;
}

details.level summary .level-info strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

details.level summary .level-info small {
  display: block;
  color: var(--text-secondary);
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
}

.pill {
  display: inline-flex;
  min-width: 54px;
  justify-content: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.level.achieved .pill {
  background: var(--success-soft);
  color: var(--success);
}

.level-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--line-light);
}

.level-body .bar {
  margin: 16px 0;
}

.top-gap {
  display: block;
  margin-top: 12px;
}

.timeline {
  display: grid;
  gap: 12px;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  padding-left: 20px;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line-light);
}

.timeline li + li::after {
  content: '';
  position: absolute;
  left: 3px;
  top: -12px;
  width: 2px;
  height: 12px;
  background: var(--line-light);
}

.timeline li strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.timeline li > span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 2px;
}

.timestamp-line {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.timestamp-edit {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1;
}

.timestamp-edit:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.timestamp-form[hidden] {
  display: none;
}

.timestamp-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 8px;
}

.timestamp-form label {
  text-transform: none;
  letter-spacing: normal;
  font-size: 11px;
}

.timestamp-form input {
  padding: 8px 10px;
  font-size: 13px;
}

.timestamp-form button {
  min-height: 36px;
  padding: 8px 12px;
}

.mini-table {
  display: grid;
  gap: 0;
}

.mini-table > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  gap: 12px;
  border-bottom: 1px solid var(--line-light);
  font-size: 13px;
}

.mini-table > div:last-child {
  border-bottom: none;
}

.mini-table span {
  color: var(--text-secondary);
}

.mini-table strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.snapshot-row {
  display: grid !important;
  grid-template-columns: minmax(130px, 1fr) auto;
  align-items: start !important;
}

.snapshot-row .timestamp-form {
  grid-column: 1 / -1;
  width: 100%;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, var(--accent-soft) 0%, transparent 60%), var(--bg-gradient);
}

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-2xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s ease-out;
}

.login-card .eyebrow {
  margin-bottom: 4px;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.login-card .muted {
  margin-bottom: 24px;
}

.login-card .alert {
  margin-bottom: 16px;
}

.login-card input[type="password"] {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-scroll-to-current {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

.btn-scroll-to-current:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xl);
}

.btn-scroll-to-current:active {
  background: var(--accent-active);
  transform: translateY(0);
}

@media (max-width: 900px) {
  .grid.two,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .level-bucket-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .bucket-label {
    flex: 1 1 100%;
  }

  .monthly-label {
    width: auto;
    flex: 1;
  }

  .level-form-header {
    flex-wrap: wrap;
  }

  .level-form-header label {
    flex: 1 1 100%;
  }

  .level-form-header .btn-primary {
    width: 100%;
  }

  .level-target-row {
    flex-wrap: wrap;
  }

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

  .product-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 28px;
  }

  .hero-number {
    text-align: left;
  }

  .topbar {
    padding: 0 18px;
  }

  .container {
    padding: 18px 18px 32px;
  }

  section.card {
    padding: 20px;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .timestamp-form {
    grid-template-columns: 1fr;
  }

  details.level summary {
    padding: 14px 16px;
  }

  .level-body {
    padding: 0 16px 16px;
  }
}

@media (max-width: 520px) {
  .allocation-grid {
    grid-template-columns: 1fr;
  }

  .topbar .brand span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
