:root { --bg: #0f172a; --card: #1e293b; --text: #f8fafc; --accent: #3b82f6; --green: #10b981; --red: #ef4444; --orange: #f59e0b; }
body { margin: 0; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }

.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--card); padding: 20px; border-right: 1px solid #334155; display: flex; flex-direction: column; }
.content { flex-grow: 1; padding: 30px; overflow-y: auto; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }

.card { background: var(--card); border-radius: 12px; padding: 20px; border: 1px solid #334155; }
.card h3 { margin: 0 0 15px 0; font-size: 0.9rem; color: #94a3b8; text-transform: uppercase; }
.val-big { font-size: 2rem; font-weight: 700; }
.sub-val { font-size: 0.9rem; color: #94a3b8; margin-top: 5px; }

.progress-bg { height: 8px; background: #334155; border-radius: 4px; margin-top: 15px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); transition: width 1s; }

.nav-item { padding: 12px 15px; margin-bottom: 5px; cursor: pointer; border-radius: 8px; color: #94a3b8; user-select: none; }
.nav-item.active { background: var(--accent); color: white; font-weight: 600; }

.alert-box { display: flex; align-items: center; gap: 15px; }
.indicator { width: 15px; height: 15px; border-radius: 50%; }
.ind-green { background: var(--green); box-shadow: 0 0 10px var(--green); }
.ind-red { background: var(--red); box-shadow: 0 0 10px var(--red); }

button { background: var(--accent); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }

.hidden { display: none !important; }
.view { display: none; }
.view.active { display: block; }

/* Login overlay */
.login-screen { 
  position: fixed; 
  inset: 0; 
  background: var(--bg); 
  z-index: 999; 
  display: flex !important; 
  align-items: center; 
  justify-content: center; 
}
.login-screen.hidden { display: none !important; }
.login-card { 
  background: var(--card); 
  padding: 2.5rem; 
  border-radius: 1rem; 
  width: 100%; 
  max-width: 380px; 
  text-align: center; 
  border: 1px solid #334155; 
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}
.login-card h2 { margin: 0 0 1.5rem 0; font-size: 1.8rem; }
.login-card form { text-align: left; }
.login-error { 
  color: var(--red); 
  display: none; 
  margin-top: 12px; 
  padding: 10px; 
  background: rgba(239, 68, 68, 0.1); 
  border: 1px solid var(--red); 
  border-radius: 6px; 
  font-size: 0.9rem; 
  text-align: center;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Minor helpers */
.row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; }
.muted { color: #94a3b8; }
.footer-build { text-align: center; color: #334155; margin-top: 10px; font-size: 0.8rem; }

/* Debug */
.debug-pre { max-height: 200px; overflow: auto; background: #020617; padding: 10px; border-radius: 6px; font-size: 0.75rem; }

/* Settings Module */
.settings-header { margin-bottom: 30px; }
.settings-header h1 { margin: 0; font-size: 2rem; }

.settings-tabs { display: flex; gap: 10px; margin-bottom: 30px; border-bottom: 1px solid #334155; }
.settings-tab { padding: 12px 20px; cursor: pointer; border-bottom: 2px solid transparent; color: #94a3b8; user-select: none; transition: all 0.2s; }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.settings-content { }
.settings-panel { display: none; }
.settings-panel.active { display: block; }

.settings-section { background: var(--card); border-radius: 12px; padding: 20px; margin-bottom: 20px; border: 1px solid #334155; }
.settings-section h3 { margin: 0 0 20px 0; font-size: 1.1rem; color: var(--text); }
.settings-section h4 { margin: 15px 0 10px 0; font-size: 0.95rem; color: #94a3b8; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.9rem; color: #94a3b8; font-weight: 500; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea { 
  background: #0f172a; 
  border: 1px solid #334155; 
  border-radius: 6px; 
  padding: 10px; 
  color: var(--text); 
  font-family: inherit;
  font-size: 0.9rem;
}
.form-group input:focus,
.form-group textarea:focus { 
  outline: none; 
  border-color: var(--accent); 
}
.form-group textarea { resize: vertical; min-height: 100px; }

.seasonality-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }

/* Tables */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { 
  background: #0f172a; 
  padding: 12px; 
  text-align: left; 
  font-size: 0.85rem; 
  color: #94a3b8; 
  font-weight: 600; 
  border-bottom: 1px solid #334155; 
}
.data-table td { 
  padding: 12px; 
  border-bottom: 1px solid #334155; 
}
.data-table tr:hover { background: rgba(59, 130, 246, 0.05); }
.data-table input[type="text"],
.data-table input[type="number"] { 
  width: 100%; 
  background: #0f172a; 
  border: 1px solid #334155; 
  border-radius: 4px; 
  padding: 6px 10px; 
  color: var(--text); 
  font-size: 0.9rem;
}

/* Tags */
.tags-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.tag { 
  background: var(--accent); 
  color: white; 
  padding: 6px 12px; 
  border-radius: 20px; 
  font-size: 0.85rem; 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
}
.tag-remove { 
  background: rgba(255, 255, 255, 0.2); 
  border: none; 
  color: white; 
  cursor: pointer; 
  border-radius: 50%; 
  width: 18px; 
  height: 18px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 14px; 
  padding: 0;
}
.tag-remove:hover { background: rgba(255, 255, 255, 0.3); }

/* List Manager */
.list-manager { display: flex; flex-direction: column; gap: 10px; }
.list-item { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 12px; 
  background: #0f172a; 
  border-radius: 6px; 
  border: 1px solid #334155; 
}
.list-item input { 
  flex: 1; 
  background: transparent; 
  border: none; 
  color: var(--text); 
  padding: 0; 
  margin-right: 10px;
}
.list-item input:focus { outline: none; }

/* Dictionary */
.dictionary-section { margin-bottom: 25px; }
.dictionary-list { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 8px; 
  margin-top: 10px; 
}
.dict-item { 
  background: #0f172a; 
  padding: 8px 12px; 
  border-radius: 6px; 
  border: 1px solid #334155; 
  font-size: 0.85rem; 
  color: #94a3b8; 
}

/* Integration Status */
.integration-status { margin: 15px 0; }
.status-badge { 
  display: inline-block; 
  padding: 8px 16px; 
  border-radius: 6px; 
  font-size: 0.9rem; 
  font-weight: 500; 
}
.status-ok { background: rgba(16, 185, 129, 0.1); color: var(--green); border: 1px solid var(--green); }
.status-error { background: rgba(239, 68, 68, 0.1); color: var(--red); border: 1px solid var(--red); }

/* External Services */
.external-services { display: flex; flex-direction: column; gap: 12px; }
.service-item { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 12px; 
  background: #0f172a; 
  border-radius: 6px; 
  border: 1px solid #334155; 
}
.service-item .link { 
  color: var(--accent); 
  text-decoration: none; 
  font-size: 0.9rem; 
}
.service-item .link:hover { text-decoration: underline; }

/* Buttons */
.btn-primary { 
  background: var(--accent); 
  color: white; 
  border: none; 
  padding: 12px 24px; 
  border-radius: 6px; 
  cursor: pointer; 
  font-weight: 600; 
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small { 
  background: #334155; 
  color: white; 
  border: none; 
  padding: 6px 12px; 
  border-radius: 4px; 
  cursor: pointer; 
  font-size: 0.85rem;
  transition: background 0.2s;
}
.btn-small:hover { background: #475569; }
.btn-small.btn-danger { background: var(--red); }
.btn-small.btn-danger:hover { background: #dc2626; }

.settings-actions { margin-top: 30px; padding-top: 20px; border-top: 1px solid #334155; }

/* Dashboard 2.0 Styles */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #334155;
}

.dashboard-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.month-selector-wrapper {
  display: flex;
  align-items: center;
}

/* Zone 1: Деньги & Темп */
.dashboard-zone-1 {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 20px;
  margin-bottom: 30px;
}

.pacing-card {
  display: flex;
  flex-direction: column;
}

.pacing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
}

.pacing-gauge {
  width: 100%;
  max-width: 200px;
}

.gauge-svg {
  width: 100%;
  height: auto;
}

.pacing-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.pacing-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #334155;
}

.pacing-item:last-child {
  border-bottom: none;
}

.pacing-label {
  color: #94a3b8;
  font-size: 0.9rem;
}

.pacing-value {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.cashflow-card {
  display: flex;
  flex-direction: column;
}

.cashflow-display {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

.cashflow-icon {
  font-size: 3rem;
}

.cashflow-text {
  flex: 1;
}

.cashflow-status {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.cashflow-amount {
  font-size: 1.8rem;
  font-weight: 700;
}

.chart-card {
  min-height: 300px;
}

.chart-card canvas {
  max-height: 250px;
}

/* Zone 2: Физика */
.dashboard-zone-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.capacity-card {
  display: flex;
  flex-direction: column;
}

.capacity-display {
  margin-top: 20px;
}

.capacity-progress {
  margin-bottom: 15px;
}

.capacity-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.capacity-text span:first-child {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.capacity-warning {
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 600;
}

.missed-revenue-card {
  display: flex;
  flex-direction: column;
}

.missed-revenue-display {
  margin-top: 20px;
}

/* Zone 3: Потенциал */
.dashboard-zone-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.crm-card {
  display: flex;
  flex-direction: column;
}

.crm-metric {
  margin-top: 20px;
}

.advice-card {
  display: flex;
  flex-direction: column;
}

.ai-advice {
  margin-top: 20px;
  padding: 15px;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #334155;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  min-height: 60px;
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard-zone-1 {
    grid-template-columns: 1fr;
  }
  
  .dashboard-zone-2 {
    grid-template-columns: 1fr;
  }
  
  .dashboard-zone-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
}
