﻿/* ========================================
   MODERN DESIGN SYSTEM v1.0
   Inspired by shadcn/ui, 21st.dev, Dribbble
   ======================================== */

/* --------------------------------
   CSS Variables & Design Tokens
   -------------------------------- */
:root {
    /* Color Palette - Refined Slate Theme (muted, elegant) */
    --background: oklch(0.98 0.002 264);
    --foreground: oklch(0.18 0.02 264);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.18 0.02 264);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.18 0.02 264);
    --primary: oklch(0.52 0.14 264);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.965 0.003 264);
    --secondary-foreground: oklch(0.25 0.015 264);
    --muted: oklch(0.965 0.003 264);
    --muted-foreground: oklch(0.50 0.01 264);
    --accent: oklch(0.955 0.004 264);
    --accent-foreground: oklch(0.25 0.015 264);
    --destructive: oklch(0.55 0.16 25);
    --destructive-foreground: oklch(0.985 0 0);
    --success: oklch(0.58 0.12 155);
    --success-foreground: oklch(0.985 0 0);
    --warning: oklch(0.75 0.12 75);
    --warning-foreground: oklch(0.25 0.015 264);
    --border: oklch(0.915 0.005 264);
    --input: oklch(0.915 0.005 264);
    --ring: oklch(0.52 0.14 264);
    
    /* Sidebar Specific */
    --sidebar-bg: oklch(0.16 0.015 264);
    --sidebar-fg: oklch(0.90 0.005 264);
    --sidebar-muted: oklch(0.60 0.01 264);
    --sidebar-active: oklch(0.65 0.10 264);
    --sidebar-active-bg: oklch(0.22 0.025 264);
    --sidebar-hover: oklch(0.20 0.02 264);
    --sidebar-border: oklch(0.25 0.02 264);
    
    /* Radius - Refined corners */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.625rem;
    --radius-2xl: 0.875rem;
    --radius-full: 9999px;
    
    /* Shadows - Subtle and diffused */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.03);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04), 0 1px 3px 0 rgb(0 0 0 / 0.06);
    --shadow-md: 0 2px 4px -1px rgb(0 0 0 / 0.05), 0 4px 6px -1px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 4px 12px -2px rgb(0 0 0 / 0.06), 0 8px 16px -4px rgb(0 0 0 / 0.08);
    --shadow-xl: 0 8px 24px -4px rgb(0 0 0 / 0.08), 0 16px 32px -8px rgb(0 0 0 / 0.06);
    --shadow-glow: 0 0 16px rgb(100 116 139 / 0.08);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: blur(12px);
    
    /* Layout */
    --sidebar-width: 208px;
    --sidebar-collapsed: 58px;
    --header-height: 52px;
    --content-max-width: 1120px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Mode */
[data-theme="dark"], .dark {
    --background: oklch(0.15 0.01 264);
    --foreground: oklch(0.93 0.005 264);
    --card: oklch(0.19 0.012 264);
    --card-foreground: oklch(0.93 0.005 264);
    --popover: oklch(0.19 0.012 264);
    --popover-foreground: oklch(0.93 0.005 264);
    --primary: oklch(0.62 0.12 264);
    --primary-foreground: oklch(0.15 0 0);
    --secondary: oklch(0.22 0.008 264);
    --secondary-foreground: oklch(0.90 0.005 264);
    --muted: oklch(0.22 0.008 264);
    --muted-foreground: oklch(0.60 0.01 264);
    --accent: oklch(0.22 0.008 264);
    --accent-foreground: oklch(0.90 0.005 264);
    --border: oklch(0.26 0.01 264);
    --input: oklch(0.22 0.008 264);
    --ring: oklch(0.62 0.12 264);
    
    --glass-bg: rgba(25, 28, 38, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --sidebar-bg: oklch(0.13 0.012 264);
    --sidebar-hover: oklch(0.18 0.015 264);
    --sidebar-active-bg: oklch(0.22 0.025 264);
    --sidebar-border: oklch(0.22 0.015 264);
}

/* --------------------------------
   Reset & Base Styles
   -------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0 solid var(--border);
}

html {
    font-size: 13px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
}

/* --------------------------------
   Typography System
   -------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.025em;
    color: var(--foreground);
}

h1 { font-size: 36px; font-weight: 700; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 16px; }

.text-display { font-size: 48px; font-weight: 700; letter-spacing: -0.04em; }
.text-headline { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; }
.text-title { font-size: 20px; font-weight: 600; }
.text-body { font-size: 15px; line-height: 1.7; }
.text-small { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }

/* --------------------------------
   Layout System
   -------------------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow), transform var(--transition-slow);
}

.app-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

.app-sidebar.collapsed + .app-main {
    margin-left: var(--sidebar-collapsed);
}

.app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: 50;
}

.app-content {
    flex: 1;
    padding: 1.25rem;
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* --------------------------------
   Sidebar Components
   -------------------------------- */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar-logo {
    width: 29px;
    height: 29px;
    background: linear-gradient(135deg, var(--primary), oklch(0.55 0.12 290));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--sidebar-fg);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.625rem;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 1.25rem;
}

