/* Arcomm Intelligence — Professional Dark Dashboard */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #6e7681;
  --accent: #388bfd;
  --accent2: #58a6ff;
  --hot: #f85149;
  --warm: #d29922;
  --monitor: #3fb950;
  --success: #2ea043;
  --warn: #d29922;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; }

.app { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
header h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.5px; }
header .brand { color: var(--accent); }
.header-right { display: flex; gap: 10px; align-items: center; }

nav { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; }
nav a { color: var(--text2); text-decoration: none; padding: 7px 14px; border-radius: 6px; font-size: 0.82rem; font-weight: 500; transition: all 0.15s; }
nav a.active { background: var(--accent); color: #fff; }
nav a:hover:not(.active) { background: var(--surface2); color: var(--text); }

#search-box { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 7px 12px; border-radius: 6px; font-size: 0.82rem; min-width: 200px; outline: none; }
#search-box:focus { border-color: var(--accent); }
.freshness { font-size: 0.72rem; color: var(--text3); white-space: nowrap; }

.service-pills { display: flex; gap: 5px; margin-bottom: 14px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 20px; font-size: 0.77rem; font-weight: 500; background: var(--surface); border: 1px solid var(--border); cursor: pointer; white-space: nowrap; transition: all 0.15s; }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill:hover:not(.on) { border-color: var(--text3); }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 7px 12px; border-radius: 6px; font-size: 0.82rem; }
.filters select:focus, .filters input:focus { border-color: var(--accent); outline: none; }
.result-count { font-size: 0.75rem; color: var(--text3); margin-left: auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-card { text-align: center; }
.stat-card .num { font-size: 1.8rem; font-weight: 700; letter-spacing: -1px; }
.stat-card .num.accent { color: var(--accent); }
.stat-card .num.hot { color: var(--hot); }
.stat-card .label { font-size: 0.75rem; color: var(--text2); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
th { color: var(--text2); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface2); }
td.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.truncate-wide { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.badge-hot { background: var(--hot); color: #fff; }
.badge-warm { background: var(--warm); color: #111; }
.badge-review { background: var(--text2); color: #fff; }
.badge-security { background: #1b5e20; color: #7ee083; }
.badge-voip { background: #0d419d; color: #79c0ff; }
.badge-it { background: #4a148c; color: #d49af7; }
.badge-cabling { background: #b95a00; color: #ffc680; }
.badge-intercom { background: #005a4f; color: #80cbc4; }
.badge-general { background: #37474f; color: #b0bec5; }
.badge-av { background: #3d1f5e; color: #c99bf0; }
.badge-other { background: #37474f; color: #90a4ae; }
.badge-open { background: var(--success); color: #fff; }
.badge-expired { background: var(--text3); color: #111; }
.badge-closed { background: var(--hot); color: #fff; }
.badge-rejected { background: #5d1a1a; color: #f48771; }
.badge-duplicate { background: #4a3d00; color: #ffd54f; }
.badge-unknown { background: var(--text3); color: var(--text); }
.badge-new { background: var(--accent); color: #fff; }
.badge-won { background: var(--success); color: #fff; }

/* Detail */
.detail-header { margin-bottom: 18px; }
.detail-header h2 { font-size: 1.25rem; font-weight: 600; }
.detail-header .meta { color: var(--text2); font-size: 0.8rem; margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.detail-header .meta a { color: var(--accent2); text-decoration: none; }
.detail-header .meta a:hover { text-decoration: underline; }

.detail-tabs { display: flex; gap: 2px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; width: fit-content; }
.detail-tabs button { background: transparent; border: none; color: var(--text2); padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 500; transition: all 0.15s; }
.detail-tabs button.active { background: var(--accent); color: #fff; }
.detail-tabs button:hover:not(.active) { background: var(--surface2); }

/* Timeline */
.timeline-item { border-left: 3px solid var(--border); padding: 12px 16px; margin-left: 8px; margin-bottom: 10px; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.timeline-item.opp { border-left-color: var(--accent); }
.timeline-item.bid { border-left-color: var(--warn); }
.tl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tl-date { font-size: 0.72rem; color: var(--text2); }
.tl-type { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.tl-text { font-size: 0.82rem; color: var(--text); line-height: 1.6; margin-top: 6px; }
.tl-link { font-size: 0.76rem; color: var(--accent2); text-decoration: none; margin-top: 6px; display: inline-block; }
.tl-link:hover { text-decoration: underline; }
.tl-actions { margin-top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.tl-actions button { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 4px 10px; border-radius: 4px; font-size: 0.72rem; cursor: pointer; transition: all 0.15s; }
.tl-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 9999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 900px; width: 92%; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
.modal-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 1.2rem; cursor: pointer; padding: 4px 10px; border-radius: 4px; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; font-size: 0.82rem; line-height: 1.7; color: var(--text); }
.modal-meta { font-size: 0.76rem; color: var(--text2); margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-meta a { color: var(--accent2); }
.doc-text { white-space: pre-wrap; word-break: break-word; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.82rem; line-height: 1.6; background: var(--bg); padding: 14px; border-radius: 6px; border: 1px solid var(--border); max-height: 60vh; overflow-y: auto; }

/* Opportunity detail grid */
.opp-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .opp-detail-grid { grid-template-columns: 1fr; } }
.field-label { font-size: 0.68rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.field-value { font-size: 0.82rem; margin-bottom: 10px; }
.evidence-block { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; line-height: 1.6; max-height: 350px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }

/* Buttons */
.action-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 14px; border-radius: 4px; font-size: 0.76rem; cursor: pointer; transition: all 0.15s; font-weight: 500; line-height: 1.3; text-decoration: none; display: inline-block; }
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.hot-action { border-color: var(--hot); color: var(--hot); }
.action-btn.hot-action:hover { background: var(--hot); color: #fff; }
.action-btn.warm-action { border-color: var(--warn); color: var(--warn); }
.action-btn.warm-action:hover { background: var(--warn); color: #111; }
.action-btn.review-action { border-color: var(--monitor); color: var(--monitor); }
.action-btn.review-action:hover { background: var(--monitor); color: #111; }
.action-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.action-btn.primary:hover { opacity: 0.85; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; font-size: 0.8rem; }
.alert-warn { background: rgba(210,153,34,0.1); border: 1px solid var(--warn); color: var(--warn); }
.alert-info { background: rgba(56,139,253,0.1); border: 1px solid var(--accent); color: var(--accent2); }
.alert-success { background: rgba(46,160,67,0.1); border: 1px solid var(--success); color: var(--success); }

/* Activity */
.activity-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.act-type { font-weight: 600; }
.act-date { font-size: 0.7rem; color: var(--text2); float: right; }
.act-text { font-size: 0.76rem; color: var(--text2); margin-top: 3px; }
.hot-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.excerpt { margin-top: 3px; font-size: 0.76rem; color: var(--text2); line-height: 1.4; }
.doc-row { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* Contact cards */
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.c-name { font-weight: 600; font-size: 0.85rem; }
.c-title { font-size: 0.76rem; color: var(--text2); }
.c-dept { font-size: 0.7rem; color: var(--text3); margin-top: 2px; }
.c-contact { font-size: 0.73rem; color: var(--accent2); margin-top: 5px; }
.c-contact a { color: var(--accent2); text-decoration: none; }
.c-contact a:hover { text-decoration: underline; }

/* Tech profile */
.tech-row { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.t-category { font-size: 0.8rem; }
.t-vendor { font-size: 0.76rem; color: var(--text2); }

/* Bar chart */
.bar-row { margin-bottom: 7px; }
.bar-bg { background: var(--surface2); border-radius: 3px; height: 6px; margin-top: 3px; }
.bar-fill { background: var(--accent); height: 6px; border-radius: 3px; min-width: 2px; }

/* Util */
.loading { text-align: center; padding: 30px; color: var(--text2); }
.hidden { display: none; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.flex-row { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
h3 { font-size: 0.9rem; margin-bottom: 10px; font-weight: 600; }
