/* Financial System - Professional, audit-ready UI */
:root {
  --bg: #f8f9fa;
  --card: #fff;
  --border: #dee2e6;
  --text: #212529;
  --primary: #0d6efd;
  --success: #198754;
  --danger: #dc3545;
  --warning: #ffc107;
}
* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.app-header { background: #1a1d21; color: #fff; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; position: sticky; top: 0; z-index: 1100; }
.app-header .brand { font-weight: 700; font-size: 1.1rem; }
.app-header nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.app-header nav a { color: #e0e0e0; text-decoration: none; }
.app-header nav a:hover { color: #fff; }
.app-header .user { color: #aaa; font-size: 0.9rem; margin-right: 8px; }
.app-main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.app-footer { text-align: center; padding: 12px; color: #6c757d; font-size: 0.85rem; border-top: 1px solid var(--border); margin-top: 24px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px 0; font-size: 1.2rem; }
/* A4-like preview for document views */
.doc-preview { max-width: 210mm; margin: 0 auto 16px; padding: 24px; box-shadow: 0 8px 18px rgba(0,0,0,0.08); }
.doc-preview .toolbar { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.doc-preview table.data { margin-top: 10px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
table.data th { background: #f1f3f5; font-weight: 600; font-size: 0.85rem; }
table.data tr:nth-child(even) { background: #fafbfc; }
table.data .num { text-align: right; }
table.data .actions { white-space: nowrap; }

.btn { display: inline-block; padding: 6px 12px; border-radius: 4px; border: 1px solid transparent; cursor: pointer; font-size: 0.9rem; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-sm { padding: 4px 8px; font-size: 0.8rem; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; max-width: 400px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; }
.alert-success { background: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.alert-danger { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.alert-info { background: #cff4fc; color: #055160; border: 1px solid #b6effb; }

.badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-draft { background: #e9ecef; color: #495057; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d1e7dd; color: #0f5132; }
.badge-rejected { background: #f8d7da; color: #842029; }
.badge-paid { background: #cfe2ff; color: #084298; }
.badge-locked { background: #1a1d21; color: #fff; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .app-header nav { flex-direction: column; align-items: flex-start; }
  .app-main { padding: 12px; }
  .card { padding: 12px; }
  .doc-preview { padding: 14px; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  table.data, .line-items table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  table.data th, table.data td { white-space: nowrap; }
}

.line-items { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.line-items table { margin: 0; }
.line-items th:nth-child(1) { width: 40%; }
.line-items th:nth-child(2), .line-items th:nth-child(3), .line-items th:nth-child(4) { width: 15%; }
.line-items .add-line { padding: 8px; background: #f8f9fa; border-top: 1px solid var(--border); }

.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
