/* ============================================
   APOLLO HOME SUITE - DESIGN SYSTEM
   Champagner-Gold (#b8945a) als Markenfarbe
   Inter als Schriftart
   ============================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* ============================================
   ENTWURFS-KARTEN
   ============================================ */
.invoice-draft {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.invoice-draft.status-draft {
    border-color: #b8945a;
    box-shadow: 0 0 0 4px rgba(184, 148, 90, 0.15);
    background: #fdfbf7;
}

.invoice-draft.status-ready {
    border-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.invoice-field {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    width: 100%;
    background: #f9fafb;
    transition: 0.2s;
    font-family: inherit;
    font-size: 14px;
}
.invoice-field:focus {
    border-color: #b8945a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(184, 148, 90, 0.2);
    background: white;
}

/* ============================================
   PRIMÄR-BUTTON (Versenden)
   ============================================ */
.btn-send {
    background: #1f2937;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: 0.2s;
    cursor: not-allowed;
    opacity: 0.5;
}
.btn-send.active {
    background: #b8945a;
    color: white;
    opacity: 1;
    cursor: pointer;
}
.btn-send.active:hover {
    background: #a67f44;
    box-shadow: 0 4px 12px rgba(184, 148, 90, 0.35);
}

/* ============================================
   SECTION-TRENNER
   ============================================ */
.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9ca3af;
    text-transform: uppercase;
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

/* ============================================
   PLATTFORM-RADIOS
   ============================================ */
.platform-group {
    display: inline-flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}
.platform-group label {
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    transition: 0.15s;
}
.platform-group input[type="radio"] {
    display: none;
}
.platform-group input[type="radio"]:checked + label {
    background: white;
    color: #1f2937;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ============================================
   POSITIONEN-LISTE
   ============================================ */
.position-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.position-row {
    display: grid;
    grid-template-columns: 1fr 60px 90px 60px 90px 32px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.position-row .pos-desc {
    font-size: 14px;
    color: #1f2937;
}
.position-row .pos-sub {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}
.position-row .pos-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: #374151;
}
.position-row .pos-ust {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
}
.position-row .pos-total {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #1f2937;
}
.position-row .pos-delete {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: 0.15s;
}
.position-row .pos-delete:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* ============================================
   KLEINE BUTTONS (Position-Formular)
   ============================================ */
.btn-small {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: 0.15s;
    font-family: inherit;
}
.btn-add-position {
    background: white;
    color: #6b7280;
    border: 1px dashed #d1d5db;
    padding: 8px 16px;
    border-radius: 8px;
    width: 100%;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.15s;
    font-family: inherit;
}
.btn-add-position:hover {
    border-color: #b8945a;
    color: #1f2937;
    background: #fdfbf7;
}
.btn-confirm {
    background: #1f2937;
    color: white;
}
.btn-confirm:hover {
    background: #111827;
}
.btn-cancel {
    background: white;
    color: #6b7280;
    border-color: #d1d5db;
}
.btn-cancel:hover {
    background: #f3f4f6;
}

/* ============================================
   SUMMEN-BLOCK
   ============================================ */
.summary-block {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6b7280;
    padding: 2px 0;
}
.summary-row.total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}

/* ============================================
   PDF-VORSCHAU-BUTTON
   ============================================ */
.btn-preview {
    background: white;
    color: #1f2937;
    border: 1px solid #d1d5db;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}
.btn-preview:hover {
    border-color: #1f2937;
    background: #f9fafb;
}
.btn-preview.incomplete {
    border-color: #dc2626;
    color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.btn-preview.incomplete:hover {
    background: #fef2f2;
}

/* ============================================
   FEHLT-HINWEIS
   ============================================ */
.missing-hint {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border-left: 3px solid #dc2626;
    border-radius: 4px;
    font-size: 12px;
    color: #991b1b;
}
.missing-hint strong {
    color: #7f1d1d;
}

/* ============================================
   LÖSCH-BUTTON (ganze Karte)
   ============================================ */
.btn-delete-draft {
    background: none;
    border: 1px solid transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    transition: 0.15s;
}
.btn-delete-draft:hover {
    color: #dc2626;
    border-color: #fca5a5;
    background: #fef2f2;
}

/* ============================================
   FREIGABE ZURÜCKNEHMEN
   ============================================ */
.btn-unapprove {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    font-family: inherit;
}
.btn-unapprove:hover {
    border-color: #b8945a;
    color: #1f2937;
    background: #fdfbf7;
}

/* ============================================
   TAB-NAVIGATION (Top-Level: Module)
   ============================================ */
.tab-bar-top {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.tab-top {
    background: none;
    border: none;
    padding: 10px 4px;
    margin: 0 16px 0 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
}
.tab-top:hover {
    color: #1f2937;
}
.tab-top.active {
    color: #1f2937;
    font-weight: 600;
}
.tab-top.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #b8945a;
    border-radius: 1px;
}

/* ============================================
   SUB-TABS (Aktionen innerhalb eines Moduls)
   ============================================ */
.tab-bar-sub {
    display: inline-flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tab-sub {
    background: none;
    border: none;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.15s;
}
.tab-sub:hover {
    color: #1f2937;
}
.tab-sub.active {
    background: white;
    color: #1f2937;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ============================================
   TAB-INHALTE
   ============================================ */
.tab-content,
.subtab-content {
    /* Sichtbare Tabs nutzen den Standard, versteckte bekommen .hidden (Tailwind) */
}
.hidden {
    display: none;
}

/* ============================================
   "NEUER ENTWURF"-BUTTON
   ============================================ */
.btn-new-draft {
    background: white;
    color: #6b7280;
    border: 1px dashed #d1d5db;
    padding: 12px 24px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.15s;
    width: 100%;
    margin-bottom: 16px;
}
.btn-new-draft:hover {
    border-color: #b8945a;
    border-style: solid;
    color: #1f2937;
    background: #fdfbf7;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 41, 55, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-overlay.hidden {
    display: none;
}
.modal-card {
    background: white;
    border-radius: 12px;
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
}
.modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    margin-top: 14px;
}
.modal-label:first-of-type {
    margin-top: 0;
}
.modal-required {
    color: #dc2626;
    font-weight: 700;
}
.modal-optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 12px;
}
.modal-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    margin-bottom: 0;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

/* ============================================
   ARCHIV: Tabellen-Layout
   ============================================ */
.archive-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.archive-header,
.archive-row {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr 1.4fr 0.9fr 1fr 3fr;
    gap: 12px;
    padding: 14px 20px;
    align-items: center;
}

.archive-header {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #6b7280;
    text-transform: uppercase;
}

.archive-row {
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #1f2937;
    transition: background 0.1s;
}
.archive-row:last-child {
    border-bottom: none;
}
.archive-row:hover {
    background: #fdfbf7;
}

.archive-col-number strong {
    font-family: 'Inter', monospace;
    font-weight: 700;
    color: #1f2937;
}

.archive-ref {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

.archive-col-date {
    font-variant-numeric: tabular-nums;
    color: #6b7280;
    font-size: 13px;
}

.archive-col-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
}

.archive-col-actions {
    text-align: right;
}

/* ============================================
   ARCHIV: Status-Badges
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.status-badge.issued {
    background: #fef3c7;
    color: #92400e;
}
.status-badge.sent {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================
   ARCHIV: PDF-Button (kleiner als im Entwurf)
   ============================================ */
.btn-archive-pdf {
    background: white;
    color: #1f2937;
    border: 1px solid #d1d5db;
    padding: 5px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.15s;
}
.btn-archive-pdf:hover {
    border-color: #b8945a;
    color: #1f2937;
    background: #fdfbf7;
}

/* ============================================
   ARCHIV: Empty State
   ============================================ */
.archive-empty {
    background: white;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
}
.archive-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}
.archive-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.archive-empty-hint {
    font-size: 13px;
    color: #9ca3af;
}
/* ============================================
   LEBENSZYKLUS-AKTIONEN (Ausstellen / Versenden) — Schritt UI
   ============================================ */

/* Sicherheits-Barriere vor dem Ausstellen: gelber Rahmen (Regel 2) */
.issue-barrier {
    border: 2px solid #e0b94a;
    background: #fdf8ec;
    border-radius: 10px;
    padding: 16px;
    margin-top: 8px;
}
.issue-barrier-title {
    font-weight: 700;
    color: #8a6d1f;
    margin-bottom: 6px;
    font-size: 14px;
}
.issue-barrier-text {
    font-size: 13px;
    color: #6b5a2a;
    line-height: 1.5;
    margin-bottom: 12px;
}
.issue-confirm {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #5a4a1f;
    margin-bottom: 14px;
    cursor: pointer;
}
.issue-confirm input { margin-top: 2px; flex-shrink: 0; }
.issue-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Ausstellen-Button (Champagner-Gold) */
.btn-issue {
    background: #b8945a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-issue:disabled { background: #d8cdb8; cursor: not-allowed; }
.btn-issue:not(:disabled):hover { background: #a67f44; }

/* Ausgestellt-Block (Phase issued/sent) */
.issued-block {
    background: #f6f5f2;
    border-radius: 10px;
    padding: 14px;
}
.issued-status {
    font-size: 14px;
    margin-bottom: 10px;
    color: #3a3a3a;
}
.approved-badge { color: #2f8a4e; font-weight: 700; font-size: 14px; }
.sent-confirm { color: #2f8a4e; font-weight: 600; font-size: 13px; }
.send-target { font-size: 13px; color: #555; }
.send-warning { font-size: 13px; color: #b54a3a; font-weight: 600; }

/* ============================================
   STORNO (Schritt 6)
   ============================================ */
.btn-cancel-invoice {
    background: #fff;
    color: #b54a3a;
    border: 1px solid #e0b4ac;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-cancel-invoice:hover { background: #fbeeec; }
.btn-cancel-invoice:disabled { opacity: 0.5; cursor: not-allowed; }

.issued-block.cancelled { background: #fbeeec; }
.cancelled-status { font-size: 14px; font-weight: 700; color: #b54a3a; margin-bottom: 6px; }
.issued-status.muted { color: #999; font-size: 13px; text-decoration: line-through; }
.storno-hinweis { font-size: 13px; font-weight: 600; color: #b54a3a; margin-bottom: 8px; }

.status-badge.storno { background: #f4d9d3; color: #8a3a2c; }
.status-badge.cancelled { background: #eee; color: #888; text-decoration: line-through; }
.archive-ref.storno { color: #b54a3a; font-weight: 600; }

/* Archiv-Aktionsbuttons (Versenden / Stornieren) */
.archive-col-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.btn-archive-send,
.btn-archive-cancel {
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.btn-archive-send {
    background: #b8945a;
    color: #fff;
    border: none;
}
.btn-archive-send:hover { background: #a67f44; }
.btn-archive-cancel {
    background: #fff;
    color: #b54a3a;
    border: 1px solid #e0b4ac;
}
.btn-archive-cancel:hover { background: #fbeeec; }
.btn-archive-correction {
    background: #fff;
    color: #2f6f8a;
    border: 1px solid #b6d4de;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.btn-archive-correction:hover { background: #eef6f9; }
.btn-link {
    background: #fff;
    color: #2f6f8a;
    border: 1px solid #b6d4de;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-link:hover { background: #eef6f9; }
.btn-logout {
    background: #fff;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-logout:hover { background: #fbeeec; color: #b54a3a; border-color: #e0b4ac; }
.btn-archive-send:disabled,
.btn-archive-cancel:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   EINSTELLUNGEN / STAMMDATEN (Schritt 8)
   ============================================ */
.settings-wrap { max-width: 780px; }
.settings-heading { font-size: 20px; font-weight: 700; color: #1f2937; margin-bottom: 4px; }
.settings-sub { font-size: 13px; color: #6b7280; margin-bottom: 20px; }
.settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.settings-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #b8945a;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.settings-grid label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    gap: 4px;
}
.settings-grid label input.invoice-field { font-weight: 400; }
.settings-checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    grid-column: 1 / -1;
    font-weight: 400 !important;
    color: #4b5563;
}
.settings-hint-inline { color: #9ca3af; font-weight: 400; }
.settings-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 4px;
}
.settings-status { font-size: 13px; color: #6b7280; }
.settings-status.ok { color: #2f8a4e; font-weight: 600; }

/* Speichern-Button im Einstellungen-Tab (eigenes Design, nicht das Modal-Mini) */
.settings-actions .btn-confirm {
    background: #b8945a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 26px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.settings-actions .btn-confirm:hover { background: #a67f44; }
.settings-actions .btn-confirm:active { transform: translateY(1px); }
.settings-actions .btn-confirm:disabled { opacity: 0.6; cursor: not-allowed; }
