/* =====================
   DESIGN TOKENS
===================== */
:root {
    --page-bg: #f3f4f6;
    --card-bg: #ffffff;
    --accent: #2563eb;
    --accent-soft: rgba(96,165,250,0.12);
    --muted: #6b7280;
    --border: #e5e7eb;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --text: #111827;
    --success: #16a34a;
    --warning: #d97706;
}

/* =====================
   GLOBAL PAGE
===================== */
body {
    min-height: 100vh;
    background: var(--page-bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 2.25rem 1rem;
}

/* =====================
   LAYOUT
===================== */
.page-wrapper {
    max-width: 640px;
    margin: auto;
    padding: 1.25rem;
}

.page-shell {
    max-width: 1100px;
    margin: 0 auto;
}

.text-muted { color: var(--muted) !important; }

/* =====================
   PAGE HEADER
===================== */
.page-header-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header-modern h1 {
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
}

.page-header-modern p {
    font-size: 0.92rem;
    color: var(--muted);
    margin: 0;
}

.badge-step {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.28rem 0.7rem;
    font-size: 0.82rem;
    background: rgba(37,99,235,0.04);
    color: var(--muted);
}
.badge-step span { color: var(--success); }

/* =====================
   CARD
===================== */
.card-modern {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(17,24,39,0.06);
}

.card-body { padding: 1rem; }

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

.card-divider-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

/* =====================
   TYPOGRAPHY
===================== */
h1 { font-size: 1.6rem; margin-bottom: 0.2rem; }

.title-block h1 {
    font-size: 1.4rem;
    margin: 0;
}

.subtitle,
.title-block p {
    font-size: 0.9rem;
    color: var(--muted);
}

/* =====================
   FORM
===================== */
.form-modern label {
    font-size: 0.9rem;
    font-weight: 600;
}

.form-modern p {
    margin-bottom: 0.6rem;
    color: var(--muted);
}

.form-modern input,
.form-modern select,
.form-modern textarea {
    background-color: var(--input-bg);
    border-radius: 8px;
    border: 1px solid var(--input-border);
    padding: 0.5rem 0.75rem;
    width: 100%;
}

.form-modern input[type="file"]::file-selector-button {
    background: linear-gradient(135deg,#60a5fa,var(--accent));
    border: none;
    color: #fff;
    border-radius: 8px;
    padding: 0.38rem 0.75rem;
    margin-right: 0.6rem;
    cursor: pointer;
    font-weight: 600;
}

.form-modern small,
.helptext {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--muted);
}

#existing-file-info {
    margin-top: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    border: 1px dashed rgba(37,99,235,0.08);
    background: linear-gradient(180deg, rgba(96,165,250,0.04), transparent 60%);
}

/* =====================
   SEARCH
===================== */
.search-wrapper input {
    border-radius: 8px;
    border: 1px solid var(--input-border);
    padding: 0.45rem 0.6rem;
}

.search-wrapper input::placeholder { color: #9ca3af; }

/* =====================
   BUTTONS
===================== */
.btn-primary-modern {
    background: linear-gradient(135deg,#60a5fa,var(--accent));
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.2rem;
    font-weight: 700;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 8px 20px rgba(37,99,235,0.12);
}

.btn-primary-modern:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary-ghost {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.45rem 1rem;
    background: rgba(34, 197, 94, 0.06);
    color: #065f46;
}
.btn-secondary-ghost:hover { background: rgba(34, 197, 94, 0.12); }

.btn-secondary-ghost-v1 {
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,0.06);
    padding: 0.35rem 0.85rem;
    background: #f8fafc;
}

/* =====================
   TABLE
===================== */
.table-responsive-modern {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
}

.table {
    color: var(--text) !important;
}

.table thead {
    background: #f9fafb;
}

.table th,
.table td {
    border-color: var(--border);
    font-size: 0.875rem;
    padding: 0.6rem 0.75rem;
}

.table tbody tr:hover {
    background: #f3f4f6;
}

/* =====================
   FOOTER / DECOR
===================== */
.subtle-card-footer {
    margin-top: 1rem;
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    border: 1px dashed rgba(99,102,241,0.08);
    background: linear-gradient(180deg, rgba(96,165,250,0.06), transparent 60%);
    font-size: 0.85rem;
    color: var(--muted);
}

.footer-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* =====================
   MODAL
===================== */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2,6,23,0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1080;
}

.custom-modal {
    max-width: 1100px;
    max-height: 86vh;
    width: 100%;
    background: var(--card-bg);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.custom-modal-body {
    padding: 0.85rem;
    overflow: auto;
    flex: 1;
}

/* =====================
   UTIL
===================== */
.text-warning { color: var(--warning) !important; }

.logo-dot {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg,#e6f2ff,#60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
}

.revenue-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
}

.revenue-meta-label { color: var(--muted); font-size: 0.82rem; }
.revenue-meta-value { font-weight: 600; color: var(--text); }

.revenue-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(34,197,94,0.06);
    border: 1px solid rgba(34,197,94,0.12);
    font-size: 0.78rem;
    color: #065f46;
}

.note-text {
    font-size: 0.88rem;
    color: var(--muted);
    background: linear-gradient(180deg, var(--accent-soft), transparent 60%);
    border-radius: 10px;
    border: 1px dashed rgba(37,99,235,0.06);
    padding: 0.7rem;
}

.file-blob {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-size: 0.92rem;
    font-weight: 600;
}

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    max-width: 360px;
}

.toast-message {
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* =====================
   RESPONSIVE
===================== */
@media (max-width: 991.98px) {
    .page-header-modern,
    .footer-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 575.98px) {
    .page-wrapper { padding: 0.8rem; }
    h1 { font-size: 1.3rem; }
}
