/* BUCH - Digital Creative Agency Bookkeeping Styles */
:root {
    --finance-green: #00ff88;
    --finance-red: #ff4466;
    --finance-blue: #00d4ff;
    --card-bg: rgba(25, 25, 28, 0.95);
}

body.auth #passgate {
    display: none;
}

/* ── ABO MANAGER ── */
.abo-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-top: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.abo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.abo-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

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

.abo-item-due {
    background: rgba(255, 68, 102, 0.04);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 0.25rem 0;
}

.abo-item-info {
    flex: 1;
}

.abo-item-name {
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.abo-item-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.abo-item-amount {
    text-align: right;
    min-width: 130px;
}

.abo-item-actions {
    display: flex;
    align-items: center;
    min-width: 120px;
    justify-content: flex-end;
}

.abo-due-tag {
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--finance-red);
    background: rgba(255, 68, 102, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    animation: pulse 1.5s infinite;
}

.abo-ok-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--finance-green);
    background: rgba(0, 255, 136, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@media (max-width: 768px) {
    .abo-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .abo-item-actions {
        justify-content: flex-start;
    }

    .abo-header {
        flex-direction: column;
        gap: 1rem;
    }
}

.buch-page {
    background: #0a0a0b;
    color: #fff;
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

/* Dashboard Layout */
.buch-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
}

.buch-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 2rem;
}

.buch-header h1 {
    font-size: 3rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
}

.buch-header h1 span {
    color: var(--brand-yellow);
}

/* Smart Status Bar */
.smart-status-bar {
    background: rgba(255, 209, 0, 0.05);
    border: 1px solid rgba(255, 209, 0, 0.2);
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.95rem;
}

.status-icon {
    font-size: 1.5rem;
}

.status-text {
    flex: 1;
}

