/* Inter Variable Font - self-hosted */
@font-face {
  font-family: 'Inter Var';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/public/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Var';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/public/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/public/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
}

/* App switcher dropdown */
.navbar-brand.dropdown-toggle {
  display: flex;
  align-items: center;
}
.navbar-brand.dropdown-toggle::after {
  margin-left: 0.4rem;
  opacity: 0.6;
}
.dropdown-menu-dark .dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}
.dropdown-menu-dark .dropdown-item.active {
  background-color: rgba(255, 255, 255, 0.1);
}
.badge.bg-purple {
  background-color: #7c3aed !important;
}

/* Google login button */
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.btn-google:hover {
  background: #f7f8f8;
}

/* ===== Plan View ===== */

/* Priority color system */
:root {
  --pri-critical: #ef4444;
  --pri-critical-bg: #fef2f2;
  --pri-critical-border: #fecaca;
  --pri-high: #f59e0b;
  --pri-high-bg: #fffbeb;
  --pri-high-border: #fde68a;
  --pri-medium: #3b82f6;
  --pri-medium-bg: #eff6ff;
  --pri-medium-border: #bfdbfe;
  --pri-low: #94a3b8;
  --pri-low-bg: #f8fafc;
  --pri-low-border: #e2e8f0;
  --plan-green: #22c55e;
  --plan-green-bg: #f0fdf4;
  --plan-surface: #ffffff;
  --plan-bg: #f8fafc;
  --plan-border: #e2e8f0;
  --plan-text: #0f172a;
  --plan-text-secondary: #475569;
  --plan-text-muted: #94a3b8;
  --plan-radius: 12px;
  --plan-radius-sm: 8px;
  --plan-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

/* KPI Cards */
.plan-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.plan-kpi-card {
  background: var(--plan-surface);
  border-radius: var(--plan-radius);
  padding: 20px;
  box-shadow: var(--plan-shadow);
  position: relative;
  overflow: hidden;
}
.plan-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.plan-kpi-card.total::before { background: var(--pri-medium); }
.plan-kpi-card.positive::before { background: var(--plan-green); }
.plan-kpi-card.negative::before { background: var(--pri-critical); }
.plan-kpi-card.neutral::before { background: var(--pri-medium); }
.plan-kpi-card.info::before { background: var(--pri-high); }
.plan-kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--plan-text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.plan-kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--plan-text);
  line-height: 1.2;
}
.plan-kpi-card.negative .plan-kpi-value { color: var(--pri-critical); }
.plan-kpi-card.positive .plan-kpi-value { color: var(--plan-green); }
.plan-kpi-unit {
  font-size: 1rem;
  font-weight: 500;
  color: var(--plan-text-muted);
}
.plan-kpi-date {
  font-size: 1.1rem;
  font-weight: 700;
}
.plan-kpi-sub {
  font-size: 0.78rem;
  color: var(--plan-text-muted);
  margin-top: 2px;
}

/* Overall Progress Card */
.plan-progress-card {
  background: var(--plan-surface);
  border-radius: var(--plan-radius);
  padding: 20px;
  box-shadow: var(--plan-shadow);
}
.plan-progress-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--plan-text);
}
.plan-progress-pct {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--plan-text);
}
.plan-progress-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
}
.plan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 5px;
  transition: width 0.4s ease;
}

