:root {
  --bg: #eef2f9;
  --card: #ffffff;
  --text: #102846;
  --muted: #4f617b;
  --accent: #ff6a1a;
  --accent-2: #de540d;
  --accent-rgb: 255, 106, 26;
  --brand-blue: #0f3e83;
  --brand-blue-2: #0b3168;
  --brand-blue-rgb: 15, 62, 131;
  --border: #d3ddec;
  --danger: #b42318;
  --menu-bg: #edf3ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.14) 0%, transparent 38%),
    radial-gradient(circle at bottom left, rgba(var(--brand-blue-rgb), 0.16) 0%, transparent 40%),
    var(--bg);
}

header {
  padding: 2rem 1.25rem 1.65rem;
}

.brand-wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem;
}

.brand-fallback {
  width: 82px;
  height: 82px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent), var(--brand-blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0 0 0.2rem;
  color: var(--brand-blue);
}

header p {
  color: var(--muted);
  margin: 0;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.hidden {
  display: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 22px rgba(30, 46, 98, 0.06);
}

.report-card p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.report-card {
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.65rem;
}

.report-head h2 {
  margin: 0;
  font-size: 1rem;
}

.report-head button {
  padding: 0.32rem 0.62rem;
  font-size: 0.84rem;
}

.auth-card h3 {
  margin-top: 0;
}

.bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.header-account {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  justify-content: flex-end;
  text-align: right;
}

.header-account-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: nowrap;
}

.header-links {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.header-link-btn {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f6f9ff;
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.header-link-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-link-btn:hover {
  background: #eaf0ff;
}

.alerts-wrap {
  position: relative;
}

.alerts-btn {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f6f9ff;
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.alerts-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.alerts-btn:hover {
  background: #eaf0ff;
}

.alerts-badge {
  position: absolute;
  top: -5px;
  right: -1px;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  background: #dc2626;
  border: 1px solid #fff;
  line-height: 1;
}

.alerts-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(320px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(23, 40, 83, 0.16);
  padding: 0.25rem 0;
  text-align: left;
  z-index: 50;
}

.alerts-list {
  display: grid;
  gap: 0;
}

.alerts-item {
  display: block;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.35;
}

.alerts-item-link {
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  background: #fff;
  font-weight: 500;
}

.alerts-item-link:hover {
  background: #f7fbff;
  filter: none;
}

.alerts-item:first-child {
  border-top: 0;
}

.alerts-item.empty {
  color: var(--muted);
}

.header-link-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  background: #eaf1ff;
  color: var(--brand-blue);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 20;
}

.header-link-btn:hover::after,
.header-link-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.plan-badge {
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f6f9ff;
  color: var(--brand-blue);
  font-size: 0.78rem;
  font-weight: 600;
}

.theme-label,
.theme-color {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.theme-label select {
  min-width: 148px;
}

.theme-color input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 0.15rem;
}

.workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 1rem;
  min-height: auto;
  background: linear-gradient(180deg, var(--menu-bg), #fff);
}

.sidebar h3 {
  margin-top: 0;
}

.menu-btn {
  width: 100%;
  text-align: left;
  margin: 0 0 0.45rem;
  background: #dce7fb;
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.menu-btn > span:last-child {
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.menu-icon {
  width: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.menu-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-btn.active {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-2));
  color: #fff;
}

.content-area {
  min-width: 0;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.subnav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
  overflow-x: auto;
}

.subnav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 0.45rem 0.5rem;
  font-weight: 600;
}

.subnav-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.subnav-btn:hover {
  filter: none;
  color: var(--brand-blue);
}

.subnav-btn.active {
  color: var(--brand-blue);
  border-bottom-color: var(--brand-blue);
}

.scholarship-tab-panel {
  display: none;
}

.scholarship-tab-panel.active {
  display: block;
}

.service-tab-panel {
  display: none;
}

.service-tab-panel.active {
  display: block;
}

.teaching-tab-panel {
  display: none;
}

.teaching-tab-panel.active {
  display: block;
}

.tenure-tab-panel {
  display: none;
}

.tenure-tab-panel.active {
  display: block;
}

.hr-tab-panel {
  display: none;
}

.hr-tab-panel.active {
  display: block;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.active {
  display: block;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

#analytics-row {
  grid-template-columns: 2fr 1fr;
}

form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

label {
  font-size: 0.92rem;
  display: grid;
  gap: 0.25rem;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

button {
  width: fit-content;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(0.96);
}

button.delete {
  background: var(--danger);
}

button.secondary {
  background: #e6edf9;
  color: var(--brand-blue);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  border-top: 1px solid var(--border);
  padding: 0.55rem;
  text-align: left;
  vertical-align: top;
}

thead th {
  border-top: 0;
  color: var(--muted);
  font-weight: 600;
}

#dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.dash-toggles {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.dash-toggles label {
  display: flex;
  align-items: center;
  gap: 0.32rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.inline-toggle {
  display: flex;
  align-items: center;
  gap: 0.24rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.inline-toggle input[type="checkbox"] {
  transform: scale(2);
  transform-origin: center;
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  background: linear-gradient(180deg, #fafdff, #f1f6ff);
}

.kpi strong {
  display: block;
  font-size: 1.05rem;
}

.kpi-upcoming-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

#message {
  min-height: 1.3rem;
  color: var(--muted);
}

.billing-mom-section {
  margin-top: 0.9rem;
}

#billing-mom-note {
  margin-top: 0;
  color: var(--muted);
}

.billing-mom-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdff;
  overflow: hidden;
}

.billing-mom-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  padding: 0.46rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.billing-mom-row:last-child {
  border-bottom: 0;
}

.billing-mom-amount {
  font-weight: 700;
  color: var(--brand-blue);
}

.billing-roi-note {
  margin-top: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: #f7fbff;
  color: var(--muted);
  font-size: 0.84rem;
}

.app-footer-note {
  margin: 1.2rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-footer-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.app-footer-row a {
  color: var(--brand-blue);
  text-decoration: none;
}

.app-footer-row a:hover {
  text-decoration: underline;
}

#papers-graph-note {
  margin-top: 0;
  color: var(--muted);
}

#publications-note {
  margin-top: 0;
  color: var(--muted);
}

.publications-list {
  margin-bottom: 0.6rem;
  display: grid;
  gap: 0.4rem;
}

.publication-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: #fbfdff;
}

.publication-item strong {
  display: block;
}

tr.row-alert-focus {
  background: rgba(var(--accent-rgb), 0.16);
  transition: background 200ms ease;
}

#publications-copy-text {
  min-height: 130px;
}

