/* ======================================
   CUSTO 3D — DESIGN SYSTEM
   ====================================== */

:root {
  /* Colors — warm, professional palette */
  --bg-page: #f5f3f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf8;
  --bg-input: #f7f6f4;
  --bg-input-focus: #ffffff;

  --border: #e5e2dc;
  --border-focus: #c4a882;
  --border-light: #eeece8;

  --text-primary: #2c2825;
  --text-secondary: #7a7470;
  --text-tertiary: #a8a29e;
  --text-inverse: #ffffff;

  --accent: #c4884d;
  --accent-hover: #b07840;
  --accent-light: #fdf3ea;
  --accent-subtle: #f5e6d5;

  --success: #3d8b68;
  --success-light: #eaf5f0;
  --danger: #c45454;
  --danger-light: #fdf0f0;

  --price-bg: #2c2825;
  --price-text: #f5e6d5;

  /* Typography */
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(44, 40, 37, 0.06);
  --shadow-md: 0 4px 12px rgba(44, 40, 37, 0.08);
  --shadow-lg: 0 8px 24px rgba(44, 40, 37, 0.1);
}

/* ======================================
   RESET & BASE
   ====================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ======================================
   APP CONTAINER
   ====================================== */

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ======================================
   HEADER
   ====================================== */

.header {
  margin-bottom: 28px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon {
  width: 48px;
  height: 48px;
  background: var(--price-bg);
  color: var(--price-text);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 1px;
}

/* ======================================
   TABS NAVIGATION
   ====================================== */

.tabs-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.tab-btn.active {
  background: var(--price-bg);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.tab-btn.active svg {
  opacity: 1;
}

.tab-btn svg {
  opacity: 0.6;
  flex-shrink: 0;
}

/* ======================================
   PAGES
   ====================================== */

.page {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page.active {
  display: block;
}

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

/* ======================================
   SECTION HEADER
   ====================================== */

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

.section-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.section-header p {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ======================================
   CALCULATOR LAYOUT
   ====================================== */

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 48px;
}

.calc-form,
.calc-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

/* ======================================
   FORM ELEMENTS
   ====================================== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Plain text input (no addon) */
.form-group > input[type="text"],
.form-group > input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group > input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group > input::placeholder {
  color: var(--text-tertiary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ======================================
   INPUT GROUP (prefix/suffix — FLEX based)
   No absolute positioning!
   ====================================== */

.input-group {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.input-group:focus-within {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input-addon {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
}

.input-addon.prefix {
  padding-left: 12px;
  padding-right: 2px;
}

.input-addon.suffix {
  padding-right: 12px;
  padding-left: 2px;
}

.input-group input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-primary);
  padding: 10px 12px;
}

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

/* Remove native number input spinners */
.input-group input[type="number"]::-webkit-outer-spin-button,
.input-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-group input[type="number"] {
  -moz-appearance: textfield;
}

/* ======================================
   TIME INPUTS
   ====================================== */

.time-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-inputs .input-group {
  flex: 1;
}

.time-separator {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

/* ======================================
   MARGIN SLIDER
   ====================================== */

.margin-control {
  margin-top: 24px;
  margin-bottom: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.margin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.margin-header label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.margin-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 50px;
  text-align: right;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(44, 40, 37, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(44, 40, 37, 0.2);
  cursor: pointer;
}

.margin-range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* ======================================
   RESULTS PANEL
   ====================================== */

.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.results-empty p {
  margin-top: 12px;
  font-size: 0.875rem;
}

/* Cost breakdown */
.cost-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cost-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.cost-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cost-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-color);
  flex-shrink: 0;
}

.cost-value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.cost-separator {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

.cost-line.subtotal .cost-label,
.cost-line.subtotal .cost-value {
  font-weight: 600;
  color: var(--text-primary);
}

.cost-line.total {
  padding-top: 4px;
}

.cost-line.total .cost-label {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.cost-line.total .cost-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}

/* Batch info */
.batch-info {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.batch-info .cost-value {
  color: var(--accent);
}

/* Price card */
.price-card {
  margin-top: 20px;
  padding: 20px;
  background: var(--price-bg);
  border-radius: var(--radius-md);
  text-align: center;
}

.price-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.price-card .price-label {
  color: rgba(245, 230, 213, 0.6);
}

.price-input-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 6px 0;
}

.price-currency {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--price-text);
  opacity: 0.8;
}

.price-input {
  background: transparent;
  border: none;
  border-bottom: 2px dashed rgba(245, 230, 213, 0.35);
  color: var(--price-text);
  font-family: var(--font);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  width: 160px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  border-radius: 4px;
  padding: 2px 4px;
}

.price-input:hover {
  border-bottom-color: var(--price-text);
}

.price-input:focus {
  border-bottom-style: solid;
  border-bottom-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-input[type="number"] {
  -moz-appearance: textfield;
}

.price-margin {
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(245, 230, 213, 0.5);
}

.price-margin strong {
  color: rgba(245, 230, 213, 0.8);
}

/* Batch price info */
.batch-price-info {
  margin-top: 10px;
  text-align: center;
  padding: 12px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

.price-label-small {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.price-value-small {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Save button */
.btn-save {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  margin-top: 16px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-save:hover {
  background: var(--bg-input);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-save:active {
  transform: scale(0.98);
}

/* ======================================
   SETTINGS FORM
   ====================================== */

.settings-form {
  max-width: 540px;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.settings-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.settings-group-title svg {
  color: var(--accent);
}

.settings-group .form-group {
  margin-bottom: 16px;
}

.settings-group .form-group:last-child {
  margin-bottom: 0;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: scale(0.97);
}

.save-feedback {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.save-feedback.visible {
  opacity: 1;
}

/* ======================================
   HISTORY
   ====================================== */

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 20px;
  color: var(--text-tertiary);
}

.history-empty p {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.history-hint {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* History Item */
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  gap: 16px;
}

.history-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-subtle);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.775rem;
  color: var(--text-tertiary);
}

.history-item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-item-prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.history-item-cost {
  font-size: 0.775rem;
  color: var(--text-tertiary);
}

.history-item-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.history-item-actions {
  flex-shrink: 0;
}

.btn-delete {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ======================================
   TOAST
   ====================================== */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--price-bg);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 1000;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ======================================
   RESPONSIVE
   ====================================== */

@media (max-width: 720px) {
  .app {
    padding: 16px 14px 48px;
  }

  .calc-layout {
    grid-template-columns: 1fr;
  }

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

  .tab-btn {
    font-size: 0.8rem;
    padding: 10px 10px;
    gap: 5px;
  }

  .tab-btn svg {
    width: 16px;
    height: 16px;
  }

  .price-value {
    font-size: 1.7rem;
  }

  .header-title {
    font-size: 1.25rem;
  }

  .history-item {
    flex-wrap: wrap;
  }

  .history-item-prices {
    align-items: flex-start;
  }

  .settings-form {
    max-width: 100%;
  }
}

/* ======================================
   MATERIALS MANAGEMENT & SELECTION
   ====================================== */

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-secondary:active {
  transform: scale(0.98);
}

.materials-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.material-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.material-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.material-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.material-item-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.btn-delete-mat {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete-mat:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.materials-empty {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-style: italic;
  padding: 8px 0;
}

/* Calculator Additional Materials */
.calc-materials-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.calc-materials-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.calc-mat-empty {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.calc-mat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-mat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

.calc-mat-item:has(.calc-mat-checkbox:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.calc-mat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
}

.calc-mat-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.calc-mat-name {
  font-weight: 500;
  color: var(--text-primary);
}

.calc-mat-price {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.calc-mat-qty-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-mat-qty-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.calc-mat-qty {
  width: 54px;
  padding: 4px 6px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  text-align: center;
  font-family: var(--font);
  color: var(--text-primary);
}

/* Calculator Cost Toggles */
.calc-options-section {
  margin-top: 20px;
  margin-bottom: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.calc-options-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.calc-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.calc-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-primary);
  user-select: none;
  transition: all 0.2s ease;
}

.calc-option-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.calc-option-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ======================================
   AUTH & KIWIFY / SUPABASE LOCK SCREEN
   ====================================== */

.app.locked {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

/* Auth Overlay Modal */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
}

.auth-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Auth Card */
.auth-card {
  background: #1e222a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 2px rgba(255, 255, 255, 0.1);
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-overlay.visible .auth-card {
  transform: translateY(0);
}

.auth-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(230, 160, 90, 0.2), rgba(210, 130, 60, 0.1));
  border: 1px solid rgba(230, 160, 90, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #e6a05a;
}

.auth-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f5f5f7;
  margin-bottom: 8px;
}

.auth-card-subtitle {
  font-size: 0.9rem;
  color: #98a2b3;
  line-height: 1.5;
  margin-bottom: 24px;
}

.auth-form {
  text-align: left;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: #667085;
  pointer-events: none;
}

.input-with-icon .form-control {
  padding-left: 42px;
  height: 48px;
  font-size: 0.95rem;
  border-radius: 10px;
  background: #14171d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f5f5f7;
  width: 100%;
}

.input-with-icon .form-control:focus {
  border-color: #e6a05a;
  outline: none;
  box-shadow: 0 0 0 3px rgba(230, 160, 90, 0.15);
}

.btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #e6a05a, #d48740);
  color: #121418;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(230, 160, 90, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Kiwify CTA Button */
.btn-kiwify {
  margin-top: 14px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25);
}

.btn-kiwify:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
  color: #ffffff;
}

/* Messages */
.auth-message {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
}

.auth-message.info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.auth-message.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.auth-message.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.auth-message.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
}

/* User Profile Badge in Header */
.header-user-badge {
  display: flex;
  align-items: center;
}

.user-badge-content {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.825rem;
}

.user-email-text {
  font-weight: 500;
  color: #e2e8f0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.775rem;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

/* Micro Spinner */
.spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


