*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FB349F;
  --secondary: #FFB32F;
  --tertiary: #229DD8;
  --background: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #EAECF0;
  --text-primary: #111827;
  --text-secondary: #667085;
  --text-muted: #98A2B3;
  --success: #16A34A;
  --danger: #E11D48;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sidebar-width: 264px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 30px rgba(16, 24, 40, 0.04);
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Layout ─── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: #FFFFFF;
  border-right: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 24px;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo { height: 72px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-bottom: 0; }
.sidebar-logo img { width: 220px; max-width: 220px; max-height: 76px; object-fit: contain; }
.sidebar-divider { height: 1px; background: #F2F4F7; margin: 6px 0 10px; flex-shrink: 0; }
.sidebar-menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.sidebar-item {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none; color: #344054; font-weight: 500; font-size: 13.5px; white-space: nowrap; flex-shrink: 0;
}

.sidebar-item .si-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; color: #4B5563; }
.sidebar-item:hover { background: rgba(251, 52, 159, 0.07); color: #FB349F; }
.sidebar-item:hover .si-icon { color: #FB349F; }
.sidebar-item.active { background: #FB349F; color: #FFFFFF; font-weight: 600; box-shadow: 0 8px 20px rgba(251, 52, 159, 0.28); }
.sidebar-item.active .si-icon { color: #FFFFFF; }

.sidebar-footer {
  border-top: 1px solid #E5E7EB; padding-top: 16px; margin-top: 8px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; flex-shrink: 0; border-radius: var(--radius-md); padding: 12px 10px; transition: background 0.15s;
  text-decoration: none;
}
.sidebar-footer:hover { background: #F9FAFB; }

.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #FB349F; color: #FFFFFF;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; letter-spacing: 0.02em;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: #667085; text-transform: capitalize; }

/* ─── Main ─── */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-width: 0; padding: 32px; min-height: 100vh; overflow-x: hidden; }

/* ─── Header ─── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 28px; font-weight: 700; color: #111827; line-height: 1; }
.page-subtitle { font-size: 13px; color: #667085; margin-top: 6px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.search-wrapper { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #98A2B3; pointer-events: none; display: flex; align-items: center; }
.search-input {
  width: 280px; height: 42px; border: 1px solid #E5E7EB; border-radius: 10px; padding: 0 14px 0 38px;
  font-size: 13.5px; font-family: var(--font-sans); color: var(--text-primary); background: #FFFFFF; outline: none; transition: border-color 0.15s;
}
.search-input:focus { border-color: #FB349F; }
.search-input::placeholder { color: #98A2B3; }

.btn-icon {
  width: 42px; height: 42px; border: 1px solid #E5E7EB; border-radius: 10px; background: #FFFFFF;
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: border-color 0.15s; flex-shrink: 0;
}
.btn-icon:hover { border-color: #FB349F; }

.notif-dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; background: #FB349F; border-radius: 50%; border: 1.5px solid #FFFFFF; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; font-family: var(--font-sans); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: #fff; color: #344054; border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; color: var(--danger); border-color: #FCA5B1; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Period / Filter buttons ─── */
.period-filters { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-btn {
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid #E5E7EB; background: #FFFFFF; color: #344054;
  font-size: 13px; font-weight: 500; font-family: var(--font-sans); cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none;
}
.filter-btn:hover { border-color: #FB349F; color: #FB349F; }
.filter-btn.active { background: #FB349F; border-color: #FB349F; color: #FFFFFF; }

/* ─── KPI Grid ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card {
  background: #FFFFFF; border: 1px solid #EAECF0; border-radius: var(--radius-lg); padding: 22px; min-height: 100px;
  box-shadow: var(--shadow-card); display: flex; flex-direction: column; justify-content: center; transition: box-shadow 0.2s;
}
.kpi-card:hover { box-shadow: 0 16px 40px rgba(16, 24, 40, 0.08); }
.kpi-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: 12.5px; font-weight: 500; color: #667085; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 26px; font-weight: 700; color: #111827; line-height: 1.1; }
.kpi-value.sm { font-size: 20px; }
.kpi-icon-box { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ─── Charts / Panels ─── */
.charts-grid { display: grid; grid-template-columns: 2fr 1.15fr 1.15fr; gap: 16px; margin-bottom: 20px; }
.chart-card { background: #FFFFFF; border: 1px solid #EAECF0; border-radius: var(--radius-lg); padding: 20px 20px 12px; box-shadow: var(--shadow-card); min-height: 320px; display: flex; flex-direction: column; }
.chart-head { margin-bottom: 2px; }
.chart-title { font-size: 14.5px; font-weight: 700; color: #111827; }
.chart-sub { font-size: 11.5px; color: #98A2B3; margin-top: 2px; margin-bottom: 8px; }
.chart-body { flex: 1; }

.bottom-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.panel-card { background: #FFFFFF; border: 1px solid #EAECF0; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-card); }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.panel-title { font-size: 14.5px; font-weight: 700; color: #111827; }

/* ─── Generic data table ─── */
.data-table-wrap { background: #FFFFFF; border: 1px solid #EAECF0; border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: auto; }
.data-table, .proposals-table { width: 100%; border-collapse: collapse; }
.data-table th, .proposals-table th { background: #F9FAFB; padding: 12px 14px; text-align: left; font-size: 11px; font-weight: 600; color: #667085; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #EAECF0; white-space: nowrap; }
.data-table td, .proposals-table td { padding: 13px 14px; color: #374151; border-bottom: 1px solid #F2F4F7; font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td, .proposals-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td, .proposals-table tr:hover td { background: #FAFAFA; }
.data-table-empty { padding: 40px 20px; text-align: center; color: #98A2B3; font-size: 13.5px; }

.prop-id { font-weight: 600; color: #111827; font-size: 12px; font-variant-numeric: tabular-nums; }

.status-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill-gray { background: #F2F4F7; color: #475467; }
.pill-blue { background: rgba(34,157,216,0.12); color: #229DD8; }
.pill-yellow { background: rgba(255,179,47,0.16); color: #B45900; }
.pill-pink { background: rgba(251,52,159,0.12); color: #FB349F; }
.pill-green { background: rgba(22,163,74,0.12); color: #16A34A; }
.pill-red { background: rgba(225,29,72,0.12); color: #E11D48; }

.action-btn-sm { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; border: 1px solid #E5E7EB; background: #FFFFFF; cursor: pointer; color: #667085; transition: all 0.15s; text-decoration: none; }
.action-btn-sm:hover { border-color: #FB349F; color: #FB349F; }
.row-actions { display: flex; gap: 6px; }

/* ─── Activities ─── */
.activity-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-bottom: 1px solid #F2F4F7; }
.activity-item:last-child { border-bottom: none; }
.act-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.act-body { flex: 1; min-width: 0; }
.act-title { font-size: 12.5px; font-weight: 600; color: #111827; margin-bottom: 2px; }
.act-desc { font-size: 12px; color: #667085; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-time { font-size: 11px; color: #98A2B3; white-space: nowrap; margin-top: 2px; }

.panel-footer { display: flex; justify-content: center; padding-top: 14px; border-top: 1px solid #F2F4F7; margin-top: 8px; }
.footer-link { font-size: 12.5px; font-weight: 600; color: #FB349F; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; transition: opacity 0.15s; }
.footer-link:hover { opacity: 0.75; }

.hamburger { display: none; width: 42px; height: 42px; border: 1px solid #E5E7EB; border-radius: 10px; background: #FFFFFF; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 199; backdrop-filter: blur(2px); }
.sidebar-overlay.open { display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #98A2B3; }

/* ─── Forms / Modals ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; font-weight: 600; color: #344054; }
.form-field input, .form-field select, .form-field textarea {
  height: 42px; border: 1px solid #E5E7EB; border-radius: 10px; padding: 0 14px; font-size: 13.5px;
  font-family: var(--font-sans); color: var(--text-primary); background: #FFFFFF; outline: none; transition: border-color 0.15s;
}
.form-field textarea { height: auto; padding: 10px 14px; min-height: 90px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--primary); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #F2F4F7; }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(16,24,40,0.45); z-index: 500; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 26px; box-shadow: 0 24px 60px rgba(16,24,40,0.2); }
.modal-box.wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { cursor: pointer; color: #98A2B3; background: none; border: none; display: flex; }
.modal-close:hover { color: #E11D48; }

/* ─── Flash messages ─── */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.flash-msg { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.flash-success { background: rgba(22,163,74,0.1); color: #16A34A; border: 1px solid rgba(22,163,74,0.25); }
.flash-error { background: rgba(225,29,72,0.1); color: #E11D48; border: 1px solid rgba(225,29,72,0.25); }
.flash-info { background: rgba(34,157,216,0.1); color: #229DD8; border: 1px solid rgba(34,157,216,0.25); }

/* ─── Kanban ─── */
.kanban-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.kanban-board {
  display: grid;
  grid-template-columns: repeat(var(--kanban-columns, 1), minmax(220px, 1fr));
  gap: 14px;
  align-items: flex-start;
  min-width: max-content;
  width: 100%;
  transition: opacity 0.15s ease;
}
.kanban-board.is-saving { opacity: 0.86; }
.kanban-col {
  background: #F2F4F7;
  border: 1px solid #EAECF0;
  border-radius: var(--radius-sm);
  min-width: 220px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 178px);
}
.kanban-col-head { min-height: 48px; padding: 14px 14px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kanban-col-title { min-width: 0; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; line-height: 1.25; }
.kanban-col-title span + * { min-width: 0; }
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-count { font-size: 11.5px; color: #667085; background: #fff; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.kanban-col-body { flex: 1; overflow-y: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 10px; min-height: 96px; }
.kanban-card {
  background: #fff; border-radius: var(--radius-sm); padding: 13px 14px; box-shadow: 0 2px 8px rgba(16,24,40,0.06);
  cursor: grab; border: 1px solid transparent; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.kanban-card:hover { border-color: var(--primary); box-shadow: 0 10px 24px rgba(16,24,40,0.1); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card-ghost { opacity: 0.4; background: rgba(251,52,159,0.08); border: 1px dashed rgba(251,52,159,0.45); box-shadow: none; }
.kanban-card-chosen { border-color: rgba(251,52,159,0.45); }
.kanban-card-drag { cursor: grabbing; transform: rotate(1deg); box-shadow: 0 18px 40px rgba(16,24,40,0.18); }
.kanban-dnd-disabled .kanban-card { cursor: default; }
.kanban-card-title { font-size: 13px; font-weight: 600; color: #111827; margin-bottom: 6px; overflow-wrap: anywhere; }
.kanban-card-meta { font-size: 11.5px; color: #667085; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kanban-card-value { font-weight: 700; color: var(--primary); }

/* ─── Proposal slide editor ─── */
.editor-shell { display: flex; gap: 18px; height: calc(100vh - 170px); }
.slide-list { width: 220px; flex-shrink: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.slide-thumb { border: 2px solid var(--border); border-radius: 10px; padding: 10px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.slide-thumb.active { border-color: var(--primary); background: rgba(251,52,159,0.05); }
.slide-thumb .num { width: 22px; height: 22px; border-radius: 50%; background: #F2F4F7; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.editor-main { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.editor-code { flex: 1; width: 100%; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; border: 1px solid var(--border); border-radius: 10px; padding: 14px; resize: none; }
.editor-preview-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 16/9; max-height: 45vh; }
.editor-preview-wrap iframe { width: 100%; height: 100%; border: none; }
#pdf-render-root { position: fixed; left: -99999px; top: 0; }
#pdf-render-root .slide-frame { width: 1280px; height: 720px; }

/* ─── Login ─── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 20px;
  background: radial-gradient(circle at 30% 20%, #FF5CB8 0%, #FB349F 45%, #C41E7A 100%);
}
#bg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.login-box { position: relative; z-index: 1; background: #fff; border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); }
.login-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.login-logo img { width: 200px; }
.login-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: #667085; text-align: center; margin-bottom: 26px; }

.password-wrapper { position: relative; }
.password-wrapper input { width: 100%; padding-right: 44px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #98A2B3; border-radius: 8px; transition: color 0.15s;
}
.password-toggle:hover { color: var(--primary); }

.badge-role { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; }

/* ─── Responsive ─── */
@media (max-width: 1199px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .editor-shell { flex-direction: column; height: auto; }
  .slide-list { width: 100%; flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.1); }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .hamburger { display: flex; }
  .search-wrapper { display: none; }
  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .kpi-value { font-size: 22px; }
  .kpi-value.sm { font-size: 18px; }
  .page-title { font-size: 22px; }
  .charts-grid { gap: 12px; }
  .bottom-grid { gap: 12px; }
  .chart-card { min-height: 260px; }
  .period-filters { overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
}

.page-bottom-space { height: 40px; }
