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

:root {
  --primary: #7c5aa8;
  --primary-dark: #6a4b90;
  --bg: #faf9fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --container-max: 980px;
  --panel-gap: 1rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.container { 
  width: 100%; 
  max-width: var(--container-max); 
  margin: 0 auto; 
}

.main-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--panel-gap);
  margin: 0 0 1.5rem;
}

.input-section,
.result-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.input-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

input {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 90, 168, 0.15);
}

input:disabled {
  background: #f3f4f6;
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.input-with-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-with-toggle input {
  flex: 1;
}

.toggle-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover {
  background: #faf5ff;
  border-color: var(--primary);
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.result-card h4 {
  color: var(--text);
  font-size: 0.98rem;
  margin-bottom: 1rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.result-row span { 
  color: var(--text); 
}

.result-row strong { 
  color: var(--text); 
}

.divider { 
  height: 1px; 
  background: var(--border); 
  margin: 0.6rem 0; 
}

.result-row.total { 
  font-size: 1.05rem; 
}

.result-row.total strong { 
  color: var(--primary-dark); 
}

.branding-badge {
  margin: 1.5rem 0 0.75rem;
  text-align: center;
  color: var(--text);
  font-weight: 600;
}

.branding-badge a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
  transition: color 0.2s ease;
}

.branding-badge a:hover { 
  color: var(--primary-dark); 
}

@media (min-width: 769px) {
  .result-section {
    display: flex;
  }

  .result-card {
    display: flex;
    flex: 1;
    flex-direction: column;
  }

  .result-card .divider {
    margin: auto 0 0.6rem;
  }
}

/* Responsive */
@media (max-width: 768px) {
  body { 
    padding: 1rem 0.75rem; 
  }
  
  .main-panel {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .input-section,
  .result-section {
    width: 100%;
    max-width: calc((var(--container-max) - var(--panel-gap)) / 2);
  }
}