/* Priority overview chips */
.plan-priority-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.plan-pri-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
}
.plan-pri-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.plan-pri-chip.critical { background: var(--pri-critical-bg); color: #991b1b; }
.plan-pri-chip.critical .plan-pri-dot { background: var(--pri-critical); }
.plan-pri-chip.high { background: var(--pri-high-bg); color: #92400e; }
.plan-pri-chip.high .plan-pri-dot { background: var(--pri-high); }
.plan-pri-chip.medium { background: var(--pri-medium-bg); color: #1e40af; }
.plan-pri-chip.medium .plan-pri-dot { background: var(--pri-medium); }
.plan-pri-chip.low { background: var(--pri-low-bg); color: #475569; }
.plan-pri-chip.low .plan-pri-dot { background: var(--pri-low); }

/* Audit Summary Section */
.plan-summary-section {
  background: var(--plan-surface);
  border-radius: var(--plan-radius);
  box-shadow: var(--plan-shadow);
  overflow: hidden;
}
.plan-summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-weight: 600;
}
.plan-summary-header::-webkit-details-marker { display: none; }
.plan-summary-header::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--plan-text-muted);
  border-bottom: 2px solid var(--plan-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.plan-summary-section[open] > .plan-summary-header::before {
  transform: rotate(45deg);
}
.plan-summary-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--plan-text);
}
.plan-summary-body {
  padding: 0 20px 20px;
}
.plan-summary-text {
  font-size: 0.88rem;
  color: var(--plan-text-secondary);
  line-height: 1.6;
  white-space: pre-line;
}

/* Month Sections */
.plan-month-section {
  background: var(--plan-surface);
  border-radius: var(--plan-radius);
  box-shadow: var(--plan-shadow);
  overflow: hidden;
}
.plan-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  gap: 12px;
}
.plan-month-header::-webkit-details-marker { display: none; }
.plan-month-header::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--plan-text-muted);
  border-bottom: 2px solid var(--plan-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.plan-month-section[open] > .plan-month-header::before {
  transform: rotate(45deg);
}
.plan-month-info {
  flex: 1;
  min-width: 0;
}
.plan-month-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--plan-text);
}
.plan-month-sub {
  font-size: 0.78rem;
  color: var(--plan-text-muted);
  margin-left: 8px;
}
.plan-month-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.plan-month-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--plan-text-secondary);
  white-space: nowrap;
}
.plan-month-progress {
  width: 60px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.plan-month-progress-fill {
  height: 100%;
  background: var(--plan-green);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.plan-month-body {
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Plan Task Cards */
.plan-task {
  border-left: 3px solid var(--plan-border);
  padding: 12px 16px;
  border-radius: 0 var(--plan-radius-sm) var(--plan-radius-sm) 0;
  background: var(--plan-bg);
  transition: opacity 0.2s, background 0.2s;
}
.plan-task.critical { border-left-color: var(--pri-critical); background: var(--pri-critical-bg); }
.plan-task.high { border-left-color: var(--pri-high); background: var(--pri-high-bg); }
.plan-task.medium { border-left-color: var(--pri-medium); background: var(--pri-medium-bg); }
.plan-task.low { border-left-color: var(--pri-low); background: var(--pri-low-bg); }
.plan-task.completed {
  opacity: 0.6;
  background: var(--plan-bg) !important;
  border-left-color: var(--plan-green) !important;
}
.plan-task.completed .plan-task-title {
  text-decoration: line-through;
  color: var(--plan-text-muted);
}
.plan-task-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.plan-task-header .form-check-input {
  margin-top: 3px;
  cursor: pointer;
  flex-shrink: 0;
}
.plan-task-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--plan-text);
  line-height: 1.4;
}
.plan-task-notes {
  font-size: 0.82rem;
  color: var(--plan-text-secondary);
  margin-top: 6px;
  padding-left: 30px;
  line-height: 1.5;
}

/* Priority Badges */
.priority-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.priority-critical { background: var(--pri-critical); color: white; }
.priority-high { background: var(--pri-high); color: white; }
.priority-medium { background: var(--pri-medium); color: white; }
.priority-low { background: var(--pri-low-border); color: var(--plan-text-secondary); }

/* Status Badges */
.status-badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}
.status-done { background: var(--plan-green-bg); color: #166534; }
.status-progress { background: var(--pri-medium-bg); color: #1e40af; }
.status-pending { background: var(--pri-low-bg); color: var(--plan-text-secondary); }

/* Priority Matrix */
.plan-matrix-section {
  background: var(--plan-surface);
  border-radius: var(--plan-radius);
  box-shadow: var(--plan-shadow);
  overflow: hidden;
}
.plan-matrix-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-weight: 600;
}
.plan-matrix-header::-webkit-details-marker { display: none; }
.plan-matrix-header::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--plan-text-muted);
  border-bottom: 2px solid var(--plan-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.plan-matrix-section[open] > .plan-matrix-header::before {
  transform: rotate(45deg);
}
.plan-matrix-body {
  padding: 0 20px 20px;
}
.plan-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.plan-matrix-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--plan-bg);
  border-bottom: 2px solid var(--plan-border);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--plan-text-secondary);
}
.plan-matrix-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--plan-border);
  vertical-align: middle;
}
.plan-matrix-table tbody tr:hover { background: var(--plan-bg); }
.plan-matrix-table .row-completed td { color: var(--plan-text-muted); }
.plan-matrix-table .row-completed td:first-child { text-decoration: line-through; }

/* Responsive */
@media (max-width: 768px) {
  .plan-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-month-header { flex-wrap: wrap; }
  .plan-month-stats { width: 100%; justify-content: flex-end; }
  .plan-task-header { flex-wrap: wrap; }
  .plan-matrix-table { font-size: 0.78rem; }
  .plan-matrix-table th, .plan-matrix-table td { padding: 8px; }
}
@media (max-width: 480px) {
  .plan-kpi-grid { grid-template-columns: 1fr; }
  .plan-kpi-value { font-size: 1.4rem; }
}
