/* ABL Order Tracker — NexusLoom Limited */
.abl-wrap { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; font-size: 13px; color: #1a1a1a; max-width: 100%; }

/* Header */
.abl-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #1a3a52; border-radius: 8px 8px 0 0; margin-bottom: 14px; }
.abl-brand { display: flex; align-items: center; gap: 10px; }
.abl-logo { background: #e67e22; color: #fff; font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 5px; letter-spacing: .05em; }
.abl-tagline { color: rgba(255,255,255,.7); font-size: 12px; }
.abl-user { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.85); font-size: 12px; }
.abl-avatar { width: 28px; height: 28px; border-radius: 50%; background: #e67e22; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; text-transform: uppercase; }

/* Stats */
.abl-stats { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.abl-stat { background: #f5f7f9; border-radius: 7px; padding: 10px 12px; }
.abl-stat-label { font-size: 10px; color: #6b7280; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.abl-stat-value { font-size: 18px; font-weight: 600; color: #1a3a52; }
.abl-overdue { color: #c62828 !important; }

/* Tabs */
.abl-tabs { display: flex; gap: 2px; border-bottom: 1px solid #e5e7eb; margin-bottom: 14px; flex-wrap: wrap; }
.abl-tab { padding: 7px 14px; font-size: 12px; cursor: pointer; border: none; background: none; color: #6b7280; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; }
.abl-tab.active { color: #1a3a52; border-bottom-color: #1a3a52; font-weight: 600; }
.abl-tab:hover { color: #1a3a52; }
.abl-alert-badge { background: #c62828; color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 8px; margin-left: 3px; }

/* Panels */
.abl-panel { display: none; }
.abl-panel.active { display: block; }

/* Private filter */
.abl-pf-panel { background: #fffbf0; border: 1px solid #f0a500; border-radius: 7px; padding: 9px 12px; margin-bottom: 10px; }
.abl-pf-label { font-size: 11px; font-weight: 600; color: #e65100; margin-bottom: 7px; }
.abl-pf-badge { background: #e67e22; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 5px; font-weight: 400; }
.abl-pf-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.abl-pf-row select, .abl-pf-row input { font-size: 11px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; color: #1a1a1a; font-family: inherit; }
.abl-link { font-size: 10px; color: #6b7280; cursor: pointer; text-decoration: underline; margin-left: auto; }

/* Toolbar */
.abl-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.abl-fbar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.abl-fbar-label { font-size: 10px; color: #9ca3af; }
.abl-fb { padding: 3px 10px; border-radius: 14px; font-size: 11px; cursor: pointer; border: 1px solid #d1d5db; background: #fff; color: #6b7280; font-family: inherit; }
.abl-fb.active { background: #1a3a52; color: #fff; border-color: #1a3a52; }
.abl-search-wrap input { font-size: 12px; padding: 4px 10px; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; color: #1a1a1a; width: 150px; font-family: inherit; }
.abl-actions { display: flex; gap: 6px; margin-left: auto; }

/* Buttons */
.abl-btn { padding: 5px 12px; font-size: 11px; border-radius: 5px; cursor: pointer; border: 1px solid #d1d5db; background: #fff; color: #4b5563; font-family: inherit; }
.abl-btn:hover { background: #f9fafb; }
.abl-btn-primary { background: #1a3a52; color: #fff; border-color: #1a3a52; }
.abl-btn-primary:hover { background: #15304a; }
.abl-btn-green { background: #2e7d32; color: #fff; border-color: #2e7d32; }

/* Table */
.abl-tbl-wrap { overflow-x: auto; }
.abl-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.abl-table th { padding: 6px 8px; text-align: left; font-size: 10px; font-weight: 600; color: #6b7280; letter-spacing: .04em; text-transform: uppercase; border-bottom: 1px solid #e5e7eb; background: #f9fafb; cursor: pointer; white-space: nowrap; }
.abl-table th:hover { color: #1a3a52; }
.abl-table td { padding: 0; vertical-align: top; border-bottom: 1px solid #f3f4f6; }
.abl-cell { padding: 6px 8px; }
.abl-merged { background: #f9fafb; }
.abl-inline-edit { cursor: pointer; border-radius: 3px; }
.abl-inline-edit:hover { background: #eff6ff; }
.abl-inline-edit.editing { background: #f0f4f8; padding: 2px; }
.abl-edit-input, .abl-edit-select { width: 100%; font-size: 11px; border: 1px solid #1a3a52; border-radius: 3px; padding: 3px 5px; background: #fff; color: #1a1a1a; outline: none; font-family: inherit; }
.abl-loading { text-align: center; padding: 2rem; color: #9ca3af; }
.col-collapse { width: 24px; }
.col-notes { width: 32px; }

/* Status chips */
.abl-chip { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.chip-lead { background: #e6f4ea; color: #2e7d32; }
.chip-preprod { background: #fff8e1; color: #e65100; }
.chip-inprod { background: #e3f0fb; color: #1a3a52; }
.chip-shipping { background: #e0f4f4; color: #006064; }
.chip-done { background: #f1f8e9; color: #558b2f; }
.chip-cancelled { background: #fce8e6; color: #c62828; text-decoration: line-through; }
.abl-sup-chip { display: inline-block; padding: 1px 5px; border-radius: 6px; font-size: 10px; background: #e8eaf6; color: #283593; margin: 1px; }
.abl-ship-chip { display: inline-block; padding: 1px 5px; border-radius: 6px; font-size: 10px; margin: 1px; }
.ship-air { background: #e3f0fb; color: #1a3a52; }
.ship-fcl { background: #e0f4f4; color: #006064; }
.ship-lcl { background: #e8f5e9; color: #2e7d32; }
.ship-local { background: #fff8e1; color: #e65100; }
.days-ok { font-size: 11px; color: #9ca3af; }
.days-soon { font-size: 11px; color: #e65100; font-weight: 600; }
.days-over { font-size: 11px; color: #c62828; font-weight: 600; }
.abl-col-btn { cursor: pointer; background: none; border: none; color: #9ca3af; font-size: 11px; padding: 0 2px; }

/* Order detail */
.abl-detail { margin-top: 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; }
.abl-detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.abl-detail-title { font-size: 14px; font-weight: 600; color: #1a3a52; }
.abl-detail-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.abl-detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.abl-section-label { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; }
.abl-file-item { display: flex; align-items: center; gap: 7px; padding: 5px 8px; background: #f9fafb; border-radius: 5px; margin-bottom: 4px; font-size: 11px; }
.abl-file-icon { font-size: 13px; }
.abl-file-del { cursor: pointer; color: #9ca3af; font-size: 11px; margin-left: auto; }
.abl-file-del:hover { color: #c62828; }
.abl-file-upload { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.abl-file-upload input[type="file"] { font-size: 11px; }
.abl-comment { background: #f9fafb; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; }
.abl-comment-meta { font-size: 10px; color: #9ca3af; margin-bottom: 3px; }
.abl-comment-text { font-size: 12px; color: #1a1a1a; }
.abl-comment-input { display: flex; gap: 6px; margin-top: 8px; }
.abl-comment-input input { flex: 1; font-size: 12px; padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; color: #1a1a1a; font-family: inherit; }

/* Analytics charts */
.abl-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.abl-chart-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.abl-chart-title { font-size: 11px; font-weight: 600; color: #6b7280; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .04em; }
.abl-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.abl-bar-label { font-size: 11px; color: #6b7280; width: 90px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abl-bar-track { flex: 1; background: #f3f4f6; border-radius: 4px; height: 14px; overflow: hidden; }
.abl-bar-fill { height: 100%; border-radius: 4px; }
.abl-bar-val { font-size: 10px; color: #9ca3af; width: 70px; text-align: right; flex-shrink: 0; }

/* Territory map */
.abl-map-header { font-size: 12px; color: #6b7280; margin-bottom: 10px; }
.abl-territory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 7px; margin-bottom: 12px; }
.abl-terr { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px 10px; cursor: pointer; }
.abl-terr:hover { border-color: #9ca3af; }
.abl-terr.terr-active { border-color: #1a3a52; background: #e3f0fb; }
.abl-terr.terr-hot { border-color: #e67e22; background: #fff8e1; }
.abl-terr-name { font-size: 12px; font-weight: 600; color: #1a3a52; margin-bottom: 2px; }
.abl-terr-val { font-size: 10px; color: #9ca3af; }
.abl-terr-detail { background: #fff; border: 1px solid #e5e7eb; border-radius: 7px; padding: 12px; }
.abl-terr-detail-title { font-size: 13px; font-weight: 600; color: #1a3a52; margin-bottom: 8px; }
.abl-terr-order-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f3f4f6; font-size: 11px; }

/* Alerts */
.abl-alert-card { display: flex; align-items: flex-start; gap: 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 7px; padding: 10px 12px; margin-bottom: 8px; }
.abl-alert-icon { font-size: 16px; flex-shrink: 0; }
.abl-alert-title { font-size: 12px; font-weight: 600; color: #1a1a1a; margin-bottom: 2px; }
.abl-alert-sub { font-size: 11px; color: #6b7280; }
.abl-alert-time { font-size: 10px; color: #9ca3af; margin-top: 3px; }
.abl-wa-badge { background: #e8f5e9; color: #2e7d32; font-size: 10px; padding: 1px 6px; border-radius: 7px; font-weight: 500; }
.abl-em-badge { background: #e3f0fb; color: #1a3a52; font-size: 10px; padding: 1px 6px; border-radius: 7px; font-weight: 500; }

/* Audit trail */
.abl-audit-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.abl-audit-toolbar select { font-size: 11px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 5px; font-family: inherit; }
.abl-audit-table { background: #fff; border: 1px solid #e5e7eb; border-radius: 7px; overflow: hidden; }
.abl-audit-row { display: grid; grid-template-columns: 70px 80px 70px 110px 1fr 1fr; gap: 6px; padding: 7px 12px; border-bottom: 1px solid #f3f4f6; font-size: 11px; align-items: center; }
.abl-audit-row:last-child { border-bottom: none; }
.abl-audit-time { color: #9ca3af; }
.abl-audit-user { font-weight: 600; color: #1a3a52; }
.abl-audit-quote { color: #6b7280; }
.abl-audit-field { color: #9ca3af; font-style: italic; }
.abl-audit-arrow { color: #9ca3af; font-size: 10px; }

/* Email digest */
.abl-digest { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; font-size: 12px; }
.abl-digest-header { background: #1a3a52; color: #fff; padding: 12px 16px; }
.abl-digest-title { font-size: 15px; font-weight: 600; }
.abl-digest-date { font-size: 11px; opacity: .7; margin-top: 2px; }
.abl-digest-body { padding: 14px 16px; }
.abl-digest-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.abl-digest-stat { background: #fff; border-radius: 5px; padding: 8px; text-align: center; border: 1px solid #e5e7eb; }
.abl-digest-val { font-size: 20px; font-weight: 700; color: #1a3a52; }
.abl-digest-label { font-size: 10px; color: #9ca3af; }
.abl-digest-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #e5e7eb; }
.abl-digest-footer { padding: 10px 16px; font-size: 10px; color: #9ca3af; border-top: 1px solid #e5e7eb; text-align: center; }
.abl-digest-footer a { color: #1a3a52; }

/* Modal */
.abl-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999; align-items: center; justify-content: center; }
.abl-modal-overlay.open { display: flex; }
.abl-modal { background: #fff; border-radius: 10px; padding: 1.25rem; width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.abl-modal-title { font-size: 15px; font-weight: 600; color: #1a3a52; margin-bottom: 1rem; }
.abl-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.abl-field { display: flex; flex-direction: column; gap: 3px; }
.abl-field label { font-size: 10px; color: #6b7280; font-weight: 500; }
.abl-field input, .abl-field select, .abl-field textarea { font-size: 12px; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; color: #1a1a1a; font-family: inherit; }
.abl-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }

/* Footer */
.abl-footer { text-align: center; font-size: 10px; color: #9ca3af; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #f3f4f6; }
.abl-footer a { color: #1a3a52; text-decoration: none; }
.abl-footer a:hover { text-decoration: underline; }

/* Print */
@media print {
    .abl-header, .abl-tabs, .abl-pf-panel, .abl-toolbar, .abl-detail, .abl-footer { display: none !important; }
    .abl-panel { display: block !important; }
    .abl-table th, .abl-table td { border: 1px solid #ccc; }
}

/* Responsive */
@media (max-width: 768px) {
    .abl-stats { grid-template-columns: repeat(3, 1fr); }
    .abl-chart-grid { grid-template-columns: 1fr; }
    .abl-detail-cols { grid-template-columns: 1fr; }
    .abl-form-grid { grid-template-columns: 1fr; }
    .abl-digest-stats { grid-template-columns: repeat(2, 1fr); }
    .abl-audit-row { grid-template-columns: 60px 60px 1fr; }
}