.sidebar-section-title {
    padding: 0.5rem 0.75rem;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-muted);
    margin-bottom: 0.25rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--sidebar-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: 0.0625rem;
}

.sidebar-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-fg);
}

.sidebar-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

.sidebar-item .icon {
    width: 16px;
    height: 16px;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.sidebar-item.active .icon {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: oklch(0.52 0.10 264);
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border);
}

/* --------------------------------
   Header Components
   -------------------------------- */
.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--foreground);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    color: var(--muted-foreground);
}

.header-breadcrumb a {
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.header-breadcrumb a:hover {
    color: var(--foreground);
}

.header-breadcrumb .separator {
    opacity: 0.5;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.header-search {
    position: relative;
    width: 224px;
}

.header-search input {
    width: 100%;
    height: 30px;
    padding: 0 1rem 0 2.5rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    color: var(--foreground);
    transition: all var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px oklch(0.52 0.14 264 / 0.1);
}

.header-search input::placeholder {
    color: var(--muted-foreground);
}

.header-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    font-size: 1rem;
}

/* --------------------------------
   Card System
   -------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: oklch(0.99 0 0);
}

[data-theme="dark"] .card-header,
.dark .card-header {
    background: oklch(0.16 0.01 264);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .icon {
    font-size: 1.125rem;
    color: var(--primary);
}

.card-description {
    font-size: 13px;
    color: var(--muted-foreground);
    margin-top: 0.125rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: oklch(0.98 0 0);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-theme="dark"] .card-footer,
.dark .card-footer {
    background: oklch(0.14 0.005 264);
}

/* Glass Card Variant */
.card-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

/* Gradient Card Variants */
.card-gradient-primary {
    background: linear-gradient(135deg, oklch(0.52 0.13 264), oklch(0.48 0.12 280));
    border: none;
    color: white;
}

.card-gradient-primary .card-title,
.card-gradient-primary .card-description {
    color: white;
}

/* --------------------------------
   Stat Cards
   -------------------------------- */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1rem;
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: oklch(0.87 0.005 264);
}

.stat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: oklch(0.52 0.14 264 / 0.08);
    color: var(--primary);
}

.stat-icon.success {
    background: oklch(0.58 0.12 155 / 0.08);
    color: var(--success);
}

.stat-icon.warning {
    background: oklch(0.75 0.12 75 / 0.08);
    color: oklch(0.60 0.10 65);
}

.stat-icon.danger {
    background: oklch(0.55 0.16 25 / 0.08);
    color: var(--destructive);
}

.stat-label {
    font-size: 13px;
    color: var(--muted-foreground);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--foreground);
    letter-spacing: -0.03em;
    margin-top: 0.25rem;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 12px;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    margin-top: 0.5rem;
}

.stat-trend.up {
    background: oklch(0.58 0.12 155 / 0.08);
    color: oklch(0.48 0.10 155);
}

.stat-trend.down {
    background: oklch(0.55 0.16 25 / 0.08);
    color: var(--destructive);
}

