@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #F8FAFC;
  --bg-rgb: 248, 250, 252;
  --panel: #ffffff;
  --panel-rgb: 255, 255, 255;
  --panel-soft: #F1F5F9;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --brand: #1E3A8A;
  /* Deep Navy - Trust/Stability */
  --brand-dark: #1E3A8A;
  --brand-light: rgba(30, 58, 138, 0.08);
  --accent: #059669;
  /* Emerald Green - Growth/Success */
  --accent-dark: #047857;
  --blue: #2563eb;
  --rose: #e11d48;
  --amber: #d97706;
  --green: #10b981;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 4px 20px rgba(15, 23, 42, 0.04);
  --radius: 16px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F172A;
  --bg-rgb: 15, 23, 42;
  --panel: #1E293B;
  --panel-rgb: 30, 41, 59;
  --panel-soft: #334155;
  --ink: #F8FAFC;
  --muted: #94A3B8;
  --line: #334155;
  --brand: #60A5FA;
  --brand-dark: #3B82F6;
  --brand-light: rgba(96, 165, 250, 0.15);
  --accent: #10B981;
  --accent-dark: #059669;
  --blue: #60a5fa;
  --rose: #fb7185;
  --amber: #f59e0b;
  --green: #34d399;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%2364748b' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px !important;
  cursor: pointer;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23cbd5e1' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: rgba(var(--panel-rgb), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
  border-right: 1px solid var(--line);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 16px;
  color: var(--brand);
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  min-height: 42px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 500;
  transition: all var(--transition);
}

.nav button.active,
.nav button:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.nav svg,
.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.role-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 26px;
  background: rgba(var(--panel-rgb), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

.search {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 14px 0 42px;
  transition: all var(--transition);
}

.search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
  background: var(--panel);
}

.search svg {
  position: absolute;
  left: 14px;
  top: 13px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select,
.btn,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  min-height: 40px;
}

.select {
  padding: 0 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 600;
  transition: all var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn.primary {
  background: var(--brand);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--brand-light);
}

.btn.primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 6px 16px var(--brand-light);
}

.btn.ghost {
  background: transparent;
  color: var(--brand);
  border-color: transparent;
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--brand-light);
  transform: none;
}

.icon-btn {
  width: 40px;
  display: grid;
  place-items: center;
}

.content {
  padding: 24px 26px 42px;
  display: grid;
  gap: 22px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.section-head h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0 0 6px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
}

.dashboard>.grid {
  margin-bottom: 24px;
}

.dashboard-stack {
  display: grid;
  gap: 24px;
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 18px;
}

.metric {
  min-height: 128px;
  display: grid;
  align-content: space-between;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  margin: 10px 0 3px;
}

.trend {
  color: var(--green);
  font-size: 30px;
  font-weight: 700;
}

.warn {
  color: var(--amber);
}

