*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: 'Prompt', sans-serif; background: #F5F4F2; color: #1C1917; }

/* Sidebar */
.sidebar {
  width: 240px; min-width: 240px;
  background: #1C1917;
  display: flex; flex-direction: column;
  height: 100vh; position: fixed; left: 0; top: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.55);
  cursor: pointer; border: none; background: transparent;
  font-family: 'Prompt', sans-serif; font-size: 14px; font-weight: 500;
  width: 100%; text-align: left; border-radius: 0;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(236,98,60,0.15); color: #EC623C; }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: #EC623C; border-radius: 0 2px 2px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Main content */
.main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; width: calc(100vw - 240px); }
.topbar {
  background: #fff;
  border-bottom: 1px solid #E7E5E4;
  padding: 0 32px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.content { padding: 28px 32px; flex: 1; overflow-x: hidden; }

/* Cards */
.card { background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(236,98,60,0.06), 0 4px 16px rgba(0,0,0,0.06); }
.stat-card { background: #fff; border-radius: 16px; padding: 24px; box-shadow: 0 1px 3px rgba(236,98,60,0.06), 0 4px 16px rgba(0,0,0,0.06); }

/* Tabs (inline) */
.page-tab { display: none; }
.page-tab.active { display: block; }

/* Buttons */
.btn-primary {
  background: #EC623C; color: #fff; border: none;
  border-radius: 10px; padding: 9px 20px;
  font-family: 'Prompt', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(236,98,60,0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(236,98,60,0.35); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent; color: #57534E; border: 1.5px solid #E7E5E4;
  border-radius: 8px; padding: 6px 14px;
  font-family: 'Prompt', sans-serif; font-size: 13px;
  cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { background: #FEF0EB; border-color: #FDDDD5; color: #EC623C; }

/* Table */
table { width: 100%; border-collapse: collapse; }
thead th { padding: 12px 16px; font-size: 12px; font-weight: 700; color: #A8A29E; text-align: left; border-bottom: 2px solid #F0EDEC; letter-spacing: 0.05em; text-transform: uppercase; }
tbody td { padding: 14px 16px; font-size: 14px; color: #1C1917; border-bottom: 1px solid #F5F4F2; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFAF9; }

/* Badge */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-lc { background: #FEF0EB; color: #C4400F; }
.badge-mc { background: #E0F2FE; color: #0369A1; }
.badge-ic { background: #F0FDF4; color: #15803D; }
.badge-active { background: #F0FDF4; color: #15803D; }
.badge-silent { background: #F5F4F3; color: #A8A29E; }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,#F97B55,#EC623C); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }

/* Progress bar */
.progress-bar { height: 6px; background: #F0EDEC; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #F97B55, #EC623C); border-radius: 3px; transition: width 0.4s ease; }

/* Activity tree node */
.tree-node { position: relative; }
.tree-line { border-left: 2px dashed #FDDDD5; margin-left: 18px; padding-left: 20px; }
.tree-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 8px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tree-card:hover { border-color: #FDDDD5; background: #FEFDFB; }
.tree-card-lc { background: #FEF9F7; border-color: #FDDDD5; }
.tree-card-mc-active { background: #FEF0EB; }
.tree-card-mc-silent { background: #F5F4F3; }
.tree-card-ic-active { background: #F0FDF4; }
.tree-card-ic-silent { background: #F5F4F3; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-active { background: #22C55E; }
.dot-silent { background: #D4D0CC; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box { background: #fff; border-radius: 20px; padding: 32px; width: 520px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15); transform: scale(0.95); transition: transform 0.2s ease; }
.modal-overlay.open .modal-box { transform: scale(1); }

/* Input */
.form-input { width: 100%; border: 1.5px solid #E7E5E4; border-radius: 10px; padding: 10px 14px; font-family: 'Prompt', sans-serif; font-size: 14px; color: #1C1917; background: #fff; outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.form-input:focus { border-color: #EC623C; box-shadow: 0 0 0 3px rgba(236,98,60,0.12); }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #57534E; margin-bottom: 6px; }
.form-group { margin-bottom: 16px; }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A8A29E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Toast */
#toast { position: fixed; bottom: 32px; right: 32px; background: #1C1917; color: #fff; padding: 14px 24px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease; transform: translateY(8px); z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,0.2); pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }

/* Chart SVG line */
.chart-area { position: relative; height: 180px; }

/* Noise texture */
.noise-bg::after { content: ''; position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"); opacity: 0.05; pointer-events: none; border-radius: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E7E5E4; border-radius: 3px; }

/* Company block bar */
.company-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.company-block {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px; border-radius: 12px;
  background: #fff; border: 2px solid #F0EDEC;
  cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 130px; flex: 1; max-width: 200px;
}
.company-block:hover { border-color: #FDDDD5; box-shadow: 0 4px 12px rgba(236,98,60,0.10); transform: translateY(-1px); }
.company-block.active { border-color: #EC623C; background: #FEF0EB; box-shadow: 0 4px 14px rgba(236,98,60,0.15); }
.company-block .co-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; color: #fff; font-weight: 700; }
.company-block .co-name { font-size: 13px; font-weight: 700; color: #1C1917; margin: 0 0 1px; }
.company-block .co-sub { font-size: 11px; color: #A8A29E; margin: 0; }
.company-block.active .co-name { color: #C4400F; }
.company-block.active .co-sub { color: #EC623C; }