.tenure-controls {
  display: flex;
  align-items: end;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.tenure-grid-wrap {
  overflow-x: auto;
}

.tenure-grid-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.tenure-grid-table th,
.tenure-grid-table td {
  border: 1px solid var(--border);
  padding: 0.35rem;
  vertical-align: top;
}

.tenure-grid-table th {
  background: #f7faff;
}

.tenure-grid-table td.year-cell {
  font-weight: 700;
  width: 130px;
  background: #f8fafc;
}

.tenure-grid-table tr.tenure-row.tone-1 td {
  background: #eef7ef;
}

.tenure-grid-table tr.tenure-row.tone-2 td {
  background: #edf5fb;
}

.tenure-grid-table tr.tenure-row.tone-3 td {
  background: #fff4ea;
}

.tenure-grid-table tr.tenure-row.tone-4 td {
  background: #f5effa;
}

.tenure-grid-table tr.tenure-row.tone-5 td {
  background: #fffbe7;
}

.tenure-grid-table tr.tenure-row.tone-6 td {
  background: #fff1f3;
}

.tenure-grid-table td.year-cell.tone-1 {
  border-left: 4px solid #5f9a6a;
}

.tenure-grid-table td.year-cell.tone-2 {
  border-left: 4px solid #5f86b4;
}

.tenure-grid-table td.year-cell.tone-3 {
  border-left: 4px solid #c98a48;
}

.tenure-grid-table td.year-cell.tone-4 {
  border-left: 4px solid #8b6daf;
}

.tenure-grid-table td.year-cell.tone-5 {
  border-left: 4px solid #b69d2d;
}

.tenure-grid-table td.year-cell.tone-6 {
  border-left: 4px solid #b56a77;
}

.tenure-grid-table textarea {
  min-height: 44px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.75);
}

.tenure-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.tenure-year-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #fbfdff;
}

.tenure-year-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.tenure-year-members {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.28rem;
}

.tenure-year-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.tenure-year-notes {
  color: var(--muted);
}

#papers-graph {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

#compensation-trend-note {
  margin-top: 0;
  color: var(--muted);
}

#compensation-trend-graph {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.calendar-toolbar button {
  padding: 0.26rem 0.5rem;
  font-size: 0.8rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
}

.calendar-day {
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.calendar-day.muted {
  opacity: 0.45;
}

.calendar-day .day-num {
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 600;
}

.calendar-day .day-event {
  font-size: 0.62rem;
  line-height: 1.2;
  border-radius: 4px;
  background: #eef5ff;
  padding: 0.08rem 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-day .event-link {
  border: 0;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.calendar-detail {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.84rem;
  color: var(--muted);
  background: #fafcff;
}

#billing-message {
  margin-top: 0;
  color: var(--muted);
}

#paypal-button-container {
  max-width: 320px;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 1rem;
}

.plan-card.active {
  border-color: var(--brand-blue);
  box-shadow: inset 0 0 0 1px var(--brand-blue);
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.plan-card h3 {
  margin: 0 0 0.25rem;
}

.plan-subtitle {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.plan-price {
  margin: -0.1rem 0 0.55rem;
  color: var(--brand-blue);
  font-weight: 700;
}

.plan-features {
  margin: 0 0 0.8rem 1rem;
  padding: 0;
  color: var(--text);
}

.plan-features li {
  margin: 0.28rem 0;
}

.plan-select-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

#upgrade-status {
  margin-top: 0;
  color: var(--muted);
}

@media (min-width: 900px) {
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }

  #analytics-row {
    grid-template-columns: 2fr 1fr;
  }

  .plan-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 899px) {
  .brand-wrap {
    align-items: flex-start;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
  }

  .brand-fallback {
    width: 64px;
    height: 64px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  #analytics-row {
    grid-template-columns: 1fr;
  }
}