.danger {
  color: var(--rose);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

.dashboard-jobs table {
  min-width: 1080px;
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  background: var(--panel-soft);
  position: sticky;
  top: 0;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--panel-soft);
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.status.completed {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status.delayed,
.status.critical {
  background: rgba(225, 29, 72, 0.12);
  color: var(--rose);
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.status.review {
  background: rgba(217, 119, 6, 0.12);
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.status.progress {
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

select.status {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  font-family: inherit;
  cursor: pointer;
  padding-right: 22px;
  background-image: url('data:image/svg+xml;utf8,<svg fill="currentColor" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position-x: calc(100% - 2px);
  background-position-y: center;
}

.bar {
  height: 9px;
  background: var(--panel-soft);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-dark), var(--blue));
}

.bar.success span {
  background: linear-gradient(90deg, #166534, var(--green));
}

.bar.warning span {
  background: linear-gradient(90deg, #9a3412, var(--amber));
}

.bar.danger span {
  background: linear-gradient(90deg, #9f1239, var(--rose));
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  align-items: center;
  padding: 20px 20px 0;
}

.filter-bar select {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}

.list {
  display: grid;
  gap: 12px;
}

.bottleneck-strip {
  display: grid;
  gap: 14px;
}

.bottleneck-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.bottleneck-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.bottleneck-item {
  display: grid;
  gap: 9px;
  min-height: 78px;
  padding: 14px;
  background: var(--panel-soft);
  border-radius: 8px;
}

.row-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.row-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--brand-light);
}

tbody tr {
  transition: all var(--transition);
}

tbody tr:hover {
  background: var(--panel-soft);
}

tbody tr[data-job-row] {
  transition: all var(--transition);
  cursor: pointer;
}

tbody tr[data-job-row]:hover {
  background: var(--panel-soft);
  transform: translateY(-1px);
  box-shadow: inset 3px 0 0 var(--brand);
}

.row-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.muted {
  color: var(--muted);
}

.split-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-card {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
}

.form-grid.client-form-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.form-grid.extensions-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}

.form-grid label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 15px;
  transition: all var(--transition);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 4px var(--brand-light), inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.form-grid input:disabled,
.form-grid select:disabled,
.form-grid textarea:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.6;
  border-color: var(--line);
}

.form-grid input.custom-input-match {
  width: 100%;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
  min-height: 36px;
  box-shadow: none;
}

.compact-copy {
  margin: 8px 0 0;
}

.doc-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- CUSTOM SELECT DROPDOWN ---------- */
.custom-select-container {
  position: relative;
  display: inline-block;
  width: 100%;
  min-width: 120px;
  max-width: 100%;
}

.filter-bar .custom-select-container {
  width: auto;
  min-width: 160px;
  flex: 1;
  max-width: 250px;
}

.custom-select-trigger {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  display: block;
  text-align: left;
  position: relative;
  padding-right: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s, box-shadow 0.2s;
  user-select: none;
  min-height: 36px;
}

button.custom-select-trigger,
button.custom-select-option {
  appearance: none;
  font-family: inherit;
  text-align: left;
  outline: none;
}

button.custom-select-option {
  border: none;
  background: none;
  display: block;
  width: 100%;
}

.custom-select-trigger::after {
  content: "▼";
  font-size: 9px;
  color: var(--muted);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0;
  transition: transform 0.2s;
}

.custom-select-container.open {
  z-index: 100;
}

.custom-select-container.open .custom-select-trigger {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.custom-select-container.open .custom-select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 250px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  flex-direction: column;
  padding: 4px;
  backdrop-filter: blur(12px);
  background: rgba(var(--surface-rgb, 255, 255, 255), 0.95);
  animation: dropdownFade 0.15s ease forwards;
}

/* Fix for dark mode backgrounds without rgb vars */
[data-theme="dark"] .custom-select-options {
  background: rgba(15, 23, 42, 0.95);
}

.custom-select-options {
  /* other styles keep as is but I'll replace the block to be safe */
}

/* Just applying animation to .custom-select-options is enough */

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-option {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  word-wrap: break-word;
}

.custom-select-option:hover {
  background: var(--line);
}

.custom-select-option.selected {
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand);
  font-weight: 600;
}

.doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.doc-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--brand-light);
}

.doc-row strong,
.doc-row span {
  display: block;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.client-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-card {
  display: grid;
  gap: 12px;
}

.client-card > * {
  min-width: 0;
}

.client-card h3,
.card h2,
.card h3 {
  margin: 0;
}

.client-fields {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.workflow {
  display: grid;
  gap: 12px;
}

.milestone {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.step-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 800;
}

.milestone.done .step-dot {
  background: rgba(21, 128, 61, 0.16);
  color: var(--green);
}

.milestone.active {
  border-color: var(--brand);
}

.locked {
  opacity: 0.58;
}

.textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel-soft);
  font-size: 15px;
  transition: all var(--transition);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 4px var(--brand-light), inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.drop {
  border: 1px dashed var(--brand);
  min-height: 148px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--brand-light);
  color: var(--muted);
  padding: 18px;
  transition: background var(--transition);
}

.drop:hover {
  background: rgba(var(--bg-rgb), 0.5);
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
}

.login-visual {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #ffffff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
}

.login-visual h1 {
  font-size: 44px;
  line-height: 1.04;
  max-width: 780px;
  margin: 0;
}

.login-visual p {
  max-width: 700px;
  margin: 0;
  color: #dbeafe;
  font-size: 18px;
}

