/**
 * IQ Suite Editorial Design System
 * Shared tokens + primitives for ReconcileIQ, CodeIQ, LedgerIQ
 *
 * Aesthetic: warm cream palette, Fraunces serif headlines,
 * DM Sans body, hue-tinted product colors, grain texture, rule-line dividers.
 */

/* Fonts: Fraunces (editorial serif) + DM Sans (clean body) + JetBrains Mono (data) */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,600;9..144,700&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   EDITORIAL PALETTE
   ============================================ */
:root {
    /* Product color triads */
    --riq-primary: #5b6eae;
    --riq-deep: #3d4d7a;
    --riq-light: #e8ebf4;
    --ciq-primary: #c4576a;
    --ciq-deep: #9a4054;
    --ciq-light: #f5e8eb;
    --liq-primary: #4a9080;
    --liq-deep: #3a7265;
    --liq-light: #e6f2ef;

    /* Warm neutrals */
    --cream: #faf8f5;
    --ivory: #f5f2ed;
    --paper: #edeae4;
    --ink: #1a1a1a;
    --ink-light: #3d3d3d;
    --ink-muted: #6b6b6b;
    --ink-subtle: #999999;
    --rule: #d4d0c8;

    /* Status */
    --ed-success: #059669;
    --ed-success-light: #d1fae5;
    --ed-warning: #d97706;
    --ed-warning-light: #fef3c7;
    --ed-error: #dc2626;
    --ed-error-light: #fee2e2;

    /* Typography */
    --ed-font-serif: 'Fraunces', Georgia, serif;
    --ed-font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --ed-font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Shadows - minimal */
    --ed-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --ed-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --ed-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

    /* Border radius - tight editorial */
    --ed-radius: 4px;
    --ed-radius-lg: 8px;
    --ed-radius-pill: 100px;
}

/* ============================================
   BODY BASE
   ============================================ */
body.editorial {
    font-family: var(--ed-font-sans);
    background: var(--cream);
    color: var(--ink);
    line-height: 1.5;
}

/* Grain texture removed - feTurbulence SVG filter caused rendering lag */

/* ============================================
   EDITORIAL HEADER BAR
   ============================================ */
.ed-header {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.ed-header .brand-title {
    font-family: var(--ed-font-serif);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--ink);
}

.ed-header .brand-title a {
    color: inherit;
    text-decoration: none;
}

.ed-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ed-header-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: var(--ed-radius);
    border: 1px solid var(--rule);
    background: transparent;
    color: var(--ink-muted);
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.ed-header-btn:hover {
    background: var(--ivory);
    border-color: var(--ink-subtle);
    color: var(--ink);
}

.ed-header-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--rule);
    background: transparent;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ed-header-icon-btn:hover {
    background: var(--ivory);
    color: var(--ink);
}

/* ============================================
   EDITORIAL SIDEBAR
   ============================================ */
.ed-sidebar {
    background: var(--cream);
    border-right: 1px solid var(--rule);
}

.ed-sidebar .nav-link {
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: var(--ed-radius);
    transition: all 0.15s ease;
}

.ed-sidebar .nav-link:hover {
    background: var(--ivory);
    color: var(--ink);
}

/* ============================================
   EDITORIAL TAB NAV
   ============================================ */
.ed-tab-nav {
    display: inline-flex;
    background: var(--ivory);
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius-pill);
    padding: 4px;
    gap: 4px;
}

.ed-tab-nav button {
    border: none;
    background: transparent;
    padding: 8px 20px;
    font-family: var(--ed-font-sans);
    font-weight: 500;
    font-size: 13px;
    color: var(--ink-muted);
    border-radius: var(--ed-radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ed-tab-nav button:hover:not(.active) {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.6);
}

.ed-tab-nav button.active.riq-tab {
    background: var(--riq-primary);
    color: #fff;
}

.ed-tab-nav button.active.ciq-tab {
    background: var(--ciq-primary);
    color: #fff;
}

.ed-tab-nav button.active.liq-tab {
    background: var(--liq-primary);
    color: #fff;
}

/* ============================================
   EDITORIAL CARDS
   ============================================ */
.ed-card {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    padding: 24px;
}

.ed-card-title {
    font-family: var(--ed-font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 16px;
}

/* ============================================
   SECTION RULE DIVIDERS
   ============================================ */
.ed-section-rule {
    font-family: var(--ed-font-serif);
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--ink-subtle);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.ed-section-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rule);
}

/* ============================================
   EDITORIAL BUTTONS
   ============================================ */
.ed-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--riq-primary);
    color: #fff;
    border: none;
    border-radius: var(--ed-radius);
    font-family: var(--ed-font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ed-btn-primary:hover {
    background: var(--riq-deep);
}

.ed-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    font-family: var(--ed-font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ed-btn-secondary:hover {
    background: var(--ivory);
    border-color: var(--ink-subtle);
}

/* ============================================
   ICON SIZING UTILITIES
   ============================================ */
.ed-icon-sm { width: 14px; height: 14px; }
.ed-icon-md { width: 18px; height: 18px; }
.ed-icon-lg { width: 24px; height: 24px; }

/* ============================================
   EDITORIAL FRAUNCES HEADINGS
   ============================================ */
.ed-heading {
    font-family: var(--ed-font-serif);
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--ink);
}

.ed-heading-xl { font-size: 32px; }
.ed-heading-lg { font-size: 24px; }
.ed-heading-md { font-size: 18px; }
.ed-heading-sm { font-size: 14px; }

/* ============================================
   MONO DATA LABELS
   ============================================ */
.ed-mono {
    font-family: var(--ed-font-mono);
}

.ed-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ink-subtle);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes edFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ed-animate {
    animation: edFadeUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ed-animate {
        animation: none;
        opacity: 1;
    }
}

