/* InvoiceBridge — Obsidian Ledger Design System */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* Override Tailwind defaults via CDN config */
:root {
    --ib-bg: #fafafa;
    --ib-card: #ffffff;
    --ib-border: #e4e4e7;
    --ib-border-subtle: #f4f4f5;
    --ib-text: #18181b;
    --ib-text-muted: #71717a;
    --ib-text-faint: #a1a1aa;
    --ib-accent: #18181b;
    --ib-accent-hover: #27272a;
    --ib-success: #16a34a;
    --ib-warning: #ca8a04;
    --ib-error: #dc2626;
    --ib-info: #2563eb;
}

* { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }

body {
    background: var(--ib-bg);
    color: var(--ib-text);
    font-size: 0.875rem;
    -webkit-font-smoothing: antialiased;
}

/* ─── Navigation ─── */
.ib-nav {
    background: var(--ib-text);
    border-bottom: 1px solid #27272a;
    padding: 0 1.5rem;
    height: 3.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.ib-nav a {
    color: #a1a1aa;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    transition: color 0.15s, background 0.15s;
}
.ib-nav a:hover { color: #fafafa; background: #27272a; }
.ib-nav .ib-brand {
    color: #fafafa;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: -0.02em;
    margin-right: 1.5rem;
}
.ib-nav .ib-sep {
    width: 1px;
    height: 1rem;
    background: #3f3f46;
    margin: 0 0.5rem;
}
.ib-nav .ib-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.ib-nav .ib-user span {
    color: #52525b;
    font-size: 0.875rem;
}

/* ─── Container ─── */
.ib-container {
    max-width: 90rem;
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
}

/* ─── Cards ─── */
.ib-card {
    background: var(--ib-card);
    border: 1px solid var(--ib-border);
    border-radius: 0.5rem;
    padding: 1.25rem;
}
.ib-card-flush { padding: 0; }

/* ─── Buttons ─── */
.ib-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4375rem 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid var(--ib-border);
    background: var(--ib-card);
    color: var(--ib-text);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.25;
    white-space: nowrap;
}
.ib-btn:hover { background: #f4f4f5; border-color: #d4d4d8; }
.ib-btn-primary {
    background: var(--ib-accent);
    border-color: var(--ib-accent);
    color: #fafafa;
}
.ib-btn-primary:hover { background: var(--ib-accent-hover); }
.ib-btn-success {
    background: var(--ib-success);
    border-color: var(--ib-success);
    color: #fff;
}
.ib-btn-success:hover { background: #15803d; }
.ib-btn-danger {
    color: var(--ib-error);
    border-color: #fecaca;
    background: #fef2f2;
}
.ib-btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }
.ib-btn-ghost {
    border-color: transparent;
    background: transparent;
}
.ib-btn-ghost:hover { background: #f4f4f5; }
.ib-btn-sm {
    font-size: 0.8125rem;
    padding: 0.3125rem 0.625rem;
}
.ib-btn-xs {
    font-size: 0.75rem;
    padding: 0.1875rem 0.5rem;
}

/* ─── Inputs ─── */
.ib-input, .ib-select {
    font-size: 0.875rem;
    padding: 0.4375rem 0.75rem;
    border: 1px solid var(--ib-border);
    border-radius: 0.375rem;
    background: var(--ib-card);
    color: var(--ib-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.ib-input:focus, .ib-select:focus {
    border-color: #a1a1aa;
    box-shadow: 0 0 0 3px rgba(161,161,170,0.1);
}
.ib-input-sm, .ib-select-sm {
    font-size: 0.875rem;
    padding: 0.3125rem 0.625rem;
}
.ib-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ib-text);
    margin-bottom: 0.375rem;
}

/* ─── Tables ─── */
.ib-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.ib-table th {
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ib-text-muted);
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--ib-border);
    white-space: nowrap;
}
.ib-table td {
    padding: 0.5625rem 0.75rem;
    border-bottom: 1px solid var(--ib-border-subtle);
    color: var(--ib-text);
}
.ib-table tr:last-child td { border-bottom: none; }
.ib-table tr:hover td { background: #fafafa; }
.ib-table .text-right { text-align: right; }
.ib-table .text-center { text-align: center; }
.ib-table .mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.875rem; }

/* ─── Badges ─── */
.ib-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}
.ib-badge-default { background: #f4f4f5; color: #52525b; }
.ib-badge-success { background: #dcfce7; color: #166534; }
.ib-badge-warning { background: #fef9c3; color: #854d0e; }
.ib-badge-error { background: #fee2e2; color: #991b1b; }
.ib-badge-info { background: #dbeafe; color: #1e40af; }
.ib-badge-neutral { background: #e4e4e7; color: #3f3f46; }
.ib-badge-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    display: inline-block;
}

/* ─── Alerts / Flash ─── */
.ib-alert {
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid;
    margin-bottom: 0.75rem;
}
.ib-alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.ib-alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ib-alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.ib-alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ─── Dashboard ─── */
.ib-workflow-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8125rem 1.25rem;
    border-bottom: 1px solid var(--ib-border-subtle);
    transition: background 0.1s;
}
.ib-workflow-item:last-child { border-bottom: none; }
.ib-workflow-item:hover { background: #fafafa; }
.ib-step-num {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f4f4f5;
    color: #52525b;
    flex-shrink: 0;
}
.ib-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6875rem 1rem;
    background: var(--ib-card);
    border: 1px solid var(--ib-border);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: border-color 0.15s;
    border-left: 3px solid transparent;
}
.ib-status-card:hover { border-color: #a1a1aa; }

/* ─── Progress ─── */
.ib-progress {
    height: 0.375rem;
    background: #f4f4f5;
    border-radius: 9999px;
    overflow: hidden;
}
.ib-progress-fill {
    height: 100%;
    border-radius: 9999px;
    background: var(--ib-accent);
    transition: width 0.3s;
}

/* ─── Checkbox (shadcn style) ─── */
.ib-check {
    width: 1rem;
    height: 1rem;
    border: 1px solid #d4d4d8;
    border-radius: 0.25rem;
    accent-color: var(--ib-accent);
    cursor: pointer;
}

/* ─── File Input ─── */
.ib-file-input {
    font-size: 0.875rem;
    padding: 0.25rem;
    border: 1px dashed #d4d4d8;
    border-radius: 0.375rem;
    background: var(--ib-card);
    cursor: pointer;
    max-width: 12rem;
}
.ib-file-input:hover { border-color: #a1a1aa; }

/* ─── PDF Detail ─── */
.ib-pdf-frame {
    width: 100%;
    height: 700px;
    border: none;
    border-radius: 0.5rem 0.5rem 0 0;
}

/* ─── Utility ─── */
.ib-text-muted { color: var(--ib-text-muted); }
.ib-text-faint { color: var(--ib-text-faint); }
.ib-text-success { color: var(--ib-success); }
.ib-text-error { color: var(--ib-error); }
.ib-text-warning { color: var(--ib-warning); }
.ib-font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.ib-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Animations ─── */
@keyframes ib-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.ib-animate { animation: ib-fade-in 0.3s ease-out both; }
.ib-animate-d1 { animation-delay: 0.05s; }
.ib-animate-d2 { animation-delay: 0.1s; }
.ib-animate-d3 { animation-delay: 0.15s; }
