/* Shared design tokens for the Finance / Agreements / administrative-workspace surfaces
   (Finance.razor, FinanceAdmin.razor, and anything built on top of them going forward) - a
   desktop-first, information-dense system distinct from the rest of the app's Bootstrap-derived
   look, deliberately NOT applied to unrelated already-shipped areas (Transport/Rooms/Contests/
   IAM/Admin) to keep this a scoped, additive change rather than a full-app retheme. */

:root {
    /* Spacing scale - nothing outside this set should appear in finance-* rules. */
    --fin-space-1: 4px;
    --fin-space-2: 8px;
    --fin-space-3: 12px;
    --fin-space-4: 16px;
    --fin-space-5: 20px;
    --fin-space-6: 24px;

    /* Surface & text */
    --fin-bg: #f7f8fa;
    --fin-surface: #ffffff;
    --fin-border: #e6e8ec;
    --fin-text-primary: #15171a;
    --fin-text-secondary: #667085;

    /* Semantic status colors - separate from the brand accent, used only for alerts/workflow
       states, never as decoration. */
    --fin-success: #16a34a;
    --fin-success-soft: #e7f7ed;
    --fin-warning: #f59e0b;
    --fin-warning-soft: #fef3e2;
    --fin-danger: #dc2626;
    --fin-danger-soft: #fde8e8;
    --fin-info: #2563eb;
    --fin-info-soft: #eaf1fd;

    /* Brand accent - reserved for active nav state, primary actions, and "this is the important
       one" indicators. Not used as a general decorative color. */
    --fin-brand: #185354;
    --fin-brand-strong: #0c3536;
    --fin-brand-soft: #e3eeee;

    /* Shape & elevation - borders first, shadows only as a light lift on hover/focus. */
    --fin-radius: 6px;
    --fin-radius-sm: 4px;
    --fin-shadow-sm: 0 1px 2px rgba(21, 23, 26, 0.06);
    --fin-shadow-md: 0 4px 12px rgba(21, 23, 26, 0.08);

    /* Typography scale */
    --fin-text-page-title: 32px;
    --fin-text-section-title: 18px;
    --fin-text-card-title: 14px;
    --fin-text-table: 13px;
    --fin-text-meta: 12px;

    --fin-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Application shell */
    --fin-sidenav-width: 240px;
    --fin-sidenav-width-collapsed: 72px;
    --fin-row-height: 38px;
}

/* ---- Shared primitives, reused by every finance-* surface ---- */

.fin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: none;
    color: currentColor;
}

.fin-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}

.fin-page-title {
    font-family: var(--fin-font);
    font-size: var(--fin-text-page-title);
    font-weight: 700;
    color: var(--fin-text-primary);
    margin: 0;
}

.fin-section-title {
    font-family: var(--fin-font);
    font-size: var(--fin-text-section-title);
    font-weight: 600;
    color: var(--fin-text-primary);
    margin: 0;
}

.fin-card-title {
    font-size: var(--fin-text-card-title);
    font-weight: 600;
    color: var(--fin-text-primary);
}

.fin-meta {
    font-size: var(--fin-text-meta);
    color: var(--fin-text-secondary);
}

/* ---- Reusable status pill (borders-first, semantic color only) ---- */

.fin-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--fin-space-1);
    font-size: var(--fin-text-meta);
    font-weight: 600;
    padding: 2px var(--fin-space-2);
    border-radius: 999px;
    line-height: 1.4;
}

.fin-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.fin-pill--success { background: var(--fin-success-soft); color: var(--fin-success); }
.fin-pill--warning { background: var(--fin-warning-soft); color: var(--fin-warning); }
.fin-pill--danger { background: var(--fin-danger-soft); color: var(--fin-danger); }
.fin-pill--info { background: var(--fin-info-soft); color: var(--fin-info); }
.fin-pill--neutral { background: var(--fin-bg); color: var(--fin-text-secondary); }

