/* Dividend Calculator v2.5 – Mobile-First, Dark Mode, Zero FOUC */
.dividend-calculator-container {
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.dc-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,.08);
  overflow: hidden;
}

.dark-mode .dc-card {
  background: #0f0f12;
  box-shadow: 0 20px 40px rgba(0,0,0,.6);
}

.dc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg,#6366f1,#a855f7);
  color: #fff;
}

.dc-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.dc-theme-toggle {
  background: rgba(255,255,255,.2);
  border: none;
  border-radius: 50px;
  padding: 0.5rem 1rem;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: .3s;
}

.dc-theme-toggle:hover {
  background: rgba(255,255,255,.3);
}

.dc-form {
  padding: 2rem;
  background: #f8fafc;
}

.dark-mode .dc-form {
  background: #1a1a1e;
}

.dc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
  gap: 1.5rem;
}

.dc-field label {
  font-weight: 600;
  color: #374151;
  display: block;
  margin-bottom: .5rem;
}

.dark-mode .dc-field label {
  color: #e2e8f0;
}

.dc-field input {
  padding: .9rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  background: #fff;
  transition: .2s;
  width: 100%;
  box-sizing: border-box;
}

.dark-mode .dc-field input {
  background: #2d2d2d;
  border-color: #404040;
  color: #fff;
}

.dc-field input:focus {
  border-color: #6366f1;
  outline: none;
  box-shadow: 0 0 0 4px rgba(99,102,241,.3);
}

.error-msg {
  color: #ef4444;
  font-size: .9rem;
  min-height: 1.4em;
  margin-top: .4rem;
  display: block;
}

.dc-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.dc-btn-primary, .dc-btn-secondary {
  padding: .9rem 2rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: .3s;
  font-size: 1rem;
}

.dc-btn-primary {
  background: #6366f1;
  color: #fff;
}

.dc-btn-primary:hover {
  background: #4f46e5;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(99,102,241,.4);
}

.dc-btn-secondary {
  background: #e2e8f0;
  color: #374151;
}

.dc-btn-secondary:hover {
  background: #cbd5e1;
}

.dark-mode .dc-btn-secondary {
  background: #374151;
  color: #fff;
}

.dc-results {
  padding: 2rem;
  background: #f0fdf4;
  border-top: 4px solid #22c55e;
}

.dark-mode .dc-results {
  background: #166534;
}

.dc-results h2 {
  margin: 0 0 1.5rem;
  color: #166534;
  font-size: 1.5rem;
}

.dark-mode .dc-results h2 {
  color: #86efac;
}

.dc-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  gap: 1rem;
}

.dc-result-item {
  background: #fff;
  padding: 1.5rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 8px 16px rgba(0,0,0,.08);
}

.dark-mode .dc-result-item {
  background: #22c55e;
  color: #fff;
}

.dc-result-item strong {
  display: block;
  font-size: 1rem;
  color: #475569;
  margin-bottom: .5rem;
}

.dark-mode .dc-result-item strong {
  color: #dcfce7;
}

.dc-result-item span {
  font-size: 1.8rem;
  font-weight: 800;
  color: #166534;
}

.dark-mode .dc-result-item span {
  color: #fff;
}

.dc-result-actions {
  margin-top: 2rem;
  text-align: center;
}

.dc-btn-icon {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: .5rem;
  margin: 0 .75rem;
  transition: .3s;
}

.dc-btn-icon:hover {
  transform: scale(1.3);
}

.dc-history {
  padding: 2rem;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
}

.dark-mode .dc-history {
  background: #1a1a1e;
  border-top-color: #404040;
}

.dc-history summary {
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}

.dark-mode .dc-history summary {
  color: #e2e8f0;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

#history-list li {
  background: #fff;
  padding: 1rem;
  margin-bottom: .75rem;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,.05);
  font-size: .95rem;
}

.dark-mode #history-list li {
  background: #2d2d2d;
  color: #e2e8f0;
}

.hidden { display: none; }
.fade-in { animation: fadeIn .6s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .dc-header { flex-direction: column; gap: 1rem; text-align: center; }
  .dc-actions { justify-content: center; }
  .dc-result-grid { grid-template-columns: 1fr; }
}