/* --------------------------------
   Button System
   -------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px oklch(0.52 0.14 264 / 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 13px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 16px;
}

.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 26px;
    height: 26px;
}

/* Primary Button */
.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background: oklch(0.47 0.13 264);
}

.btn-primary:active {
    background: oklch(0.42 0.12 264);
}

/* Secondary Button */
.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover {
    background: oklch(0.93 0 0);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background: var(--secondary);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--secondary);
    border-color: oklch(0.85 0 0);
}

.btn-outline-primary {
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline-primary:hover {
    background: oklch(0.52 0.14 264 / 0.06);
}

/* Destructive Button */
.btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-destructive:hover {
    background: oklch(0.50 0.14 25);
}

/* Success Button */
.btn-success {
    background: var(--success);
    color: var(--success-foreground);
}

.btn-success:hover {
    background: oklch(0.52 0.10 155);
}

/* --------------------------------
   Form Controls
   -------------------------------- */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 14px;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px oklch(0.52 0.14 264 / 0.1);
}

.form-control::placeholder {
    color: var(--muted-foreground);
}

.form-control:disabled {
    background: var(--muted);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* --------------------------------
   Badge System
   -------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: var(--radius-full);
}

.badge-default {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-primary {
    background: oklch(0.52 0.14 264 / 0.08);
    color: var(--primary);
}

.badge-success {
    background: oklch(0.58 0.12 155 / 0.08);
    color: oklch(0.48 0.10 155);
}

.badge-warning {
    background: oklch(0.80 0.10 75 / 0.15);
    color: oklch(0.50 0.10 65);
}

.badge-danger {
    background: oklch(0.55 0.16 25 / 0.08);
    color: var(--destructive);
}

.badge-info {
    background: oklch(0.58 0.08 220 / 0.08);
    color: oklch(0.48 0.08 220);
}

/* ============================================================
   Unified Status Badge (.status-badge[data-status])
   ============================================================
   Single pattern for all entity statuses across the app.
   Usage: <span class="status-badge" data-status="active">Active</span>
   The icon is optional: <span class="material-symbols-outlined">check_circle</span>
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    white-space: nowrap;
    /* Default: neutral */
    background: oklch(0.93 0 0);
    color: oklch(0.4 0 0);
}

.status-badge .material-symbols-outlined {
    font-size: 0.875rem;
}

