:root {
  --brand-navy: #193B59;
  --brand-terracotta: #C05621;
  --brand-gold: #D97706;
  --bg-cream: #F7F3EA;
  --bg-subtle: #EFECE6;
  --ink-primary: #1F2937;
  --ink-secondary: #4B5563;
  --border-thin: #D1D5DB;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg-cream); color: var(--ink-primary); font-family: var(--font-sans); padding: 16px; line-height: 1.5; }

.app-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 2px solid var(--brand-navy); margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-logo-svg { width: 42px; height: 42px; flex-shrink: 0; }
.brand-title { font-size: 22px; font-weight: 800; color: var(--brand-navy); letter-spacing: 1px; }
.brand-tagline { font-size: 13px; color: var(--ink-secondary); }

.nav-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { background: #fff; border: 1px solid var(--border-thin); padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 4px; text-align: center; }
.btn-primary { background: var(--brand-navy); color: #fff; border: none; }
.btn-accent { background: var(--brand-gold); color: #fff; border: none; }
.btn-whatsapp { background: #25D366; color: #fff; border: none; }
.btn:hover { opacity: 0.9; }

.container { max-width: 1100px; margin: 0 auto; }
.docket-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.card { background: #fff; border: 1px solid var(--border-thin); padding: 20px; border-radius: 6px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.section-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--brand-terracotta); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.section-title-bilingual { font-size: 14px; font-weight: 700; color: var(--brand-navy); margin-bottom: 12px; }

.dash-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }

/* Wayfinding Map */
.wayfinding-container { background: #fff; border: 1px solid var(--border-thin); padding: 16px; border-radius: 6px; margin-bottom: 20px; }
.wayfinding-nodes { display: flex; justify-content: space-between; position: relative; margin-top: 10px; }
.node-wrapper { display: flex; flex-direction: column; align-items: center; flex: 1; }
.way-node { width: 32px; height: 32px; border-radius: 50%; background: #e5e7eb; color: #6b7280; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.way-node.completed { background: #10B981; color: #fff; }
.way-node.active { background: var(--brand-navy); color: #fff; }
.node-title { font-size: 12px; font-weight: 600; color: var(--ink-secondary); text-align: center; }

/* Timeline & Chain */
.timeline-item { border-left: 2px solid var(--brand-navy); padding-left: 12px; margin-bottom: 16px; }
.timeline-step { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--brand-terracotta); }
.timeline-head { font-weight: 700; font-size: 14px; color: var(--ink-primary); }
.timeline-body { font-size: 13px; color: var(--ink-secondary); margin: 4px 0; }
.tag-badge { display: inline-block; background: var(--bg-subtle); padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; font-family: var(--font-mono); }
.tag-master { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }

.chain-box { background: var(--bg-subtle); border: 1px dashed var(--border-thin); padding: 10px 12px; border-radius: 4px; }
.chain-role { font-size: 10px; font-family: var(--font-mono); font-weight: 700; color: var(--brand-terracotta); text-transform: uppercase; }
.chain-name { font-weight: 700; font-size: 13px; color: var(--brand-navy); }
.chain-office { font-size: 11px; color: var(--ink-secondary); }
.chain-date { font-size: 10px; color: #6b7280; margin-top: 2px; }
.chain-arrow { text-align: center; color: var(--brand-terracotta); font-weight: 700; margin: 4px 0; }

.sla-progress-bg { background: #e5e7eb; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.sla-progress-fill { background: var(--brand-terracotta); height: 100%; }

/* Forms & Scrollable Table */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border-thin); border-radius: 4px; font-family: inherit; font-size: 13px; }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cabinet-table { width: 100%; border-collapse: collapse; margin-top: 10px; min-width: 600px; }
.cabinet-table th, .cabinet-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border-thin); font-size: 13px; }
.cabinet-table th { background: var(--bg-subtle); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--bg-subtle); }

.user-badge { font-size: 12px; font-weight: 700; color: var(--brand-navy); background: var(--bg-subtle); padding: 6px 12px; border-radius: 4px; border: 1px solid var(--border-thin); display: inline-block; }

/* Modal & WhatsApp Simulator */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 999; }
.modal-box { background: #fff; width: 90%; max-width: 520px; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.2); max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { background: var(--brand-navy); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; }
.modal-body { padding: 16px; overflow-y: auto; font-size: 13px; line-height: 1.6; }

.whatsapp-header { background: #075E54; color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.whatsapp-chat-body { background: #E5DDD5; height: 280px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { max-width: 80%; padding: 8px 12px; border-radius: 8px; font-size: 12px; line-height: 1.4; position: relative; }
.chat-bubble.inbound { background: #fff; align-self: flex-start; border-bottom-left-radius: 0; }
.chat-bubble.outbound { background: #DCF8C6; align-self: flex-end; border-bottom-right-radius: 0; }
.chat-timestamp { font-size: 9px; color: #888; text-align: right; margin-top: 4px; }

.app-footer { text-align: center; margin-top: 40px; font-size: 12px; color: var(--ink-secondary); border-top: 1px solid var(--border-thin); padding-top: 16px; }

/* Print Media Query */
@media print {
  body { background: #fff; color: #000; padding: 0; }
  .app-header, .nav-actions, .btn, .app-footer, .wayfinding-container { display: none !important; }
  .modal-backdrop { position: static; background: none; }
  .modal-box { box-shadow: none; max-width: 100%; border: none; }
  .modal-header { background: none; color: #000; border-bottom: 2px solid #000; padding: 0 0 8px 0; }
  #wa-close { display: none; }
}

@media (max-width: 768px) {
  body { padding: 12px; }
  .app-header { flex-direction: column; align-items: flex-start; }
  .nav-actions { width: 100%; display: flex; flex-direction: column; align-items: stretch; margin-top: 8px; }
  .nav-actions .btn, .nav-actions .user-badge { width: 100%; text-align: center; box-sizing: border-box; }
  .docket-grid { grid-template-columns: 1fr; }
  .dash-metrics-grid { grid-template-columns: 1fr; }
  .dash-hero-content { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dash-hero-content button { width: 100%; }
  .node-title { font-size: 10px; }
  .way-node { width: 28px; height: 28px; font-size: 11px; }
}