/* Imperial CRM – shared styles (layout aligned with reference) */
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; font-size: 15px; line-height: 1.5; color: #1f2937; background: #f8fafc; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); color: #e8e8e8; }
.login-box { width: 100%; max-width: 360px; padding: 2rem; background: rgba(255,255,255,0.06); border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-logo { max-height: 48px; margin-bottom: 0.5rem; }
.login-box h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; color: #b0b0b0; }
.form-group input { width: 100%; padding: 0.6rem 0.75rem; font-size: 1rem; border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; background: rgba(0,0,0,0.2); color: #fff; }
.form-group input::placeholder { color: #888; }
.form-group input:focus { outline: none; border-color: #4a9eff; box-shadow: 0 0 0 2px rgba(74,158,255,0.25); }
.btn { display: inline-block; padding: 0.6rem 1rem; font-size: 0.95rem; font-weight: 500; border: none; border-radius: 8px; cursor: pointer; text-align: center; text-decoration: none; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: #475569; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }
.message { padding: 0.6rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.message-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.message-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.mt-2 { margin-top: 0.75rem; }

/* App layout: dark sidebar + main */
.app-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: #0f172a; color: #e2e8f0; flex-shrink: 0;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-brand img { height: 36px; width: auto; }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-text a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.sidebar-brand-text span { color: #94a3b8; font-size: 0.8rem; margin-top: 0.1rem; }
.sidebar-nav { padding: 1rem 0; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1.25rem;
  color: #94a3b8; text-decoration: none; transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.sidebar-nav a .icon { flex-shrink: 0; width: 20px; height: 20px; opacity: 0.9; }
.sidebar-nav a.active .icon { opacity: 1; }
.sidebar-nav-sub { padding-left: 2.5rem; padding-top: 0.25rem; padding-bottom: 0.5rem; }
.sidebar-nav-sub a { padding: 0.45rem 1rem; font-size: 0.9rem; }
.sidebar-user {
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
}
.sidebar-user-name { font-weight: 600; color: #fff; font-size: 0.95rem; }
.sidebar-user-role { color: #94a3b8; font-size: 0.8rem; margin-top: 0.15rem; }
.sidebar-user .btn-logout {
  display: block; width: 100%; margin-top: 0.75rem; padding: 0.5rem 1rem;
  background: #1e293b; color: #e2e8f0; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; font-size: 0.9rem; font-weight: 500; text-align: center;
  cursor: pointer; text-decoration: none;
}
.sidebar-user .btn-logout:hover { background: #334155; color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; overflow: auto; }
.main-head { padding: 1.25rem 1.5rem; background: #fff; border-bottom: 1px solid #e2e8f0; }
.main-head h1 { margin: 0; font-size: 1.5rem; font-weight: 600; color: #0f172a; }
.main-head .main-head-sub { margin-top: 0.25rem; font-size: 0.95rem; color: #64748b; }
.main-body { padding: 1.5rem; flex: 1; }

/* Sidebar: option to hide; "Show menu" tab when hidden */
.sidebar { transition: transform 0.25s ease; }
.sidebar-hide-link {
  display: block; width: 100%; margin: 0.5rem 1.25rem 0.75rem; padding: 0.25rem 0;
  background: none; border: none;
  color: #7dd3fc; font-size: 0.85rem; cursor: pointer; text-align: left;
  text-decoration: none; font-family: inherit;
}
.sidebar-hide-link:hover { color: #bae6fd; text-decoration: underline; }
.sidebar-show-tab {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 102;
  width: 36px; padding: 0.75rem 0.5rem; border: none; border-radius: 0 8px 8px 0;
  background: #0f172a; color: #e2e8f0; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; writing-mode: vertical-rl; text-orientation: mixed; letter-spacing: 0.05em;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}
.sidebar-show-tab:hover { background: #1e293b; color: #fff; }
.app-wrap.sidebar-hidden .sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 101;
  transform: translateX(-100%);
}
@media (max-width: 768px) {
  .sidebar { width: 260px; max-width: 85vw; }
  .app-wrap.sidebar-hidden .sidebar { width: 260px; max-width: 85vw; }
}

/* Section headings (like "Summary", "Secretary Organisation") */
.section-title { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 1rem 0; font-size: 1.1rem; font-weight: 600; color: #0f172a; }
.section-title .icon { width: 22px; height: 22px; color: #64748b; flex-shrink: 0; }
.section { margin-bottom: 2rem; }
.section:last-child { margin-bottom: 0; }

/* Summary cards (coloured borders, icon, count, View →) */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.summary-card {
  background: #fff; border-radius: 10px; padding: 1.25rem; border-left: 4px solid #94a3b8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); position: relative;
}
.summary-card--danger { border-left-color: #dc2626; }
.summary-card--info { border-left-color: #2563eb; }
.summary-card--success { border-left-color: #16a34a; }
.summary-card--warn { border-left-color: #d97706; }
.summary-card-header { display: flex; align-items: center; gap: 0.5rem; justify-content: space-between; margin-bottom: 0.75rem; flex-wrap: wrap; }
.summary-card-header .icon { width: 22px; height: 22px; flex-shrink: 0; }
.summary-card--danger .summary-card-header .icon { color: #dc2626; }
.summary-card--info .summary-card-header .icon { color: #2563eb; }
.summary-card--success .summary-card-header .icon { color: #16a34a; }
.summary-card--warn .summary-card-header .icon { color: #d97706; }
.summary-card-title { font-size: 0.9rem; font-weight: 600; color: #475569; margin: 0; flex: 1; }
.summary-card-view { font-size: 0.85rem; color: #2563eb; font-weight: 500; white-space: nowrap; }
.summary-card-view:hover { text-decoration: underline; }
.summary-card-n { font-size: 1.75rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.summary-card-detail { font-size: 0.8rem; color: #64748b; margin-top: 0.5rem; line-height: 1.4; }

/* Tiles with icons (feature tiles) */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.tile {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1.25rem;
  text-decoration: none; color: inherit; display: flex; flex-direction: column; align-items: flex-start;
  transition: box-shadow .2s, border-color .2s; overflow: visible;
}
.tile:hover { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59,130,246,0.12); text-decoration: none; }
.tile .tile-icon { width: 48px; height: 48px; margin-bottom: 0.75rem; color: #3b82f6; flex-shrink: 0; display: block; }
.tile .tile-icon-wrap { position: relative; display: inline-block; margin-bottom: 0.75rem; width: 48px; height: 48px; flex-shrink: 0; overflow: visible; }
.tile .tile-icon-wrap .tile-icon { margin-bottom: 0; width: 100%; height: 100%; }
.tile .tile-count {
  position: absolute; top: -8px; right: -8px; min-width: 1.5rem; height: 1.5rem; padding: 0 5px;
  border-radius: 50%; background: #2563eb; color: #fff; font-size: 0.8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25); border: 2px solid #fff;
  z-index: 2;
}
.tile .tile-icon-svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; }
.tile h3 { margin: 0 0 0.25rem 0; font-size: 1rem; font-weight: 600; color: #0f172a; }
.tile h3.tile-heading { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.tile .tile-number { font-size: 1.25rem; font-weight: 700; color: #2563eb; }
.tile p { margin: 0; font-size: 0.875rem; color: #64748b; line-height: 1.4; }
.tile-grid--large { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile-grid--large .tile .tile-icon { width: 56px; height: 56px; }
.tile-grid--large .tile .tile-icon-wrap { width: 56px; height: 56px; margin-bottom: 0.75rem; }
.tile-grid--large .tile .tile-count { min-width: 1.6rem; height: 1.6rem; font-size: 0.85rem; }

/* Legacy stat cards (simplified) */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1rem; text-align: center; }
.stat-card .n { font-size: 1.75rem; font-weight: 700; color: #1f2937; }
.stat-card .l { font-size: 0.8rem; color: #6b7280; margin-top: 0.25rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.65rem 1rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; color: #64748b; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 0.2rem 0.5rem; font-size: 0.75rem; border-radius: 6px; font-weight: 500; }
.badge-leads { background: #dbeafe; color: #1d4ed8; }
.badge-bd { background: #fef3c7; color: #b45309; }
.badge-kit { background: #d1fae5; color: #047857; }
.badge-archive { background: #e5e7eb; color: #4b5563; }
.badge-overdue { background: #fee2e2; color: #b91c1c; }

/* Pagination (list pages: default 10 per page, options 25/50/100) – horizontal layout */
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 0.75rem 0; border-top: 1px solid #e2e8f0; }
.pagination-info { font-size: 0.875rem; color: #64748b; }
.pagination-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.pagination-per-page { display: inline-flex; align-items: center; gap: 0.35rem; }
.pagination-per-page select { padding: 0.35rem 0.5rem; font-size: 0.875rem; border: 1px solid #e2e8f0; border-radius: 6px; }
.pagination-nav { display: inline-block; }
.pagination-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 0.25rem; }
.pagination-list li { display: inline-block; list-style: none; }
.pagination-list a, .pagination-list .pagination-current { display: inline-block; padding: 0.35rem 0.6rem; font-size: 0.875rem; text-decoration: none; color: #334155; border-radius: 6px; white-space: nowrap; }
.pagination-list a:hover { background: #f1f5f9; color: #0f172a; }
.pagination-list .pagination-current { background: #3b82f6; color: #fff; font-weight: 600; }
.pagination-prev, .pagination-next, .pagination-last { font-weight: 500; }
.pagination-goto { display: inline-flex; align-items: center; gap: 0.35rem; }
.pagination-goto label { font-size: 0.875rem; color: #64748b; }
.pagination-goto input[type="number"] { width: 3.5rem; padding: 0.35rem 0.5rem; font-size: 0.875rem; border: 1px solid #e2e8f0; border-radius: 6px; text-align: center; }
.pagination-goto button { padding: 0.35rem 0.6rem; font-size: 0.875rem; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; cursor: pointer; }
.pagination-goto button:hover { background: #f1f5f9; }

/* To Do List */
.todo-done .todo-title { text-decoration: line-through; color: #94a3b8; }
.todo-overdue { color: #b91c1c; }
.todo-empty { color: #64748b; font-style: italic; padding: 1.5rem !important; }
.todo-check { display: inline-flex; align-items: center; }

/* Forms (in main area) */
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.form-group-inline label { display: block; margin-bottom: 0.3rem; font-size: 0.9rem; font-weight: 500; color: #374151; }
.form-group-inline input, .form-group-inline select, .form-group-inline textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.95rem; }
.form-group-inline textarea { min-height: 80px; resize: vertical; }
.form-actions { margin-top: 1.5rem; }
.form-actions .btn { margin-right: 0.5rem; }

/* Typeahead (searchable candidate/job selects) */
.typeahead-wrap { position: relative; }
.typeahead-results {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px;
  max-height: 220px; overflow-y: auto; z-index: 100;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: none;
}
.typeahead-results--open { display: block; }
.typeahead-item { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.95rem; border-bottom: 1px solid #f1f5f9; }
.typeahead-item:last-child { border-bottom: none; }
.typeahead-item:hover { background: #f1f5f9; }
.typeahead-item--empty { color: #64748b; cursor: default; }

/* Utilities */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 12px; padding: 1.5rem; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-box h2 { margin: 0 0 1rem 0; font-size: 1.2rem; }
.modal-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

/* Forecast Tracker: status row colours (orange / green / white) */
.forecast-legend { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.forecast-legend-item { padding: 0.25rem 0.75rem; border-radius: 6px; font-size: 0.85rem; font-weight: 500; }
.forecast-status-forecast { background: #ffedd5; color: #9a3412; }
.forecast-status-delivered { background: #dcfce7; color: #166534; }
.forecast-status-working { background: #fff; color: #374151; border: 1px solid #e5e7eb; }
.forecast-table .forecast-status-forecast td { background: #ffedd5 !important; }
.forecast-table .forecast-status-delivered td { background: #dcfce7 !important; }
.forecast-table .forecast-status-working td { background: #fff !important; }
.forecast-badge { display: inline-block; padding: 0.2rem 0.5rem; font-size: 0.75rem; border-radius: 6px; font-weight: 500; }
.forecast-badge-forecast { background: #ea580c; color: #fff; }
.forecast-badge-delivered { background: #16a34a; color: #fff; }
.forecast-badge-working { background: #6b7280; color: #fff; }
.forecast-badge-lost { background: #b91c1c; color: #fff; }
.forecast-status-lost { background: #fee2e2; color: #b91c1c; }
.forecast-table .forecast-status-lost td { background: #fee2e2 !important; }
.forecast-subtotal-row td { background: #f8fafc !important; font-weight: 500; border-top: 1px solid #e2e8f0; }
.forecast-total-row td { background: #e2e8f0 !important; font-weight: 700; border-top: 2px solid #94a3b8; }
.forecast-add-form.card-like { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1.25rem; }
.btn-link { background: none; border: none; cursor: pointer; font-size: inherit; color: #2563eb; padding: 0; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #b91c1c; }
.forecast-actions-cell { white-space: nowrap; }
.forecast-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.forecast-actions .forecast-action-form { display: inline-block; }
.forecast-actions a + .forecast-action-form::before,
.forecast-actions .forecast-action-form + .forecast-action-form::before,
.forecast-actions .forecast-action-form + a::before { content: "·"; margin-right: 0.5rem; color: #94a3b8; font-weight: bold; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Advanced filters (RecruitEZ list pages) */
.advanced-filters { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.advanced-filters-summary { padding: 0.5rem 0.75rem; cursor: pointer; font-weight: 500; font-size: 0.95rem; list-style: none; }
.advanced-filters-summary::-webkit-details-marker { display: none; }
.advanced-filters-summary::before { content: '▸ '; display: inline-block; width: 1em; }
details.advanced-filters[open] .advanced-filters-summary::before { content: '▾ '; }
.block { display: block; }
.mb-1 { margin-bottom: 0.25rem; }

/* Email verification (lead/targeted company forms) */
.email-verify-wrap { display: flex; flex-direction: column; gap: 0.25rem; }
.email-verify-wrap .email-input-group { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.email-verify-wrap .email-input-group input { flex: 1; min-width: 160px; }
.email-check-btn { padding: 0.35rem 0.6rem; font-size: 0.85rem; background: #e2e8f0; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.email-check-btn:hover { background: #cbd5e1; }
.email-verify-status { font-size: 0.85rem; min-height: 1.25em; }
.email-verify-status.email-verify-valid { color: #15803d; }
.email-verify-status.email-verify-warning { color: #b45309; }
.email-verify-status.email-verify-invalid { color: #b91c1c; font-weight: 500; }
input.email-invalid { border-color: #b91c1c !important; box-shadow: 0 0 0 1px #b91c1c; }