/* Deal statuses */
.status-badge[data-status="recap_received"]    { background: oklch(0.95 0.003 264);    color: oklch(0.45 0.01 264); }
.status-badge[data-status="negotiation"]       { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="contract_pending"]  { background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-badge[data-status="contract_review"]   { background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-badge[data-status="active"]            { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }
.status-badge[data-status="in_execution"]      { background: oklch(0.93 0.05 264); color: oklch(0.48 0.10 264); }
.status-badge[data-status="reconciliation"]    { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="completed"]         { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }
.status-badge[data-status="cancelled"]         { background: oklch(0.95 0.04 25); color: oklch(0.50 0.12 25); }

/* Contract statuses */
.status-badge[data-status="draft"]             { background: oklch(0.95 0.003 264);    color: oklch(0.45 0.01 264); }
.status-badge[data-status="pending_commercial"]{ background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-badge[data-status="pending_legal"]     { background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-badge[data-status="approved"]          { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }
.status-badge[data-status="rejected"]          { background: oklch(0.95 0.04 25); color: oklch(0.50 0.12 25); }
.status-badge[data-status="signed"]            { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }

/* Invoice statuses */
.status-badge[data-status="received"]          { background: oklch(0.95 0.003 264);    color: oklch(0.45 0.01 264); }
.status-badge[data-status="verified"]          { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="sent_to_bank"]      { background: oklch(0.93 0.05 264); color: oklch(0.48 0.10 264); }
.status-badge[data-status="payment_sent"]      { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="swift_received"]    { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="confirmed"]         { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }
.status-badge[data-status="paid"]              { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }

/* Shipment statuses */
.status-badge[data-status="requested"]         { background: oklch(0.95 0.003 264);    color: oklch(0.45 0.01 264); }
.status-badge[data-status="inspection_scheduled"] { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="loading"]           { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="in_transit"]        { background: oklch(0.93 0.05 264); color: oklch(0.48 0.10 264); }
.status-badge[data-status="arrived"]           { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }
.status-badge[data-status="documents_received"] { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }

/* KYC statuses */
.status-badge[data-status="pending"]           { background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-badge[data-status="in_review"]         { background: oklch(0.94 0.04 220); color: oklch(0.48 0.08 220); }
.status-badge[data-status="expired"]           { background: oklch(0.95 0.04 25); color: oklch(0.50 0.12 25); }

/* Operational statuses */
.status-badge[data-status="needs_attention"]   { background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-badge[data-status="paused"]            { background: oklch(0.95 0.003 264);    color: oklch(0.45 0.01 264); }
.status-badge[data-status="blocked"]           { background: oklch(0.95 0.04 25); color: oklch(0.50 0.12 25); }
.status-badge[data-status="resolved"]          { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }

/* Legacy aliases â€” kept for backward compatibility with existing class-based usage */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-lg);
}
.status-draft     { background: oklch(0.95 0.003 264);    color: oklch(0.45 0.01 264); }
.status-pending   { background: oklch(0.94 0.04 75);  color: oklch(0.50 0.08 65); }
.status-active,
.status-approved  { background: oklch(0.94 0.04 155); color: oklch(0.48 0.08 155); }
.status-completed { background: oklch(0.93 0.05 264); color: oklch(0.48 0.10 264); }
.status-rejected  { background: oklch(0.95 0.04 25); color: oklch(0.50 0.12 25); }

/* --------------------------------
   Detail/Info Grid
   -------------------------------- */
.info-grid {
    display: grid;
    gap: 0.5rem;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 13px;
    color: var(--muted-foreground);
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

/* --------------------------------
   Workflow/Stepper
   -------------------------------- */
.workflow {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 1rem 0;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.workflow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 19px);
    width: calc(100% - 38px);
    height: 2px;
    background: var(--border);
}

.workflow-step.completed:not(:last-child)::after {
    background: var(--success);
}

.workflow-step.current:not(:last-child)::after {
    background: linear-gradient(90deg, var(--primary) 0%, var(--border) 100%);
}

.workflow-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--secondary);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--muted-foreground);
    position: relative;
    z-index: 1;
    transition: all var(--transition-base);
}

.workflow-step.completed .workflow-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.workflow-step.current .workflow-icon {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 3px oklch(0.52 0.14 264 / 0.15);
}

.workflow-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-top: 0.5rem;
    text-align: center;
}

.workflow-step.completed .workflow-label,
.workflow-step.current .workflow-label {
    color: var(--foreground);
}

/* --------------------------------
   Table Styles
   -------------------------------- */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead {
    background: oklch(0.98 0 0);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .table thead,
.dark .table thead {
    background: oklch(0.16 0.01 264);
}

.table th {
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: oklch(0.98 0 0);
}

[data-theme="dark"] .table tbody tr:hover,
.dark .table tbody tr:hover {
    background: oklch(0.18 0.01 264);
}

/* --------------------------------
   Tabs Component
   -------------------------------- */
.tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted-foreground);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--foreground);
}

.tab.active {
    background: var(--card);
    color: var(--foreground);
    box-shadow: var(--shadow-sm);
}

.tab-count {
    padding: 0.125rem 0.5rem;
    font-size: 12px;
    font-weight: 600;
    background: oklch(0.92 0 0);
    color: var(--muted-foreground);
    border-radius: var(--radius-full);
}

.tab.active .tab-count {
    background: oklch(0.52 0.14 264 / 0.08);
    color: var(--primary);
}