/* ============================================
   TIER BADGE SYSTEM - Editorial Palette
   Universal across ReconcileIQ, CodeIQ, LedgerIQ
   ============================================ */
.tier-display {
    --tier-bg-start: #f8f5ef;
    --tier-bg-end: #eee8df;
    --tier-border: #d8d2c8;
    --tier-ink: #5f5a53;
    --tier-accent: #aca59a;
    font-family: var(--ed-font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 6px 14px 6px 10px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--tier-border);
    color: var(--tier-ink);
    background:
        linear-gradient(150deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 42%),
        linear-gradient(160deg, var(--tier-bg-start) 0%, var(--tier-bg-end) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.86),
        0 1px 2px rgba(17, 24, 39, 0.06),
        0 8px 18px -14px rgba(17, 24, 39, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tier-display::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 9999px;
    flex-shrink: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.18) 46%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(160deg, var(--tier-accent) 0%, var(--tier-accent) 100%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.55),
        0 1px 4px rgba(26, 26, 26, 0.16);
}

.tier-display:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        0 2px 6px rgba(17, 24, 39, 0.09),
        0 12px 24px -16px rgba(17, 24, 39, 0.38);
}

.tier-display:active {
    transform: translateY(0);
}

.tier-free {
    --tier-bg-start: #f7f3ec;
    --tier-bg-end: #ece5db;
    --tier-border: #d6cec0;
    --tier-ink: #696259;
    --tier-accent: #aea79a;
}

.tier-starter,
.tier-essential {
    --tier-bg-start: #ecf0fa;
    --tier-bg-end: #dfe6f6;
    --tier-border: #bac7e6;
    --tier-ink: #465b8f;
    --tier-accent: #6b82bc;
}

.tier-accountant,
.tier-api {
    --tier-bg-start: #f3e9ed;
    --tier-bg-end: #eddde4;
    --tier-border: #d7b5c1;
    --tier-ink: #8b4a5b;
    --tier-accent: #ba6f84;
}

.tier-practice-essential {
    --tier-bg-start: #f7f1e6;
    --tier-bg-end: #f1e5d5;
    --tier-border: #dbc3a1;
    --tier-ink: #8a6440;
    --tier-accent: #c1925f;
}

.tier-practice-pro {
    --tier-bg-start: #f6eaee;
    --tier-bg-end: #eedde4;
    --tier-border: #d2aeb9;
    --tier-ink: #8d5161;
    --tier-accent: #b97286;
}

.tier-pro {
    --tier-bg-start: #eceff7;
    --tier-bg-end: #dfe6f2;
    --tier-border: #bbcae1;
    --tier-ink: #4b628f;
    --tier-accent: #738bb8;
}

.tier-business,
.tier-enterprise,
.tier-premium,
.tier-enterprise-elite,
.tier-enterprise-ultimate,
.tier-enterprise_elite,
.tier-enterprise_ultimate {
    --tier-bg-start: #eaf3ef;
    --tier-bg-end: #dcebe4;
    --tier-border: #a6cdbd;
    --tier-ink: #3a6f61;
    --tier-accent: #5a9784;
}

.tier-enterprise_ultimate {
    border-width: 2px;
    padding: 5px 13px 5px 9px;
}

/* ============================================
   TAILWIND UTILITY REPLACEMENTS
   (minimal set used in tool.html after CDN removal)
   ============================================ */
.w-4 { width: 16px; }
.h-4 { height: 16px; }
.w-5 { width: 20px; }
.h-5 { height: 20px; }
.w-8 { width: 32px; }
.h-8 { height: 32px; }
.mr-2 { margin-right: 8px; }
.ml-2 { margin-left: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.my-6 { margin-top: 24px; margin-bottom: 24px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.text-xs { font-size: 12px; line-height: 1.5; }
.text-sm { font-size: 14px; line-height: 1.5; }
.text-2xl { font-size: 24px; line-height: 1.3; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.rounded { border-radius: var(--ed-radius); }
.rounded-md { border-radius: var(--ed-radius); }
.border { border: 1px solid var(--rule); }
.bg-blue-100 { background: var(--riq-light); }
.text-blue-700 { color: var(--riq-deep); }
.text-gray-500 { color: var(--ink-subtle); }
.text-gray-600 { color: var(--ink-muted); }
.space-y-3 > * + * { margin-top: 12px; }
.transition-colors { transition: color 0.2s, background-color 0.2s; }
.hover\:bg-blue-200:hover { background: var(--riq-light); }

@media (min-width: 640px) {
    .sm\:space-y-0 > * + * { margin-top: 0; }
    .sm\:space-x-4 > * + * { margin-left: 16px; }
}
