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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

/* ── Auth ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.auth-logo {
  margin-bottom: 1rem;
}

.auth-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  color: #64748b;
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
}

/* ── Forms ── */
.form-group {
  text-align: left;
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #3b82f6;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}
.btn-primary:hover { background: #2563eb; }

.btn-outline {
  background: transparent;
  color: #94a3b8;
  border: 1.5px solid #cbd5e1;
}
.btn-outline:hover { border-color: #94a3b8; color: #64748b; }

.btn-full { width: 100%; justify-content: center; margin-top: 0.5rem; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* ── Alerts ── */
.alert {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.2rem;
  text-align: left;
}

.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  color: #fff;
  padding: 0 2rem;
  height: 60px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: #94a3b8;
}

.topbar-user strong { color: #e2e8f0; }

.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  padding: 0.3rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.topbar-icon-btn:hover { color: #e2e8f0; background: rgba(255,255,255,0.08); }

/* ── Dashboard ── */
.dashboard {
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.dashboard-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 2rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.menu-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 780px;
  margin: 0 auto;
}

.menu-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  text-decoration: none;
  color: inherit;
  border: 1.5px solid #e2e8f0;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.menu-card-lg {
  padding: 2.25rem 2rem;
}

.menu-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.menu-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-card-lg .menu-icon {
  width: 68px;
  height: 68px;
  border-radius: 14px;
}

.menu-label {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.menu-desc {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.4;
}

/* ── Pages ── */
.page-content {
  max-width: 860px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}

.alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #94a3b8;
  background: #fff;
  border-radius: 12px;
  border: 1.5px dashed #e2e8f0;
}

/* ── Table ── */
.table-wrap {
  background: #fff;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 1.5px solid #e2e8f0;
  background: #f8fafc;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

.mono { font-family: monospace; font-size: 0.82rem; }

.actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue  { background: #eff6ff; color: #3b82f6; }
.badge-gray  { background: #f1f5f9; color: #64748b; }
.badge-green { background: #f0fdf4; color: #16a34a; }
.badge-red   { background: #fef2f2; color: #dc2626; }

.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-in  { color: #16a34a; }
.amount-out { color: #dc2626; }

.user-add-form { margin-bottom: 0.5rem; }
.user-add-form .form-row { grid-template-columns: 1fr 1fr 0.6fr; }
.filter-card {
  background: #fff;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-grid .form-group {
  margin-bottom: 0;
}

.filter-grid .form-group label {
  font-size: 0.78rem;
}

.filter-grid .form-group input,
.filter-grid .form-group select {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Danger button ── */
.btn-danger {
  background: transparent;
  color: #ef4444;
  border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: #fef2f2; }

/* ── Form card ── */
.form-card {
  background: #fff;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  padding: 2rem;
}

.page-content-narrow {
  max-width: 700px;
  margin: 0 auto;
}

.page-content-wide {
  max-width: 1200px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.form-group select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  background: #fff;
}

.form-group select:focus { border-color: #3b82f6; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ── Report tiles ── */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.report-tile {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  transition: all 0.2s;
}

.report-tile:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 24px rgba(59,130,246,0.1);
  transform: translateY(-2px);
}

.report-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #94a3b8;
  border-style: dashed;
  padding: 3rem;
}

/* ── Print ── */
@media print {
  .topbar, .page-header .btn, .filter-card { display: none !important; }
  body { background: #fff; }
  .page-content { margin: 0; padding: 0; max-width: 100%; }
  .table-wrap { border: none; box-shadow: none; }
  .data-table { font-size: 11pt; }
  .data-table th, .data-table td { padding: 0.4rem 0.6rem; }
  .row-total td { background: #1e293b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .row-group-header td, .row-subtotal td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-title { display: block !important; }
}

.print-title {
  display: none;
  text-align: center;
  font-size: 16pt;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1e293b;
}
.row-group-header td { background: #f8fafc; font-weight: 700; color: #1e293b; padding-top: 1rem; }
.row-subgroup-header td { background: #f1f5f9; font-weight: 600; color: #475569; padding-left: 1.5rem !important; }
.row-subgroup-subtotal td { background: #f8fafc; font-weight: 600; color: #64748b; font-size: 0.875rem; }
.row-subtotal td     { background: #eff6ff; font-weight: 600; color: #3b82f6; font-size: 0.875rem; }
.row-total td        { background: #1e293b; color: #fff; font-weight: 700; font-size: 0.95rem; }
.row-total .amount-in  { color: #86efac; }
.row-total .amount-out { color: #fca5a5; }
.row-indent { padding-left: 2rem !important; }
.row-indent-2 { padding-left: 3.5rem !important; }

.report-period {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1.25rem;
  font-style: italic;
}
.chat-box {
  max-width: 100%;
  margin: 2rem auto 0;
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  padding: 2rem 2.5rem;
}

.chat-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
}

.chat-label-sub {
  font-weight: 400;
  color: #64748b;
}

.chat-input-row {
  display: flex;
  gap: 0.6rem;
}

.chat-input-row input {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1.05rem;
  outline: none;
}

.chat-input-row input:focus { border-color: #3b82f6; }

.chat-response {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.925rem;
  line-height: 1.6;
}

.chat-loading { background: #f8fafc; color: #94a3b8; }
.chat-answer  { background: #eff6ff; color: #1e3a5f; border: 1px solid #bfdbfe; }
.chat-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.config-layout {
  display: flex;
  gap: 1.5rem;
}

.config-panel {
  background: #fff;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  padding: 1.5rem;
  flex: 1;
  max-width: 600px;
}

.config-panel-header {
  margin-bottom: 1rem;
}

.config-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.inline-add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inline-add-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  outline: none;
}

.inline-add-form input:focus { border-color: #3b82f6; }

.config-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-item {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.config-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.config-item-name {
  font-weight: 600;
  color: #1e293b;
}

.config-item-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-xs {
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

.edit-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  align-items: center;
}

.edit-form input {
  flex: 1;
  padding: 0.4rem 0.65rem;
  border: 1.5px solid #93c5fd;
  border-radius: 7px;
  font-size: 0.875rem;
  outline: none;
}

.hidden { display: none !important; }

.empty-state-sm {
  color: #94a3b8;
  font-size: 0.875rem;
  padding: 1rem 0;
}

/* Subgrupe */
.subgroup-list {
  margin-top: 0.6rem;
  padding-left: 0.75rem;
  border-left: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.subgroup-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.subgroup-name {
  flex: 1;
  font-size: 0.875rem;
  color: #475569;
}

.subgroup-add {
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.subgroup-add input {
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1.5px solid #e2e8f0;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  text-transform: capitalize;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}
.modal-close:hover { color: #1e293b; }

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-sold-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #475569;
}

.modal-sold-final {
  font-size: 0.95rem;
}

.modal-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.75rem 0;
}

.modal-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.875rem;
  color: #334155;
}

.modal-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  border-top: 1px solid #f1f5f9;
  margin-top: 0.25rem;
  color: #1e293b;
}

.modal-empty {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 0.25rem 0;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .topbar {
    padding: 0 1rem;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }

  .topbar-user {
    gap: 0.5rem;
    font-size: 0.82rem;
  }

  .topbar-user > span { display: none; }

  .dashboard {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }

  .menu-grid-3 {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .menu-card-lg {
    padding: 1.5rem 1.25rem;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .menu-card-lg .menu-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }

  .chat-box {
    padding: 1.25rem 1rem;
  }

  .chat-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    margin-bottom: 1rem;
  }

  .chat-input-row {
    flex-wrap: wrap;
  }

  .chat-input-wrap {
    width: 100%;
    flex: none;
  }

  .chat-input-row input {
    width: 100%;
    flex: none;
  }

  .chat-input-row .btn {
    flex: 1;
  }

  .page-content,
  .page-content-wide {
    padding: 0 1rem;
    margin: 1.5rem auto;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

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

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

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

  .config-layout {
    flex-direction: column;
  }

  .data-table th,
  .data-table td {
    padding: 0.6rem 0.6rem;
    font-size: 0.82rem;
  }
}

/* ── Manager page layout ── */
.manager-page {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

.manager-page .dashboard-title {
  margin-bottom: 1rem;
}

.manager-page .summary-grid {
  max-width: 100%;
  margin-bottom: 2.5rem;
}

.manager-page .summary-card {
  padding: 2.25rem 2rem;
}

.manager-page .menu-grid-3 {
  max-width: 100%;
  margin-bottom: 2.5rem;
}

.manager-chat {
  max-width: 100%;
  margin: 0;
  padding: 2rem;
}

.manager-chat .chat-input-row input {
  font-size: 1rem;
  padding: 1rem 1.25rem;
}

/* ── Summary cards (manager) ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 780px;
  margin: 0 auto 2rem;
}

@media (max-width: 640px) {
  .summary-grid {
    display: flex;
    flex-direction: column-reverse;
  }
}

.summary-card {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  padding: 1.5rem;
}

.summary-date {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.summary-lbl {
  color: #64748b;
}

.summary-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.25rem 0;
}

/* ── Login split page ── */
.login-split-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 50%, #dbeafe 100%);
  padding: 2rem;
}

.login-float-wrapper {
  display: flex;
  width: 100%;
  max-width: 860px;
  min-height: 520px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(30, 58, 138, 0.18), 0 8px 24px rgba(0,0,0,0.08);
}

.login-split-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: #fff;
}

.login-split-form {
  width: 100%;
  max-width: 360px;
}

.login-split-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2.5rem;
}

.login-split-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.4rem;
}

.login-split-sub {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-split-fields {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.login-split-right {
  width: 50%;
  background: linear-gradient(145deg, #1e3a5f 0%, #1e40af 50%, #2563eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-split-right-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 2rem;
  width: 100%;
}

.login-illustration {
  width: 100%;
  max-width: 420px;
  opacity: 0.95;
}

.login-split-tagline {
  text-align: center;
  color: #fff;
}

.login-split-tagline h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.login-split-tagline p {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

@media (max-width: 700px) {
  .login-split-right { display: none; }
  .login-split-left  { padding: 2rem 1.5rem; }
  .login-float-wrapper { min-height: unset; }
}