/* ---- Reusable timeline (Components/Shared/Timeline.razor) ---- */

.fin-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.fin-timeline__item {
    display: flex;
    gap: var(--fin-space-3);
    padding: var(--fin-space-2) 0;
    border-bottom: 1px solid var(--fin-border);
}

.fin-timeline__item:last-child {
    border-bottom: none;
}

.fin-timeline__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fin-brand);
    flex: none;
    margin-top: 5px;
}

.fin-timeline__dot--success { background: var(--fin-success); }
.fin-timeline__dot--warning { background: var(--fin-warning); }
.fin-timeline__dot--danger { background: var(--fin-danger); }

.fin-timeline__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fin-timeline__label {
    font-size: var(--fin-text-table);
    color: var(--fin-text-primary);
}

.fin-timeline__when {
    font-size: var(--fin-text-meta);
    color: var(--fin-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---- Reusable details / slide-over panel (Components/Shared/DetailsPanel.razor) ---- */

.fin-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(21, 23, 26, 0.32);
    z-index: 1200;
    display: flex;
    justify-content: flex-end;
}

.fin-panel {
    width: min(30rem, 100%);
    height: 100%;
    background: var(--fin-surface);
    box-shadow: var(--fin-shadow-md);
    display: flex;
    flex-direction: column;
    animation: fin-panel-in 160ms ease-out;
}

@keyframes fin-panel-in {
    from { transform: translateX(16px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.fin-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fin-space-4);
    border-bottom: 1px solid var(--fin-border);
    flex: none;
}

.fin-panel__close {
    border: none;
    background: none;
    color: var(--fin-text-secondary);
    width: 28px;
    height: 28px;
    border-radius: var(--fin-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fin-panel__close:hover {
    background: var(--fin-bg);
    color: var(--fin-text-primary);
}

.fin-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: var(--fin-space-4);
}

@media (prefers-reduced-motion: reduce) {
    .fin-panel { animation: none; }
}

/* ---- Skeleton loading (shimmer) ----
   Replaces spinners and plain "Ładowanie…" text everywhere the final layout shape is already
   known (Stripe/GitHub/M365-style progressive loading) - the page's real structure (sidenav,
   cards, table headers) renders immediately, and only the data-shaped parts shimmer until their
   content arrives. Never use these for a genuinely unknown/variable layout - a spinner is still
   fine there, there just isn't one of those left in this app's Finance surfaces today. */

@keyframes fin-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.fin-skeleton {
    display: block;
    border-radius: var(--fin-radius-sm);
    background: linear-gradient(90deg, var(--fin-border) 25%, #eef0f2 37%, var(--fin-border) 63%);
    background-size: 300% 100%;
    animation: fin-shimmer 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .fin-skeleton { animation: none; background: var(--fin-border); }
}

.fin-skeleton--line { height: 12px; width: 100%; }
.fin-skeleton--line.is-title { height: 18px; width: 45%; }
.fin-skeleton--line.is-short { width: 35%; }
.fin-skeleton--line.is-medium { width: 65%; }

.fin-skeleton--row { height: 15px; width: 100%; }

.fin-skeleton--card { height: 92px; width: 100%; border-radius: var(--fin-radius); }

.fin-skeleton--nav-line { height: 10px; width: 68%; border-radius: 3px; }

/* Sized like a portrait A4 page for a PDF-preview placeholder, capped so it never outgrows the
   real iframe it's standing in for. */
.fin-skeleton--document {
    width: 100%;
    max-width: 32rem;
    aspect-ratio: 1 / 1.414;
    max-height: 70vh;
    border-radius: var(--fin-radius);
    margin: 0 auto;
}

.fin-skeleton-stack { display: flex; flex-direction: column; gap: var(--fin-space-2); }
.fin-skeleton-content { display: flex; flex-direction: column; gap: var(--fin-space-3); }

.fin-skeleton-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.9rem;
}
