/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  color: #172B4D;
  background: #FAFBFC;
  line-height: 1.4286;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}
a { color: #0052CC; text-decoration: none; }
a:hover { text-decoration: underline; color: #0065FF; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C1C7D0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #A5ADBA; }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-shell { display: flex; height: 100vh; width: 100vw; }

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */
.sidebar {
  width: 64px; min-width: 64px;
  background: #FFFFFF; border-right: 1px solid #DFE1E6;
  display: flex; flex-direction: column;
  transition: width 0.25s cubic-bezier(0.2,0,0,1), min-width 0.25s cubic-bezier(0.2,0,0,1);
  z-index: 100; position: relative; overflow: hidden;
}
.sidebar.expanded { width: 260px; min-width: 260px; }
.sidebar-header {
  height: 56px; display: flex; align-items: center;
  padding: 0 14px; gap: 12px; flex-shrink: 0;
  border-bottom: 1px solid #EBECF0;
}
.sidebar:not(.expanded) .sidebar-header { justify-content: center; padding: 0; gap: 0; }
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #0052CC 0%, #2684FF 100%);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 17px; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,82,204,0.3);
}
.sidebar-brand {
  font-weight: 600; font-size: 16px; color: #172B4D;
  white-space: nowrap; opacity: 0; width: 0; overflow: hidden; transition: opacity 0.2s, width 0.25s;
  letter-spacing: -0.01em;
}
.sidebar.expanded .sidebar-brand { opacity: 1; width: auto; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; overflow-x: hidden; }
.sidebar:not(.expanded) .sidebar-nav { padding: 12px 0; display: flex; flex-direction: column; align-items: center; }
.nav-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #97A0AF; padding: 20px 12px 6px;
  white-space: nowrap; opacity: 0; height: 0; overflow: hidden;
  transition: opacity 0.2s, height 0.2s, padding 0.2s;
}
.sidebar.expanded .nav-section-label { opacity: 1; height: auto; overflow: visible; }
.nav-section-divider { height: 1px; background: #EBECF0; margin: 8px 12px; }
.sidebar.expanded .nav-section-divider { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; color: #42526E; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-radius: 6px; margin: 2px 0;
  white-space: nowrap; position: relative;
}
.nav-item:hover { background: #F4F5F7; color: #172B4D; }
.nav-item.active { background: #DEEBFF; color: #0052CC; font-weight: 500; }
.nav-item.active .nav-icon svg { stroke-width: 2.5; }
.nav-item .nav-icon {
  width: 22px; height: 22px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.sidebar:not(.expanded) .nav-item {
  justify-content: center;
  padding: 8px 0;
  width: 40px;
  margin: 2px auto;
  gap: 0;
}
.sidebar:not(.expanded) .nav-item .nav-label { display: none; }
.nav-item .nav-icon svg { width: 20px; height: 20px; }
.nav-item .nav-label {
  opacity: 0; transition: opacity 0.2s; font-size: 14px; font-weight: 500;
  overflow: hidden; width: 0;
}
.sidebar.expanded .nav-item .nav-label { opacity: 1; width: auto; }
.nav-item .nav-tooltip {
  display: none; position: absolute; left: 62px; top: 50%; transform: translateY(-50%);
  background: #172B4D; color: #FFF; font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 4px; white-space: nowrap; z-index: 200;
  pointer-events: none; box-shadow: 0 2px 8px rgba(9,30,66,0.2);
}
.nav-item .nav-tooltip::before {
  content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
  border: 4px solid transparent; border-right-color: #172B4D;
}
.sidebar:not(.expanded) .nav-item:hover .nav-tooltip { display: block; }
.sidebar-footer { padding: 8px; border-top: 1px solid #EBECF0; flex-shrink: 0; }
.sidebar-toggle {
  width: 100%; display: flex; align-items: center; justify-content: center;
  padding: 10px; border-radius: 6px; color: #6B778C; transition: all 0.15s;
}
.sidebar-toggle:hover { background: #F4F5F7; color: #172B4D; }
.sidebar-toggle svg { transition: transform 0.25s; }
.sidebar.expanded .sidebar-toggle svg { transform: rotate(180deg); }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* TOP BAR */
.top-bar {
  height: 56px; background: #FFFFFF; border-bottom: 1px solid #DFE1E6;
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
  flex-shrink: 0; z-index: 50;
}
.breadcrumbs { display: flex; align-items: center; gap: 4px; font-size: 14px; flex: 1; }
.breadcrumb-item { color: #6B778C; cursor: pointer; }
.breadcrumb-item:hover { color: #172B4D; text-decoration: underline; }
.breadcrumb-sep { color: #C1C7D0; font-size: 12px; }
.breadcrumb-current { color: #172B4D; font-weight: 500; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #F4F5F7; border: 2px solid transparent;
  border-radius: 6px; padding: 6px 12px; width: 240px; transition: all 0.2s;
}
.search-box:focus-within { background: #FFF; border-color: #4C9AFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2); }
.search-box svg { color: #6B778C; flex-shrink: 0; }
.search-box input { border: none; background: none; outline: none; width: 100%; color: #172B4D; font-size: 14px; }
.search-box input::placeholder { color: #A5ADBA; }
.top-bar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: #6B778C;
  transition: background 0.15s; position: relative;
}
.icon-btn:hover { background: #EBECF0; color: #172B4D; }
.icon-btn .badge-dot {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
  background: #DE350B; border-radius: 50%; border: 2px solid #FFF;
}
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #0052CC, #2684FF);
  color: #FFF; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}

/* CONTENT AREA */
.content-area { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0; }

/* ============================================================
   PAGE VIEWS
   ============================================================ */
.page { display: none; height: 100%; }
.page.active { display: flex; flex-direction: column; }

/* ============================================================
   COMMON COMPONENTS
   ============================================================ */

/* Lozenge */
.lozenge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 3px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.lozenge-success { background: #E3FCEF; color: #006644; }
.lozenge-moved   { background: #FFFAE6; color: #FF8B00; }
.lozenge-removed { background: #FFEBE6; color: #BF2600; }
.lozenge-new     { background: #DEEBFF; color: #0747A6; }
.lozenge-default { background: #DFE1E6; color: #42526E; }
.lozenge-purple  { background: #EAE6FF; color: #403294; }
.lozenge-teal    { background: #E6FCFF; color: #008DA6; }
.lozenge-red     { background: #FFEBE6; color: #BF2600; }
.lozenge-orange  { background: #FFF0E5; color: #974F0C; }
.lozenge-green   { background: #E3FCEF; color: #006644; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 4px; font-weight: 500;
  font-size: 14px; transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: #0052CC; color: #FFF; }
.btn-primary:hover { background: #0065FF; }
.btn-default { background: #FAFBFC; border: 1px solid #DFE1E6; color: #42526E; }
.btn-default:hover { background: #F4F5F7; border-color: #C1C7D0; }
.btn-subtle { color: #6B778C; }
.btn-subtle:hover { background: #EBECF0; color: #172B4D; }
.btn-danger { background: #DE350B; color: #FFF; }
.btn-danger:hover { background: #FF5630; }
.btn-success { background: #36B37E; color: #FFF; }
.btn-success:hover { background: #2da06e; }
.btn:disabled { cursor: not-allowed; opacity: 0.55; box-shadow: none; }
.btn-sm { padding: 4px 8px; font-size: 13px; }
.btn-xs { padding: 3px 7px; font-size: 12px; }

/* Avatar */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: #FFF; flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-blue   { background: linear-gradient(135deg, #0052CC, #2684FF); }
.avatar-purple { background: linear-gradient(135deg, #6554C0, #998DD9); }
.avatar-green  { background: linear-gradient(135deg, #00875A, #36B37E); }
.avatar-orange { background: linear-gradient(135deg, #974F0C, #FF8B00); }
.avatar-teal   { background: linear-gradient(135deg, #008DA6, #00B8D9); }

/* Tables */
.data-table { width: 100%; }
.data-table thead th {
  padding: 8px 12px; text-align: left; font-size: 12px;
  font-weight: 600; color: #6B778C; text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 2px solid #DFE1E6;
  cursor: pointer; white-space: nowrap; user-select: none;
}
.data-table thead th:hover { color: #172B4D; }
.data-table thead th .sort-icon { margin-left: 4px; opacity: 0.4; font-size: 10px; }
.data-table thead th.sort-asc .sort-icon::after { content: ' ↑'; opacity: 1; }
.data-table thead th.sort-desc .sort-icon::after { content: ' ↓'; opacity: 1; }
.data-table tbody tr { border-bottom: 1px solid #EBECF0; transition: background 0.1s; cursor: pointer; }
.data-table tbody tr:hover { background: #F4F5F7; }
.data-table tbody td { padding: 10px 12px; font-size: 14px; vertical-align: middle; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid #EBECF0; background: #FFF;
  flex-shrink: 0;
}
.pagination-info { font-size: 13px; color: #6B778C; }
.pagination-controls { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; border-radius: 4px; font-size: 14px;
  color: #42526E; font-weight: 500; transition: all 0.15s; padding: 0 6px;
}
.page-btn:hover { background: #EBECF0; }
.page-btn.active { background: #0052CC; color: #FFF; }

/* Toolbar */
.page-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; background: #FFF;
  border-bottom: 1px solid #EBECF0; flex-wrap: wrap; flex-shrink: 0;
}
.toolbar-search {
  display: flex; align-items: center; gap: 8px;
  background: #F4F5F7; border: 2px solid transparent;
  border-radius: 4px; padding: 0 10px; min-width: 220px;
  height: 36px; box-sizing: border-box; transition: all 0.2s;
}
.toolbar-search:focus-within { background: #FFF; border-color: #4C9AFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2); }
.toolbar-search svg { color: #A5ADBA; flex-shrink: 0; width: 16px; height: 16px; }
.toolbar-search input { border: none; background: none; outline: none; font-size: 14px; color: #172B4D; width: 100%; }
.toolbar-search input::placeholder { color: #A5ADBA; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.select-filter {
  padding: 0 30px 0 10px; border: 2px solid transparent;
  border-radius: 4px; background-color: #F4F5F7; color: #42526E;
  font-size: 14px; font-family: inherit; appearance: none; cursor: pointer;
  transition: all 0.2s; height: 36px; box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B778C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select-filter:focus { outline: none; background-color: #FFF; border-color: #4C9AFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2); }

/* Tabs */
.tab-bar {
  display: flex; gap: 0; border-bottom: 2px solid #EBECF0;
  padding: 0 24px; background: #FFF; flex-shrink: 0;
}
.tab-item {
  padding: 12px 16px; font-size: 14px; font-weight: 500;
  color: #6B778C; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s; white-space: nowrap;
}
.tab-item:hover { color: #172B4D; }
.tab-item.active { color: #0052CC; border-bottom-color: #0052CC; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel.active.tab-fill { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* Stat Cards */
.stat-card {
  background: #FFF; border: 1px solid #DFE1E6; border-radius: 8px;
  padding: 20px; transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 2px 8px rgba(9,30,66,0.08); }
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: #6B778C; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #172B4D; margin-bottom: 4px; }
.stat-card .stat-trend { font-size: 13px; display: flex; align-items: center; gap: 4px; }
.stat-card .stat-trend.up { color: #36B37E; }
.stat-card .stat-trend.down { color: #DE350B; }

/* Section card */
.section-card {
  background: #FFF; border: 1px solid #DFE1E6; border-radius: 8px; overflow: hidden;
}
.section-header {
  padding: 14px 20px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid #EBECF0;
}
.section-header h3 { font-size: 14px; font-weight: 600; color: #172B4D; }

/* Detail fields */
.detail-field { display: flex; align-items: flex-start; padding: 10px 20px; border-bottom: 1px solid #EBECF0; }
.detail-field:last-child { border-bottom: none; }
.detail-field .field-label { width: 140px; font-size: 12px; font-weight: 600; color: #6B778C; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; flex-shrink: 0; }
.detail-field .field-value { flex: 1; font-size: 14px; color: #172B4D; }

/* Table container */
.table-container { flex: 1; overflow: auto; background: #FFF; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: #FFF; border-radius: 4px; min-width: 180px;
  box-shadow: 0 4px 16px rgba(9,30,66,0.16), 0 0 1px rgba(9,30,66,0.12);
  z-index: 300; display: none; overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item { display: block; width: 100%; text-align: left; padding: 8px 16px; font-size: 14px; color: #172B4D; transition: background 0.1s; }
.dropdown-item:hover { background: #F4F5F7; }
.dropdown-item.danger { color: #DE350B; }
.dropdown-item.danger:hover { background: #FFEBE6; }
.dropdown-item:disabled { cursor: not-allowed; opacity: 0.55; background: transparent; }
.dropdown-divider { height: 1px; background: #EBECF0; margin: 4px 0; }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(9,30,66,0.54); z-index: 600;
  display: none; align-items: flex-start; justify-content: center; padding-top: 60px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #FFF; border-radius: 8px; width: 560px; max-width: 95vw;
  max-height: calc(100vh - 120px); display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(9,30,66,0.2);
  animation: modalIn 0.2s cubic-bezier(0.2,0,0,1);
}
.modal-lg { width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #EBECF0; flex-shrink: 0; }
.modal-header h3 { font-size: 20px; font-weight: 600; color: #172B4D; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid #EBECF0; flex-shrink: 0; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #6B778C; transition: all 0.15s; }
.modal-close:hover { background: #EBECF0; color: #172B4D; }

/* Form fields */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: #6B778C; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-field .required-star { color: #DE350B; }
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="email"],
.form-field input[type="date"],
.form-field select,
.form-field textarea {
  width: 100%; padding: 8px 12px; border: 2px solid #DFE1E6;
  border-radius: 4px; font-size: 14px; color: #172B4D; transition: all 0.2s; background: #FAFBFC;
  box-sizing: border-box; height: 40px;
}
.form-field textarea { height: auto; min-height: 80px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: #4C9AFF; background: #FFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2);
}
.form-field textarea { resize: vertical; min-height: 80px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-prefix-wrap { position: relative; }
.input-prefix-wrap .prefix { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #6B778C; font-size: 14px; pointer-events: none; }
.input-prefix-wrap input { padding-left: 24px !important; }

/* Radio group */
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-option {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 2px solid #DFE1E6; border-radius: 4px; cursor: pointer;
  font-size: 14px; color: #42526E; transition: all 0.15s; background: #FAFBFC;
}
.radio-option:hover { border-color: #4C9AFF; background: #F0F4FF; }
.radio-option.selected { border-color: #0052CC; background: #DEEBFF; color: #0052CC; font-weight: 500; }
.radio-option input { display: none; }

/* Flag / Toast */
.flag-container { position: fixed; top: 24px; right: 24px; z-index: 700; display: flex; flex-direction: column; gap: 8px; }
.flag {
  display: flex; gap: 12px; padding: 16px; border-radius: 6px;
  min-width: 320px; max-width: 420px;
  box-shadow: 0 4px 16px rgba(9,30,66,0.16);
  animation: flagIn 0.3s cubic-bezier(0.2,0,0,1);
  background: #FFF; border-left: 4px solid;
}
@keyframes flagIn { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
.flag-success { border-left-color: #36B37E; }
.flag-error   { border-left-color: #DE350B; }
.flag-warning { border-left-color: #FFAB00; }
.flag-info    { border-left-color: #0052CC; }
.flag-icon { flex-shrink: 0; width: 20px; height: 20px; }
.flag-content { flex: 1; }
.flag-content .flag-title { font-size: 14px; font-weight: 600; color: #172B4D; margin-bottom: 2px; }
.flag-content .flag-desc  { font-size: 13px; color: #6B778C; }
.flag-dismiss { flex-shrink: 0; color: #6B778C; cursor: pointer; font-size: 18px; line-height: 1; }
.flag-dismiss:hover { color: #172B4D; }

/* Notification tray */
.dropdown-menu#notifTray.open { display: flex !important; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid #F4F5F7;
}
.notif-item:hover { background: #F4F5F7; }
.notif-item.unread { background: #FAFBFF; }
.notif-item.unread:hover { background: #EEF2FF; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #0052CC;
  flex-shrink: 0; margin-top: 5px;
}
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13px; color: #172B4D; line-height: 1.4; }
.notif-text a { color: #0052CC; }
.notif-time { font-size: 12px; color: #97A0AF; margin-top: 3px; }

/* Page header (list pages) */
.page-header {
  padding: 24px 24px 16px; background: #FFF;
  border-bottom: 1px solid #EBECF0; display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: #172B4D; }
.page-header .record-count { font-size: 14px; color: #6B778C; margin-left: 10px; font-weight: 400; }

/* Detail page header */
.detail-header {
  padding: 20px 24px; background: #FFF; border-bottom: 1px solid #EBECF0;
  display: flex; align-items: flex-start; gap: 16px; flex-shrink: 0;
}
.detail-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #FFF; flex-shrink: 0;
}
.detail-meta { flex: 1; min-width: 0; }
.detail-meta h1 { font-size: 20px; font-weight: 700; color: #172B4D; margin-bottom: 6px; }
.detail-meta .meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 8px; align-items: flex-start; flex-shrink: 0; }

/* Activity timeline */
.timeline { padding: 20px; display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 15px; top: 32px;
  width: 2px; bottom: 0; background: #EBECF0;
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #FFF; z-index: 1;
}
.timeline-content { flex: 1; }
.timeline-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.timeline-title { font-size: 14px; font-weight: 500; color: #172B4D; }
.timeline-time { font-size: 12px; color: #97A0AF; margin-left: auto; }
.timeline-body { font-size: 13px; color: #6B778C; line-height: 1.5; }

/* Note card */
.note-card { background: #FFF; border: 1px solid #DFE1E6; border-radius: 6px; padding: 16px; margin-bottom: 12px; }
.note-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.note-card-author { font-size: 13px; font-weight: 600; color: #172B4D; }
.note-card-time { font-size: 12px; color: #97A0AF; margin-left: auto; }
.note-card-body { font-size: 14px; color: #172B4D; line-height: 1.6; }
.note-card-footer { margin-top: 10px; font-size: 12px; color: #97A0AF; }

/* Inline note form */
.note-form { background: #FFF; border: 1px solid #DFE1E6; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.note-form textarea {
  width: 100%; border: 2px solid #DFE1E6; border-radius: 4px; padding: 10px 12px;
  font-size: 14px; color: #172B4D; background: #FAFBFC; resize: vertical; min-height: 80px;
  transition: all 0.2s; font-family: inherit;
}
.note-form textarea:focus { outline: none; border-color: #4C9AFF; background: #FFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2); }
.note-form-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.note-form-footer .select-filter { height: 32px; font-size: 13px; }

/* File list */
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid #EBECF0;
  transition: background 0.1s;
}
.file-row:hover { background: #F4F5F7; }
.file-icon { width: 36px; height: 36px; border-radius: 6px; background: #DEEBFF; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #0052CC; font-size: 13px; font-weight: 700; }
.file-name { font-size: 14px; font-weight: 500; color: #172B4D; }
.file-meta { font-size: 12px; color: #97A0AF; }
.upload-zone {
  margin: 20px; border: 2px dashed #C1C7D0; border-radius: 6px;
  padding: 24px; text-align: center; color: #97A0AF; cursor: pointer;
  transition: all 0.15s;
}
.upload-zone:hover { border-color: #4C9AFF; color: #0052CC; background: #F0F4FF; }

/* Task list */
.task-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid #EBECF0; }
.task-item:hover { background: #F4F5F7; }
.task-item input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: #0052CC; flex-shrink: 0; }
.task-item .task-text { font-size: 14px; color: #172B4D; flex: 1; }
.task-item.done .task-text { text-decoration: line-through; color: #97A0AF; }
.task-item .task-due { font-size: 12px; color: #97A0AF; margin-left: auto; }
.task-add-row { display: flex; align-items: center; gap: 10px; padding: 12px 20px; }
.task-add-row input { flex: 1; border: 2px solid #DFE1E6; border-radius: 4px; padding: 7px 12px; font-size: 14px; color: #172B4D; background: #FAFBFC; transition: all 0.2s; }
.task-add-row input:focus { outline: none; border-color: #4C9AFF; background: #FFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2); }

/* Checkbox in table */
.row-check { width: 16px; height: 16px; cursor: pointer; accent-color: #0052CC; }

/* View toggle */
.view-toggle { display: flex; border: 1px solid #DFE1E6; border-radius: 4px; overflow: hidden; }
.view-btn { padding: 6px 12px; font-size: 13px; font-weight: 500; color: #42526E; background: #FAFBFC; border: none; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 5px; }
.view-btn:hover { background: #F4F5F7; }
.view-btn.active { background: #DEEBFF; color: #0052CC; }
.view-btn + .view-btn { border-left: 1px solid #DFE1E6; }

/* Kanban board */
.kanban-board { display: flex; gap: 12px; padding: 20px 24px; overflow-x: auto; flex: 1; align-items: flex-start; }
.kanban-col { width: 220px; min-width: 220px; background: #F4F5F7; border-radius: 8px; overflow: hidden; }
.kanban-col-header { padding: 10px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; justify-content: space-between; }
.kanban-col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.kanban-card { background: #FFF; border: 1px solid #DFE1E6; border-radius: 6px; padding: 12px; cursor: pointer; transition: box-shadow 0.15s; }
.kanban-card:hover { box-shadow: 0 2px 8px rgba(9,30,66,0.12); }
.kanban-card-title { font-size: 13px; font-weight: 600; color: #172B4D; margin-bottom: 4px; }
.kanban-card-company { font-size: 12px; color: #6B778C; margin-bottom: 8px; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; }
.kanban-card-value { font-size: 12px; font-weight: 600; color: #172B4D; }

/* Pipeline bar chart */
.pipeline-bar { margin-bottom: 12px; }
.pipeline-bar-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.pipeline-bar-name { font-size: 13px; color: #172B4D; font-weight: 500; }
.pipeline-bar-value { font-size: 13px; color: #6B778C; }
.pipeline-bar-track { height: 10px; background: #EBECF0; border-radius: 5px; overflow: hidden; }
.pipeline-bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s; }

/* Dashboard */
.dashboard-content { padding: 24px; overflow-y: auto; flex: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.dashboard-grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Detail layout */
.detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; padding: 20px 24px; }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-sidebar { display: flex; flex-direction: column; gap: 0; }
.detail-tab-content { flex: 1; overflow-y: auto; }

/* Mini table inside detail */
.mini-table { width: 100%; }
.mini-table th { padding: 8px 12px; font-size: 11px; font-weight: 700; color: #6B778C; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #EBECF0; }
.mini-table td { padding: 8px 12px; font-size: 13px; color: #172B4D; border-bottom: 1px solid #EBECF0; }
.mini-table tbody tr:hover { background: #F4F5F7; cursor: pointer; }
.mini-table tbody tr:last-child td { border-bottom: none; }

/* Convert section */
.convert-section { padding: 24px; }
.convert-card { background: #FFF; border: 1px solid #DFE1E6; border-radius: 8px; padding: 24px; max-width: 600px; }
.convert-card h2 { font-size: 18px; font-weight: 700; color: #172B4D; margin-bottom: 6px; }
.convert-card p { font-size: 14px; color: #6B778C; margin-bottom: 20px; }
.convert-checkbox-row { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #DFE1E6; border-radius: 6px; margin-bottom: 8px; cursor: pointer; transition: background 0.1s; }
.convert-checkbox-row:hover { background: #F4F5F7; }
.convert-checkbox-row input { accent-color: #0052CC; width: 16px; height: 16px; }
.convert-checkbox-row label { font-size: 14px; font-weight: 500; color: #172B4D; cursor: pointer; flex: 1; }
.convert-checkbox-row span { font-size: 12px; color: #6B778C; }

/* Quote line items */
.line-items-table th { padding: 8px 10px; font-size: 12px; font-weight: 600; color: #6B778C; text-transform: uppercase; border-bottom: 2px solid #DFE1E6; }
.line-items-table td { padding: 8px 10px; border-bottom: 1px solid #EBECF0; vertical-align: middle; }
.line-items-table input { border: 1px solid transparent; border-radius: 3px; padding: 4px 8px; font-size: 14px; color: #172B4D; background: transparent; width: 100%; font-family: inherit; }
.line-items-table input:focus { outline: none; border-color: #4C9AFF; background: #FFF; box-shadow: 0 0 0 2px rgba(76,154,255,0.2); }
.line-items-footer { padding: 16px 20px; }
.line-items-totals { float: right; min-width: 240px; }
.totals-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.totals-row.grand { font-weight: 700; font-size: 16px; border-top: 2px solid #DFE1E6; padding-top: 10px; margin-top: 4px; }

/* Reports */
.reports-content { padding: 24px; overflow-y: auto; flex: 1; }
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Stacked pipeline bar */
.stacked-bar { display: flex; height: 32px; border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.stacked-segment { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #FFF; transition: flex 0.4s; min-width: 30px; }

/* Win/Loss circles */
.ratio-display { display: flex; align-items: center; gap: 20px; padding: 16px 20px; }
.ratio-circle { width: 100px; height: 100px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.ratio-label { text-align: center; font-size: 12px; font-weight: 600; color: #6B778C; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 6px; }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   ATTACHMENT COMPONENT
   ============================================================ */
.attachment-list { display: flex; flex-direction: column; gap: 0; }
.attachment-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #EBECF0; transition: background 0.1s; }
.attachment-row:hover { background: #F4F5F7; }
.attachment-row:last-child { border-bottom: none; }
.attachment-icon { width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; }
.attachment-icon.pdf { background: #DE350B; }
.attachment-icon.doc { background: #0052CC; }
.attachment-icon.xls { background: #36B37E; }
.attachment-icon.img { background: #6554C0; }
.attachment-icon.zip { background: #FF8B00; }
.attachment-icon.processing { background: #6B778C; }
.attachment-meta { flex: 1; min-width: 0; }
.attachment-name { font-size: 13px; font-weight: 500; color: #172B4D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-detail { font-size: 12px; color: #6B778C; margin-top: 2px; }
.attachment-actions { display: flex; gap: 4px; flex-shrink: 0; }
.attachment-state-badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 3px; }
.attachment-state-processing { background: #FFF0E5; color: #974F0C; }
.attachment-state-ready { background: #E3FCEF; color: #006644; }
.attachment-state-archived { background: #DFE1E6; color: #42526E; }
.upload-progress { height: 4px; background: #EBECF0; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.upload-progress-bar { height: 100%; background: #0052CC; border-radius: 2px; transition: width 0.3s; }

/* ============================================================
   INLINE CONFIRMATION BANNER
   ============================================================ */
.void-confirm-banner {
  display: none; padding: 12px 24px; background: #FFEBE6; border-bottom: 1px solid #FFBDAD;
  flex-shrink: 0;
}
.void-confirm-banner.show { display: flex; align-items: center; gap: 12px; }
.void-confirm-banner .banner-text { flex: 1; font-size: 13px; color: #BF2600; font-weight: 500; }

/* ============================================================
   OVERDUE BANNER
   ============================================================ */
.overdue-banner {
  display: none; padding: 10px 24px; background: #FFEBE6; border-bottom: 1px solid #FFBDAD;
  flex-shrink: 0; align-items: center; gap: 12px;
}
.overdue-banner.show { display: flex; }
.overdue-banner .banner-text { flex: 1; font-size: 13px; color: #BF2600; font-weight: 500; }

/* ============================================================
   TASK STATUS FILTER PILLS
   ============================================================ */
.task-filter-pills {
  display: flex; gap: 4px; padding: 12px 24px 0; background: #FFF; flex-shrink: 0;
}
.task-filter-pill {
  padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  color: #42526E; background: #F4F5F7; border: 1px solid #DFE1E6; cursor: pointer;
  transition: all 0.15s;
}
.task-filter-pill:hover { background: #EBECF0; }
.task-filter-pill.active { background: #0052CC; color: #FFF; border-color: #0052CC; }

/* ============================================================
   TASK ROW URGENCY
   ============================================================ */
.task-row-overdue { border-left: 3px solid #DE350B; }
.task-row-today { border-left: 3px solid #FF8B00; }
.task-row-done td { opacity: 0.6; }
.task-row-done .task-title-text { text-decoration: line-through; color: #97A0AF; }

/* ============================================================
   PILL BUTTONS (Task Panel)
   ============================================================ */
.pill-group { display: flex; gap: 4px; }
.pill-btn {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid #DFE1E6; background: #FAFBFC; color: #42526E; cursor: pointer;
  transition: all 0.15s;
}
.pill-btn:hover { background: #EBECF0; }
.pill-btn.active-blue { background: #DEEBFF; border-color: #4C9AFF; color: #0052CC; }
.pill-btn.active-green { background: #E3FCEF; border-color: #57D9A3; color: #006644; }
.pill-btn.active-red { background: #FFEBE6; border-color: #FF8F73; color: #BF2600; }
.pill-btn.active-orange { background: #FFF0E5; border-color: #FFB881; color: #974F0C; }
.pill-btn.active-grey { background: #DFE1E6; border-color: #B3BAC5; color: #42526E; }

/* ============================================================
   QUOTE-TO-CASH JOURNEY STRIP
   ============================================================ */
.journey-strip {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 24px; background: #FFF;
  border: 1px solid #DFE1E6; border-radius: 8px; overflow: hidden;
}
.journey-step {
  flex: 1; padding: 18px 20px; cursor: pointer;
  transition: background 0.15s; position: relative;
  border-right: 1px solid #DFE1E6;
}
.journey-step:last-child { border-right: none; }
.journey-step:hover { background: #F4F5F7; }
.journey-step .js-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.journey-step .js-count { font-size: 22px; font-weight: 700; color: #172B4D; }
.journey-step .js-value { font-size: 13px; color: #6B778C; margin-top: 2px; }
.journey-arrow {
  width: 28px; min-width: 28px; display: flex; align-items: center;
  justify-content: center; color: #C1C7D0; font-size: 18px;
}
.journey-step-blue  .js-label { color: #0052CC; }
.journey-step-indigo .js-label { color: #403294; }
.journey-step-orange .js-label { color: #974F0C; }
.journey-step-green  .js-label { color: #006644; }

/* ============================================================
   LINKED RECORD CHIPS
   ============================================================ */
.linked-chips { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.linked-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid #DFE1E6;
  border-radius: 6px; font-size: 13px; color: #172B4D;
  cursor: pointer; background: #FAFBFC; transition: all 0.15s;
}
.linked-chip:hover { background: #DEEBFF; border-color: #4C9AFF; color: #0052CC; }
.linked-chip .chip-type { font-size: 11px; font-weight: 700; color: #6B778C; text-transform: uppercase; letter-spacing: 0.04em; }

/* ============================================================
   FULFILLMENT STEPS
   ============================================================ */
.fulfillment-steps {
  display: flex; align-items: center; gap: 0; margin-bottom: 20px;
}
.fs-step {
  display: flex; flex-direction: column; align-items: center; flex: 1; position: relative;
}
.fs-step:not(:last-child)::after {
  content: ''; position: absolute; left: 50%; right: -50%; top: 16px;
  height: 2px; background: #EBECF0; z-index: 0;
}
.fs-step.done::after { background: #36B37E; }
.fs-dot {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid #DFE1E6;
  background: #FFF; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #97A0AF; z-index: 1; position: relative;
}
.fs-step.done .fs-dot { background: #36B37E; border-color: #36B37E; color: #FFF; }
.fs-step.active .fs-dot { background: #0052CC; border-color: #0052CC; color: #FFF; }
.fs-label { font-size: 11px; color: #6B778C; margin-top: 6px; font-weight: 500; white-space: nowrap; }
.fs-step.done .fs-label { color: #36B37E; }
.fs-step.active .fs-label { color: #0052CC; font-weight: 700; }

/* ============================================================
   PAYMENT SUMMARY CARD
   ============================================================ */
.payment-summary {
  background: #F4F5F7; border-radius: 6px; padding: 16px 20px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.ps-item .ps-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #6B778C; margin-bottom: 4px; }
.ps-item .ps-value { font-size: 22px; font-weight: 700; }
.ps-value.due   { color: #DE350B; }
.ps-value.paid  { color: #36B37E; }
.ps-value.bal   { color: #0052CC; }
.ps-value.recv  { color: #172B4D; }
.ps-value.alloc { color: #36B37E; }
.ps-value.unalloc { color: #FF8B00; }

/* ============================================================
   TASK RIGHT PANEL
   ============================================================ */
.task-panel-overlay {
  position: fixed; inset: 0; background: rgba(9,30,66,0.3);
  z-index: 500; display: none;
}
.task-panel-overlay.open { display: block; }
.task-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; background: #FFF; box-shadow: -4px 0 24px rgba(9,30,66,0.14);
  display: flex; flex-direction: column; z-index: 501;
  transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.2,0,0,1);
}
.task-panel-overlay.open .task-panel { transform: translateX(0); }
.task-panel-header {
  padding: 20px 24px; border-bottom: 1px solid #EBECF0;
  display: flex; align-items: center; gap: 12px;
}
.task-panel-title { font-size: 18px; font-weight: 700; color: #172B4D; flex: 1; }
.task-panel-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.task-panel-field { margin-bottom: 16px; }
.task-panel-field label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #6B778C; margin-bottom: 6px; }
.task-panel-field .tpf-value { font-size: 14px; color: #172B4D; }

/* ============================================================
   REPORTS TABS
   ============================================================ */
.revenue-bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 0 20px 0; }
.rbc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rbc-bars { display: flex; gap: 2px; align-items: flex-end; height: 90px; width: 100%; }
.rbc-bar { flex: 1; border-radius: 3px 3px 0 0; transition: opacity 0.2s; }
.rbc-bar:hover { opacity: 0.8; }
.rbc-label { font-size: 11px; color: #6B778C; }
