/* 1x1 MÉDIA Pénzügyi Vezérlőpult - Apple Light Design
   ----------------------------------------------------
   Apple HIG (Human Interface Guidelines) elvek:
   - Clarity: tiszta tipográfia, jól olvasható
   - Deference: a tartalom a fontos, nem a UI
   - Depth: rétegesség, hierarchia subtle árnyékokkal
*/

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

:root {
  /* Apple system colors (light mode) */
  --bg: #F2F2F7;              /* system grouped background */
  --bg-card: #FFFFFF;          /* card / surface */
  --bg-secondary: #FAFAFC;     /* secondary background */
  --bg-tertiary: #E5E5EA;      /* tertiary / divider */

  --fg: #1C1C1E;               /* primary text */
  --fg-secondary: #3A3A3C;     /* secondary text */
  --muted: #8E8E93;            /* tertiary text / system gray */
  --muted-light: #C7C7CC;      /* quaternary */
  --border: #E5E5EA;           /* hairline border */
  --border-strong: #D1D1D6;

  /* Apple system colors */
  --blue: #007AFF;
  --green: #34C759;
  --red: #FF3B30;
  --orange: #FF9500;
  --yellow: #FFCC00;
  --purple: #AF52DE;
  --pink: #FF2D55;
  --teal: #5AC8FA;
  --indigo: #5856D6;

  /* Mentor-card accents (lágy pasztell háttérrel) */
  --accent: var(--blue);
  --amber: var(--orange);

  /* Shadows (Apple subtle layering) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               system-ui, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--fg);
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  line-height: 1.47;
  letter-spacing: -0.01em;
}

/* ====================== HEADER ====================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 24px;
  margin-bottom: 8px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
}

h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 16px;
  color: var(--fg);
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 16px 0 12px;
  color: var(--fg);
}

.subtitle {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-top: 4px;
  font-weight: 400;
}

#refresh-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.125rem;
  cursor: pointer;
  color: var(--fg-secondary);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
#refresh-btn:hover {
  background: var(--blue);
  color: white;
  transform: rotate(90deg);
}

/* ====================== KPI ROW ====================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 800px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.kpi {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.kpi:hover { box-shadow: var(--shadow-md); }

.kpi-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.kpi-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}
.kpi.positive .kpi-value { color: var(--green); }
.kpi.negative .kpi-value { color: var(--red); }

/* ====================== CARD ====================== */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

/* Chart canvas méretek (Apple liked subtle) */
.card canvas {
  max-height: 300px !important;
  height: 300px !important;
  width: 100% !important;
}

/* ====================== GRID LAYOUTS ====================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1000px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ====================== AKTUÁLIS HÓNAP ====================== */
.aktualis-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F0F8F4 100%);
  border: 1px solid rgba(52, 199, 89, 0.2);
}
.aktualis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.aktualis-cell {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: 16px;
  border: 1px solid var(--border);
}
.aktualis-cell.zold-cell {
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.25);
}
.aktualis-cell.piros-cell {
  background: rgba(255, 59, 48, 0.06);
  border-color: rgba(255, 59, 48, 0.2);
}
.aktualis-cell.amber-cell {
  background: rgba(255, 149, 0, 0.06);
  border-color: rgba(255, 149, 0, 0.2);
}

.aktualis-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}
.aktualis-value {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.aktualis-value .alig {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}
.aktualis-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
}

.aktualis-details {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.aktualis-details summary {
  cursor: pointer;
  font-weight: 500;
  padding: 8px 0;
  color: var(--blue);
  font-size: 0.9375rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.aktualis-details summary::before {
  content: "▶";
  font-size: 0.6rem;
  transition: transform 0.2s;
}
.aktualis-details[open] summary::before { transform: rotate(90deg); }
.aktualis-details summary::-webkit-details-marker { display: none; }
.aktualis-details summary:hover { color: #0051D5; }

/* ====================== MENTOR CARDS ====================== */
.mentor-card {
  position: relative;
  overflow: hidden;
}
.mentor-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--blue);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.mentor-card .kis-cim {
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: normal;
  margin-bottom: 12px;
  line-height: 1.4;
}

.kpi-block {
  background: var(--bg-secondary);
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.kpi-mini-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 0.875rem;
  color: var(--fg-secondary);
}
.kpi-mini-row.big {
  font-size: 1rem;
  padding-top: 10px;
}
.kpi-mini-row strong { color: var(--fg); font-weight: 600; }
.kpi-block hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.amber { color: var(--orange); font-weight: 600; }
.zold { color: var(--green); font-weight: 600; }
.piros { color: var(--red); font-weight: 600; }
.alig { color: var(--muted); font-size: 0.85em; font-weight: 400; }

/* Tartalék input */
.osztalek-input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.osztalek-input-row label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}
#tartalek-input {
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--fg);
  width: 100%;
  font-family: inherit;
  transition: var(--transition);
}
#tartalek-input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Osztalék box */
.osztalek-box {
  font-size: 1.125rem;
  font-weight: 600;
  padding: 16px;
  border-radius: var(--r-md);
  text-align: center;
  letter-spacing: -0.01em;
}
.osztalek-box.zold {
  background: rgba(52, 199, 89, 0.08);
  color: var(--green);
}
.osztalek-box.piros {
  background: rgba(255, 59, 48, 0.06);
  color: var(--red);
}

