*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warn-bg: #fffbeb;
  --warn-border: #fcd34d;
  --ok: #16a34a;
  --radius: 8px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid transparent; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: #9ca3af; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 0; }
.btn-link:hover { color: var(--text); }

/* App layout */
.app-layout { display: flex; min-height: 100vh; }
.app-main { flex: 1; padding: 32px 36px; max-width: 960px; }

/* Sidebar */
.sidebar { width: 220px; min-height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { padding: 18px 16px 14px; }
.sidebar-brand a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 15px; }
.sidebar-brand a:hover { color: var(--primary); }
.sidebar-section { padding: 4px 8px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar-link { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; color: var(--text-muted); text-decoration: none; transition: background 0.1s, color 0.1s; }
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: #eff6ff; color: var(--primary); font-weight: 500; }
.sidebar-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-nav-wrap { flex: 1; display: flex; flex-direction: column; }
.sidebar-group-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 10px; margin-bottom: 4px; }
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 8px 16px; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); margin-top: auto; }
.sidebar-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sidebar-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-username { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 4px; display: flex; align-items: center; }
.sidebar-logout:hover { color: var(--danger); background: #fef2f2; }

/* Auth */
.auth-body { background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-container { width: 100%; max-width: 420px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; }
.auth-card--wide { max-width: 520px; margin: 0 auto; }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.auth-footer { margin-top: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.auth-footer a { color: var(--primary); text-decoration: none; }

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); background: #fff; outline: none; transition: border-color 0.15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-group { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.radio-option { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.radio-option:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.section-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: #92400e; }
.alert-ok { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.field-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Main content (used for non-app pages like landing/auth) */
.main-content { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

/* Sections */
.section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-bottom: 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-header h2 { font-size: 16px; font-weight: 600; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-warn { background: #fef9c3; color: #854d0e; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state p { margin-bottom: 16px; }

/* Text */
.text-muted { color: var(--text-muted); }

/* Landing */
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; }
.landing-brand { font-size: 18px; font-weight: 700; }
.landing-nav div { display: flex; gap: 10px; }
.hero { text-align: center; padding: 80px 40px 60px; }
.hero h1 { font-size: 42px; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero p { font-size: 18px; color: var(--text-muted); margin-bottom: 32px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 40px; max-width: 900px; margin: 0 auto; }
.feature { text-align: center; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature h3 { font-weight: 600; margin-bottom: 8px; }
.feature p { color: var(--text-muted); font-size: 13px; }
.pricing { padding: 60px 40px; text-align: center; }
.pricing h2 { font-size: 28px; font-weight: 700; margin-bottom: 32px; }
.pricing-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; max-width: 600px; margin: 0 auto; }
.pricing-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; text-align: left; }
.pricing-card--featured { border-color: var(--primary); }
.pricing-name { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.pricing-price { font-size: 32px; font-weight: 800; margin-bottom: 20px; }
.pricing-price span { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.pricing-card ul { list-style: none; margin-bottom: 24px; }
.pricing-card ul li { padding: 6px 0; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.pricing-card ul li::before { content: '✓ '; color: var(--ok); font-weight: 600; }

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb span { margin: 0 4px; }

/* Status card */
.status-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 12px; border: 1px solid; }
.status-ok { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.status-icon { font-size: 24px; }

/* Steps */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 16px; padding: 24px 0; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step-number { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.step-active .step-number { background: var(--primary); color: #fff; }
.step-done .step-number { background: var(--ok); color: #fff; }
.step-pending .step-number { background: var(--border); color: var(--text-muted); }
.step-content h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.step-pending { opacity: 0.5; }

/* Instructions list */
.instructions { padding-left: 20px; margin-top: 12px; }
.instructions li { padding: 5px 0; font-size: 13px; color: var(--text); }
.instructions li strong { color: var(--text); }
.instructions code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* File upload */
.file-upload { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: border-color 0.15s; }
.file-upload:hover { border-color: var(--primary); }
.file-upload--disabled { opacity: 0.4; cursor: not-allowed; }
.file-upload input[type="file"] { display: none; }
.file-label { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.file-icon { font-size: 28px; }
.file-text { font-size: 13px; color: var(--text-muted); }

/* Business cards (accountant dashboard) */
.biz-grid { display: flex; flex-direction: column; gap: 12px; }
.biz-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; }
.biz-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.biz-name { font-size: 15px; font-weight: 600; color: var(--text); }
.biz-cuit { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.biz-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Invoice items */
.item-row { position: relative; margin-bottom: 12px; }
.item-fields { display: flex; gap: 10px; align-items: flex-end; }
.btn-remove-item { position: absolute; top: 24px; right: -28px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 4px; }
.btn-remove-item:hover { color: var(--danger); }
#itemsSection { padding-right: 32px; }
.invoice-total { display: flex; justify-content: flex-end; align-items: center; gap: 20px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 12px; }
.invoice-total-label { font-size: 13px; color: var(--text-muted); }
.invoice-total-value { font-size: 18px; font-weight: 700; }
.invoice-totals { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.invoice-total-row { display: flex; gap: 40px; font-size: 13px; }
.invoice-total-row span:first-child { color: var(--text-muted); }
.invoice-total-row--final { font-size: 16px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* Error page */
.error-page { text-align: center; padding: 80px 24px; }
.error-page h1 { font-size: 28px; margin-bottom: 12px; }
.error-page p { color: var(--text-muted); margin-bottom: 24px; }