/* --------------------------------
   Dialog/Modal
   -------------------------------- */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: oklch(0 0 0 / 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.dialog-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.dialog {
    background: var(--card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 384px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.dialog-backdrop.open .dialog {
    transform: scale(1) translateY(0);
}

.dialog-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dialog-title {
    font-size: 18px;
    font-weight: 600;
}

.dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.dialog-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* --------------------------------
   Modal (shared, documents-page style)
   -------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 448px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-lg {
    max-width: 640px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-weight: 600;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--muted-foreground);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}

.modal-close:hover {
    background: oklch(0.96 0 0);
    color: var(--foreground);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.form-hint {
    font-size: 12px;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* --------------------------------
   Modal Drop Zone
   -------------------------------- */
.modal-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-drop-zone:hover,
.modal-drop-zone.dragover {
    border-color: var(--primary);
    background: oklch(from var(--primary) l c h / 0.05);
}

.modal-drop-zone .material-symbols-outlined {
    font-size: 2.5rem;
    color: var(--muted-foreground);
}

/* --------------------------------
   Progress Bar
   -------------------------------- */
.progress-bar {
    height: 6px;
    background: oklch(0.94 0 0);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* --------------------------------
   Toast/Notifications
   -------------------------------- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    min-width: 256px;
    max-width: 320px;
    animation: slideIn var(--transition-spring);
}

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

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 13px;
    color: var(--muted-foreground);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--destructive); }
.toast.warning { border-left: 4px solid var(--warning); }

/* --------------------------------
   Empty State
   -------------------------------- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.empty-icon {
    width: 51px;
    height: 51px;
    margin: 0 auto 1rem;
    background: var(--secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--muted-foreground);
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-description {
    font-size: 14px;
    color: var(--muted-foreground);
    margin-bottom: 1.5rem;
}

/* --------------------------------
   Loading States
   -------------------------------- */
.spinner {
    width: 19px;
    height: 19px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--secondary) 25%, oklch(0.95 0 0) 50%, var(--secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

/* --------------------------------
   Utilities
   -------------------------------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.d-none { display: none !important; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------
   Responsive
   -------------------------------- */
@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: oklch(0 0 0 / 0.4);
        z-index: 150;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }
    
    .sidebar-overlay.visible {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 45px;
    }
    
    .app-content {
        padding: 1rem;
    }
    
    .header-search {
        width: 100%;
        display: none;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* --------------------------------
   Animations
   -------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in { animation: fadeIn var(--transition-base); }
.animate-fade-in-up { animation: fadeInUp var(--transition-base); }
.animate-fade-in-down { animation: fadeInDown var(--transition-base); }
.animate-scale-in { animation: scaleIn var(--transition-base); }

/* Page load stagger animation */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* ==================== Notification Dropdown ==================== */
.notification-wrapper {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--destructive);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

.notification-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 380px;
    max-height: 520px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInDown 0.15s ease-out;
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
}

/* Notification tab bar */
.notification-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
    flex-shrink: 0;
}
.notification-tabs::-webkit-scrollbar { display: none; }

.notif-tab {
    flex-shrink: 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.45rem 0.75rem;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.notif-tab:hover { color: var(--foreground); }
.notif-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.notif-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--destructive);
    color: #fff;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
}

.notification-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 340px;
}

.notification-panel-footer {
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.notification-panel-footer a {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.notification-panel-footer a:hover {
    text-decoration: underline;
}

/* Notification items */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

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

.notification-item:hover {
    background: var(--muted);
}

.notification-item.unread {
    background: oklch(0.97 0.01 264);
}

.notification-item.unread:hover {
    background: oklch(0.96 0.015 264);
}

.notification-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.notification-item-icon.icon-warning { background: oklch(0.68 0.10 75); }
.notification-item-icon.icon-info { background: oklch(0.58 0.10 240); }
.notification-item-icon.icon-primary { background: var(--primary); }
.notification-item-icon.icon-success { background: oklch(0.55 0.10 155); }
.notification-item-icon.icon-danger { background: var(--destructive); }
.notification-item-icon.icon-muted { background: var(--muted-foreground); }

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
}

.notification-item-message {
    font-size: 12px;
    color: var(--muted-foreground);
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item-time {
    font-size: 11px;
    color: var(--muted-foreground);
    margin-top: 4px;
}

.notification-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.notification-item:hover .notification-item-actions {
    opacity: 1;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