.hint {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 8px;
  line-height: 1.45;
}

/* ====================== CÉL PROGRESS ====================== */
#cel-progress-bar {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}
#cel-progress-fill {
  background: linear-gradient(90deg, var(--blue), var(--green));
  height: 100%;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
}
#cel-progress-text {
  font-size: 0.875rem;
  color: var(--fg-secondary);
  line-height: 1.5;
}

/* ====================== TABLES ====================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}
tr:last-child td { border-bottom: none; }
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.status-paid { color: var(--green); font-weight: 500; }
.status-expired { color: var(--red); font-weight: 600; }
.status-open { color: var(--orange); font-weight: 500; }

#kintlevo-section.empty {
  background: rgba(52, 199, 89, 0.04);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

/* ====================== CODE / TAGS ====================== */
code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: "SF Mono", Menlo, Monaco, "Courier New", monospace;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
}

.kat-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* ====================== EV SUMMARY ====================== */
.ev-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ev-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.875rem;
}
.ev-summary .lbl {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.ev-summary strong { font-weight: 600; }
.ev-summary .zold { color: var(--green); }
.ev-summary .piros { color: var(--red); }

/* ====================== HÓNAP SELECTOR ====================== */
.honap-selector {
  margin-bottom: 16px;
}
.honap-selector label {
  font-weight: 500;
  font-size: 0.9375rem;
}
#honap-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  color: var(--fg);
  margin-left: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
#honap-select:hover { border-color: var(--border-strong); }
#honap-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* ====================== OPTIMALIZÁCIÓ / JAVASLATOK ====================== */
.optimalizacio-card::before { background: var(--blue); }

.javaslatok {
  list-style: none;
  padding: 0;
}
.javaslatok li {
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: var(--r-md);
  background: var(--bg-secondary);
  border-left: 3px solid var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.javaslatok li.szint-piros {
  border-left-color: var(--red);
  background: rgba(255, 59, 48, 0.04);
}
.javaslatok li.szint-figyelem {
  border-left-color: var(--orange);
  background: rgba(255, 149, 0, 0.05);
}
.javaslatok li.szint-zold {
  border-left-color: var(--green);
  background: rgba(52, 199, 89, 0.04);
}

.ai-prompt-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ====================== BUTTONS (Apple style) ====================== */
.primary-btn {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  padding: 12px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(0, 122, 255, 0.2);
}
.primary-btn:hover {
  background: #0051D5;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}
.primary-btn:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0, 122, 255, 0.2);
}

/* ====================== VAGYON CARD ====================== */
.vagyon-card::before { background: var(--purple); }
.vagyon-input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 800px) { .vagyon-input-grid { grid-template-columns: 1fr; } }
.vagyon-input-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}
.vagyon-input-grid input {
  font-size: 1rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-secondary);
  color: var(--fg);
  font-family: inherit;
  transition: var(--transition);
}
.vagyon-input-grid input:focus {
  outline: none;
  border-color: var(--purple);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(175, 82, 222, 0.1);
}

/* ====================== MODELLEZÉS ====================== */
.modellezes-card::before { background: var(--purple); }
.modellezes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 16px;
}
@media (max-width: 800px) { .modellezes-grid { grid-template-columns: 1fr; } }

.modellezes-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
}

.modellezes-grid input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}
.modellezes-grid input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--bg-card);
  border: 2px solid var(--blue);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.modellezes-grid input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.modellezes-grid input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
  margin-right: 8px;
}
.modellezes-grid input[type="checkbox"]:checked {
  background: var(--blue);
  border-color: var(--blue);
}
.modellezes-grid input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.modellezes-grid label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  cursor: pointer;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--r-sm);
  transition: var(--transition);
}
.modellezes-grid label:has(input[type="checkbox"]:checked) {
  background: rgba(0, 122, 255, 0.05);
}

.modellezes-eredmeny {
  background: var(--bg-secondary);
  padding: 18px;
  border-radius: var(--r-md);
  margin-top: 16px;
  border: 1px solid var(--border);
}
.modellezes-eredmeny-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) { .modellezes-eredmeny-grid { grid-template-columns: 1fr; } }
.modellezes-eredmeny-grid > div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.875rem;
}
.modellezes-eredmeny-grid .lbl {
  color: var(--muted);
  font-weight: 500;
}

/* ====================== ALSZÁMLA ====================== */
.alszamla-card::before { background: var(--green); }

.alszamla-tartalom > p {
  background: var(--bg-secondary);
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  color: var(--fg-secondary);
  margin-bottom: 16px;
  border-left: 3px solid var(--green);
}

.alszamla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.alszamla-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition);
}
.alszamla-item:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.alszamla-nev {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fg);
}
.alszamla-arany {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.alszamla-osszeg {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--green);
  margin: 6px 0;
}
.alszamla-cel {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ====================== KIS TÁBLÁZAT ====================== */
.kis-tabla {
  width: 100%;
  font-size: 0.8125rem;
  margin-top: 8px;
}
.kis-tabla th { padding: 8px 10px; }
.kis-tabla td { padding: 8px 10px; }

/* ====================== FOOTER ====================== */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}
footer code {
  font-size: 0.75rem;
}

/* ====================== SELECTION ====================== */
::selection {
  background: rgba(0, 122, 255, 0.2);
  color: var(--fg);
}

/* ====================== SCROLLBAR (subtle) ====================== */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--muted-light);
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