.login-panel {
  background: var(--panel);
  padding: 40px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.field input {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 12px;
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.tabs button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.active {
  background: var(--brand-dark);
  color: #ffffff;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  background: var(--ink);
  color: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 9999;
  animation: slideUpFade var(--transition);
}

.hidden {
  display: none !important;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- Tax Calendar Timeline --- */
.timeline-container {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 20px 0;
  width: 100%;
}
.timeline-container::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--line);
}
.timeline-event {
  display: flex;
  position: relative;
  margin-bottom: 30px;
  width: 100%;
}
.timeline-event:nth-child(even) {
  flex-direction: row-reverse;
}
.timeline-date-column {
  flex: 0 0 50%;
  max-width: 50%;
  box-sizing: border-box;
  padding-right: 20px;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
  padding-top: 4px;
}
.timeline-event:nth-child(even) .timeline-date-column {
  text-align: left;
  padding-right: 0;
  padding-left: 20px;
}
.timeline-content-column {
  flex: 0 0 50%;
  max-width: 50%;
  box-sizing: border-box;
  padding-left: 30px;
  position: relative;
}
.timeline-event:nth-child(even) .timeline-content-column {
  padding-left: 0;
  padding-right: 30px;
}
.timeline-content-column::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.timeline-event:nth-child(even) .timeline-content-column::before {
  left: auto;
  right: -8px;
}
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px var(--shadow);
  width: 100%;
  box-sizing: border-box;
}
.timeline-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.badge {
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-green { background: #E8F5E9; color: #2E7D32; }
.badge-yellow { background: #FFF8E1; color: #F57F17; }
.badge-red { background: #FFEBEE; color: #C62828; }
.badge-gray { background: #F5F5F5; color: #616161; }

.filter-pills {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.filter-pill.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 12px;
  }

  .brand {
    padding-bottom: 0;
    border-bottom: none;
    justify-content: space-between;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .metrics,
  .two-col,
  .three-col,
  .bottleneck-list,
  .form-grid,
  .form-grid.extensions-form,
  .login {
    grid-template-columns: 1fr;
  }

  .bottleneck-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-visual {
    min-height: 360px;
  }
}

@media (max-width: 640px) {

  .topbar,
  .section-head,
  .top-actions,
  .bottleneck-head,
  .row-line {
    display: grid;
    grid-template-columns: 1fr;
  }

  .content,
  .topbar,
  .login-panel,
  .login-visual {
    padding: 18px;
  }

  .login-visual h1 {
    font-size: 34px;
  }

  .bottleneck-list {
    grid-template-columns: 1fr;
  }

  .milestone {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .milestone .btn {
    grid-column: 1 / -1;
  }
}

/* Timer Widget */
.timer-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--brand);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.15);
  transition: all var(--transition);
}

.timer-display {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 1px;
}

.timer-task {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInScale var(--transition);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 400px;
  max-width: 90vw;
}

/* UI Shield */
.ui-shield-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.ui-shield-container .blur-content {
  filter: blur(8px);
  pointer-events: none;
  opacity: 0.6;
  user-select: none;
}

.ui-shield-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(var(--bg-rgb), 0.4);
  z-index: 10;
  text-align: center;
  padding: 32px;
}


/* Sticky Note Tooltip */
.tooltip-note {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.tooltip-note::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--amber);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  width: max-content;
  max-width: 300px;
  word-break: break-word;
  text-align: left;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}

.tooltip-note::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  border-width: 6px;
  border-style: solid;
  border-color: var(--amber) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 1000;
}

.tooltip-note:hover::after,
.tooltip-note:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.variant-option:hover {
  border-color: var(--brand) !important;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.08);
  transform: translateY(-1px);
}

/* FinTech Black Card Aesthetic - XP Tiers */
.fintech-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.fintech-card h2,
.fintech-card h3,
.fintech-card p,
.fintech-card span {
  position: relative;
  z-index: 2;
}

.fintech-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  animation: shimmer 6s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmer {
  0% { left: -100%; }
  20% { left: 200%; }
  100% { left: 200%; }
}