.status-text strong {
    color: var(--brand-yellow);
    display: block;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

/* Gauges Grid */
.gauges-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.gauge-card {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gauge-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.gauge-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.gauge-percent {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--brand-yellow);
}

.gauge-bar-bg {
    height: 8px;
    background: #111;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.gauge-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-yellow), #ff9900);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.gauge-bar-fill.svs-fill {
    background: linear-gradient(90deg, var(--finance-blue), #0077ff);
}

.gauge-footer {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Secondary Info Grid */
.secondary-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
}

.info-card {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    color: var(--brand-yellow);
}

.highlight-card {
    border: 1px solid rgba(255, 68, 102, 0.3) !important;
    background: linear-gradient(145deg, rgba(25, 25, 28, 0.95), rgba(255, 68, 102, 0.05)) !important;
}

.highlight-card h3 {
    color: var(--finance-red) !important;
}

.deadline-list {
    list-style: none;
    padding: 0;
}

.deadline-list li {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    opacity: 0.8;
}

.deadline-list li span {
    font-weight: 700;
    color: var(--brand-yellow);
    width: 100px;
}

.insight-item {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.insight-item span {
    color: var(--brand-yellow);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    border-left: 4px solid #333;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.revenue {
    border-color: var(--finance-green);
}

.stat-card.expenses {
    border-color: var(--finance-red);
}

.stat-card.profit {
    border-color: var(--brand-yellow);
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

/* UI Controls */
.controls-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    background: #111;
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid #333;
}

.filter-group select {
    background: transparent;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
}

.filter-group select option {
    background: #111;
}

.btn-sm {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
}

/* Table Section */
.data-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid #333;
    opacity: 0.6;
    font-weight: 400;
}

td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.type-tag {
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.type-revenue {
    background: rgba(0, 255, 136, 0.1);
    color: var(--finance-green);
}

.type-expense {
    background: rgba(255, 68, 102, 0.1);
    color: var(--finance-red);
}

.cat-tag {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    font-weight: 700;
}

.btn-attach {
    background: rgba(255, 209, 0, 0.1);
    color: var(--brand-yellow);
    border: 1px solid rgba(255, 209, 0, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    text-decoration: none;
    margin-left: 10px;
    transition: all 0.2s;
}

.btn-attach:hover {
    background: var(--brand-yellow);
    color: black;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.amount-cell {
    font-family: 'Courier Prime', monospace;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #151518;
    padding: 2rem;
    border-radius: 1rem;
    width: 100%;
    max-width: 780px;
    /* wider on desktop for 2-col layout */
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #333;
}

/* 2-column form grid for desktop */
@media (min-width: 768px) {
    #entry-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 1.5rem;
    }

    /* These items span full width */
    #entry-form>h2,
    #entry-form .form-group:first-child,
    #entry-form .form-group:nth-child(3),
    /* Beschreibung */
    #entry-form .form-group:last-of-type,
    /* Beleg upload */
    #entry-form>div:last-child {
        /* Buttons row */
        grid-column: 1 / -1;
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    background: #0a0a0b;
    border: 1px solid #333;
    color: #fff;
    border-radius: 0.4rem;
    font-size: 16px;
    /* Prevents iOS auto-zoom on focus */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print Enhancements */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .buch-container {
        padding: 2rem 0 !important;
    }

    .no-print,
    .smart-status-bar,
    .gauges-grid,
    .secondary-info-grid,
    .controls-bar,
    .modal,
    button {
        display: none !important;
    }

    .stat-card {
        border: 1px solid #eee !important;
        color: black !important;
    }

    .stat-value {
        color: black !important;
        font-size: 1.5rem !important;
    }

    .data-section {
        padding: 0 !important;
        background: transparent !important;
        overflow: visible !important;
    }

    table {
        min-width: unset !important;
        width: 100% !important;
        table-layout: fixed !important;
        font-size: 9px !important;
        color: black !important;
    }

    th:nth-child(8) {
        display: none !important;
    }

    td:nth-child(8) {
        display: none !important;
    }

    th {
        color: black !important;
        border-bottom: 2px solid #000 !important;
    }

    td {
        border-bottom: 1px solid #eee !important;
        color: black !important;
        word-break: break-word !important;
        overflow: hidden !important;
    }

    .type-tag {
        border: 1px solid #ccc !important;
    }

    .amount-cell {
        color: black !important;
    }

    .cat-tag {
        opacity: 1 !important;
        color: #666 !important;
        border: 1px solid #eee !important;
    }

    /* Show a print header */
    .buch-header h1 {
        color: black !important;
        font-size: 2rem !important;
    }

    .buch-header::after {
        content: "Einnahmen-Ausgaben-Rechnung (E/A) - Erstellt mit FAT DESIGN Digital Accountant";
        display: block;
        font-size: 10px;
        margin-top: 10px;
        opacity: 0.5;
    }
}

.buch-container>* {
    animation: fadeIn 0.8s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {

    /* Container */
    .buch-container {
        padding: 6rem 1rem 3rem;
    }

    /* Header */
    .buch-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .buch-header h1 {
        font-size: 1.8rem;
    }

    /* Controls bar wraps */
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .controls-bar .filter-group {
        width: 100%;
    }

    .controls-bar .btn-sm {
        width: 100%;
        text-align: center;
    }

    /* Gauges: 1 column */
    .gauges-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Info cards: 1 column */
    .secondary-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Stats: 2 columns on mobile (compact) */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    /* Data table: horizontal scroll */
    .data-section {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 550px;
    }

    /* Abo section */
    .abo-header {
        flex-direction: column;
        gap: 1rem;
    }

    .abo-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .abo-item-amount {
        text-align: left;
    }

    .abo-item-actions {
        justify-content: flex-start;
        min-width: unset;
    }

    /* Modal */
    .modal {
        align-items: flex-start;
        /* allow scroll from top */
        padding: 0.5rem;
    }

    .modal-content {
        margin: 0;
        padding: 1.25rem 1.25rem 2rem;
        /* extra bottom padding so buttons are reachable */
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 0.75rem;
    }

    /* Smart status bar */
    .smart-status-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        font-size: 0.85rem;
    }
}