/* Tier specific backgrounds */
.tier-wood-bg { background: linear-gradient(135deg, #4A3B32, #2D231E); color: #D7CCC8 !important; border-color: #5D4037 !important; }
.tier-iron-bg { background: linear-gradient(135deg, #546E7A, #37474F); color: #CFD8DC !important; border-color: #78909C !important; }
.tier-bronze-bg { background: linear-gradient(135deg, #5D4037, #3E2723); color: #FFCCBC !important; border-color: #8D6E63 !important; }
.tier-silver-bg { background: linear-gradient(135deg, #78909C, #455A64); color: #ECEFF1 !important; border-color: #B0BEC5 !important; }

/* The Premium Tiers */
.tier-gold-bg {
  background: linear-gradient(135deg, #212121 0%, #000000 100%);
  color: #FFD700 !important;
  border: 1px solid #FFD700 !important;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.15);
}
.tier-gold-bg h2, .tier-gold-bg h3 { color: #FFD700 !important; }

.tier-diamond-bg {
  background: linear-gradient(135deg, #1A237E 0%, #000000 100%);
  color: #80D8FF !important;
  border: 1px solid #80D8FF !important;
  box-shadow: 0 4px 15px rgba(128, 216, 255, 0.15);
}
.tier-diamond-bg h2, .tier-diamond-bg h3 { color: #80D8FF !important; }
.tier-diamond-bg::before { background: linear-gradient(to right, rgba(128,216,255,0) 0%, rgba(128,216,255,0.1) 50%, rgba(128,216,255,0) 100%); }

.tier-pink_diamond-bg {
  background: linear-gradient(135deg, #2A0910 0%, #000000 100%);
  color: #FFC0CB !important;
  border: 1px solid #FFC0CB !important;
  box-shadow: 0 4px 20px rgba(255, 182, 193, 0.2);
}
.tier-pink_diamond-bg h2, .tier-pink_diamond-bg h3 { color: #FFC0CB !important; }
.tier-pink_diamond-bg::before { background: linear-gradient(to right, rgba(255,182,193,0) 0%, rgba(255,182,193,0.15) 50%, rgba(255,182,193,0) 100%); }

.tier-blue_diamond-bg {
  background: linear-gradient(135deg, #001F33 0%, #000000 100%);
  color: #00BFFF !important;
  border: 1px solid #00BFFF !important;
  box-shadow: 0 4px 20px rgba(0, 191, 255, 0.2);
}
.tier-blue_diamond-bg h2, .tier-blue_diamond-bg h3 { color: #00BFFF !important; }
.tier-blue_diamond-bg::before { background: linear-gradient(to right, rgba(0,191,255,0) 0%, rgba(0,191,255,0.15) 50%, rgba(0,191,255,0) 100%); }

.tier-red_diamond-bg {
  background: linear-gradient(135deg, #330000 0%, #000000 100%);
  color: #FF3333 !important;
  border: 1px solid #FF3333 !important;
  box-shadow: 0 4px 20px rgba(255, 51, 51, 0.2);
}
.tier-red_diamond-bg h2, .tier-red_diamond-bg h3 { color: #FF3333 !important; }
.tier-red_diamond-bg::before { background: linear-gradient(to right, rgba(255,51,51,0) 0%, rgba(255,51,51,0.15) 50%, rgba(255,51,51,0) 100%); }

/* Tag styles for Leaderboard */
.tier-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.tier-wood-tag { background: #3E2723; color: #D7CCC8; border: 1px solid #5D4037; }
.tier-iron-tag { background: #37474F; color: #CFD8DC; border: 1px solid #78909C; }
.tier-bronze-tag { background: #3E2723; color: #FFCCBC; border: 1px solid #8D6E63; }
.tier-silver-tag { background: #455A64; color: #ECEFF1; border: 1px solid #B0BEC5; }
.tier-gold-tag { background: #111; color: #FFD700; border: 1px solid #FFD700; box-shadow: 0 0 5px rgba(255,215,0,0.2); }
.tier-diamond-tag { background: #111; color: #80D8FF; border: 1px solid #80D8FF; box-shadow: 0 0 5px rgba(128,216,255,0.2); }
.tier-pink_diamond-tag { background: #000; color: #FFB6C1; border: 1px solid #FFB6C1; box-shadow: 0 0 8px rgba(255,182,193,0.3); }
.tier-blue_diamond-tag { background: #000; color: #00BFFF; border: 1px solid #00BFFF; box-shadow: 0 0 8px rgba(0,191,255,0.3); }
.tier-red_diamond-tag { background: #000; color: #FF3333; border: 1px solid #FF3333; box-shadow: 0 0 10px rgba(255,51,51,0.5); }

/* --- Full Page Trophy Vault --- */
.vault-container {
  min-height: calc(100vh - 64px); /* Account for topbar if needed */
  background: radial-gradient(circle at center top, #2C313C 0%, #11141A 100%);
  color: #F8FAFC;
  padding: 60px;
  box-sizing: border-box;
  border-radius: 8px; /* Since it's inside the main content area */
}

.vault-header {
  max-width: 1200px;
  margin: 0 auto 40px auto;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 24px;
}
.vault-header h1 {
  font-size: 36px;
  margin: 0 0 8px 0;
  font-weight: 700;
  background: linear-gradient(90deg, #F8FAFC, #94A3B8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.vault-header p {
  color: #94A3B8;
  font-size: 16px;
  margin: 0;
}

.vault-content {
  max-width: 1200px;
  margin: 0 auto;
}

.vault-section {
  margin-bottom: 60px;
}
.vault-section h2 {
  font-size: 24px;
  color: #E2E8F0;
  margin-bottom: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px;
}

.interactive-card {
  background: rgba(30, 34, 45, 0.6);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}
.interactive-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: rgba(40, 45, 60, 0.8);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px rgba(255,255,255,0.05);
}
.interactive-card .title {
  font-size: 14px;
  font-weight: 600;
  color: #F8FAFC;
  margin-bottom: 6px;
}
.interactive-card .subtitle {
  font-size: 12px;
  color: #94A3B8;
  line-height: 1.4;
}

/* --- Trophy Detail Modal --- */
.modal-overlay {
  perspective: 1000px;
}
.trophy-detail-content {
  background: #1A1C23;
  border: 1px solid #333;
  border-radius: 36px;
  padding: 60px;
  text-align: center;
  position: relative;
  max-width: 750px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.8), inset 0 2px 0 rgba(255,255,255,0.1);
  transform-style: preserve-3d;
  animation: popIn3D 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn3D {
  0% { transform: scale(0.5) rotateX(20deg); opacity: 0; }
  100% { transform: scale(1) rotateX(0deg); opacity: 1; }
}

.close-detail-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  color: #94A3B8;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 20px;
}
.close-detail-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.trophy-detail-image {
  perspective: 1000px;
  margin-bottom: 20px;
}
.trophy-detail-image img {
  max-width: 400px;
  max-height: 400px;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,0.7));
  animation: float-award 5s ease-in-out infinite;
  transition: transform 0.3s ease;
  transform: translateZ(50px);
}
.trophy-detail-image:hover img {
  transform: translateZ(80px) rotateY(15deg) rotateX(10deg) scale(1.05);
}
.trophy-detail-info {
  margin-top: 48px;
  transform: translateZ(30px);
}
.trophy-detail-info h2 {
  font-size: 48px;
  color: #F8FAFC;
  margin: 0 0 12px 0;
  font-weight: 700;
  text-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.trophy-detail-period {
  font-size: 24px;
  color: #94A3B8;
  margin-bottom: 24px;
}
.trophy-detail-xp {
  display: inline-block;
  background: rgba(var(--brand-rgb), 0.1);
  color: var(--brand);
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 20px;
}

@keyframes float-award {
  0% { transform: translateY(0px) translateZ(50px); }
  50% { transform: translateY(-10px) translateZ(50px); }
  100% { transform: translateY(0px) translateZ(50px); }
}

/* --- Original Medal/Trophy Size Settings --- */
.award-image-wrapper {
  position: relative;
  display: inline-block;
}
.award-base {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* --- Red Diamond Tier Visual Enhancements --- */
.tier-red_diamond .award-base {
  filter: drop-shadow(0 0 5px rgba(255, 51, 51, 0.4)) contrast(1.1) brightness(1.05);
  animation: red_diamond-pulse 3s infinite alternate;
}

@keyframes red_diamond-pulse {
  0% { filter: drop-shadow(0 0 3px rgba(255, 51, 51, 0.2)) contrast(1.1) brightness(1.05); }
  100% { filter: drop-shadow(0 0 10px rgba(255, 51, 51, 0.6)) contrast(1.15) brightness(1.1); }
}

/* --- Gamification Level Up Modal --- */
.level-up-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  animation: fadeIn 0.4s ease-out forwards;
}

.level-up-content {
  background: var(--bg);
  border: 2px solid var(--tier-color, #ccc);
  box-shadow: 0 0 40px -10px var(--tier-color, #ccc);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  animation: levelUpPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.level-up-icon-wrapper {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px auto;
  color: var(--tier-color);
  animation: levelUpFloat 3s ease-in-out infinite, levelUpGlow 2s infinite alternate;
}

.level-up-icon {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 15px var(--tier-color));
}

.level-up-title {
  font-size: 28px;
  margin: 0 0 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.level-up-tier {
  font-size: 20px;
  margin: 0 0 20px;
  color: var(--tier-color);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.level-up-message {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

@keyframes levelUpPop {
  0% { transform: scale(0.8) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes levelUpFloat {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes levelUpGlow {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.3); }
}
/* Analytics View Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.chart-container {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-container h3 {
  margin-top: 0;
  font-size: 16px;
  margin-bottom: 24px;
  color: var(--text-primary);
  width: 100%;
  text-align: left;
}

.chart-container canvas {
  max-width: 100%;
  max-height: 280px;
}


/* Fix for multiple select */
select[multiple] {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  background-image: none !important;
  padding: 8px !important;
  height: auto !important;
  min-height: 120px;
}
