/* ── Design tokens ───────────────────────────────────────────────── */
:root {
  --color-navy:    #1a2744;
  --color-navy-dk: #111b33;
  --color-gold:    #c8952a;
  --color-gold-lt: #e6b04a;
  --color-bg:      #f4f5f7;
  --color-surface: #ffffff;
  --color-text:    #1e1e2e;
  --color-muted:   #6b7280;
  --color-border:  #d1d5db;
  --color-locked:  #9ca3af;
  --radius:        6px;
  --sidebar-w:     220px;
  --header-h:      60px;
  --shadow:        0 1px 4px rgba(0,0,0,.10), 0 4px 16px rgba(0,0,0,.06);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

a { color: var(--color-gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ──────────────────────────────────────────────────────── */
.header {
  background: var(--color-navy);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.header__wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.header__wordmark-main {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #ffffff;
}

.header__wordmark-sub {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__user-label {
  font-size: .8rem;
  color: #a0aec0;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s;
}

.btn--primary {
  background: var(--color-gold);
  color: #ffffff;
}
.btn--primary:hover { background: var(--color-gold-lt); }

.btn--ghost {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.35);
  color: #ffffff;
}
.btn--ghost:hover { border-color: var(--color-gold); color: var(--color-gold); }

/* ── Shell layout ────────────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-navy-dk);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__section-label {
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--color-locked);
  padding: 18px 20px 6px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: .88rem;
  color: #c9d1e0;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  user-select: none;
}

.sidebar__item:hover {
  background: rgba(255,255,255,.06);
  color: #ffffff;
}

.sidebar__item.active {
  border-left-color: var(--color-gold);
  color: #ffffff;
  font-weight: 600;
  background: rgba(200,149,42,.10);
}

.sidebar__item.locked {
  color: var(--color-locked);
}

.sidebar__item.locked:hover {
  background: rgba(255,255,255,.04);
  color: #9ca3af;
}

.sidebar__lock {
  font-size: .75rem;
  margin-left: auto;
  opacity: .6;
}

/* ── Main content ────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 32px 36px;
  overflow-y: auto;
}

/* ── Panel ───────────────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

.panel__header {
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--color-border);
}

.panel__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-navy);
}

.panel__subtitle {
  font-size: .82rem;
  color: var(--color-muted);
  margin-top: 3px;
}

/* ── Message Board ───────────────────────────────────────────────── */
.post {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  margin-bottom: 18px;
  border-left: 4px solid var(--color-gold);
}

.post__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 6px;
}

.post__meta {
  font-size: .76rem;
  color: var(--color-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
}

.post__meta span::before {
  content: '·';
  margin-right: 14px;
}
.post__meta span:first-child::before { content: none; }

.post__body {
  font-size: .9rem;
  line-height: 1.65;
  color: #374151;
}

/* ── Thread ──────────────────────────────────────────────────────── */
.post--threaded .post__body { margin-bottom: 20px; }

.thread {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.thread__reply {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.thread__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-navy);
  color: var(--color-gold);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.thread__avatar--you {
  background: var(--color-bg);
  color: var(--color-muted);
  border: 1.5px solid var(--color-border);
  font-size: .65rem;
}

.thread__content {
  flex: 1;
  background: #f8f9fb;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.thread__meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.thread__author {
  font-size: .82rem;
  font-weight: 700;
  color: var(--color-navy);
}

.thread__dept {
  font-size: .7rem;
  color: var(--color-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.thread__time {
  font-size: .7rem;
  color: var(--color-muted);
  margin-left: auto;
}

.thread__body {
  font-size: .85rem;
  line-height: 1.6;
  color: #374151;
}

.thread__compose {
  display: flex;
  gap: 12px;
  align-items: center;
}

.thread__compose-input-wrap { flex: 1; }

.thread__compose-input {
  width: 100%;
  padding: 8px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  font-size: .85rem;
  font-family: inherit;
  color: var(--color-text);
  background: #fafafa;
  transition: border-color .15s;
}

.thread__compose-input:focus {
  outline: none;
  border-color: var(--color-gold);
  background: #fff;
}

/* ── Research Updates ────────────────────────────────────────────── */
.update-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
}

.update-card__codename {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--color-gold);
  font-weight: 700;
  grid-column: 1;
}

.update-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-navy);
  grid-column: 1;
}

.update-card__pi {
  font-size: .78rem;
  color: var(--color-muted);
  grid-column: 1;
}

.update-card__status {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status--active   { background: #d1fae5; color: #065f46; }
.status--review   { background: #fef3c7; color: #92400e; }
.status--complete { background: #e0e7ff; color: #3730a3; }

.update-card__body {
  font-size: .87rem;
  line-height: 1.6;
  color: #374151;
  margin-top: 10px;
  grid-column: 1 / -1;
}

/* ── HR Portal ───────────────────────────────────────────────────── */
.hr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.hr-widget {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.hr-widget__label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.hr-widget__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-navy);
  line-height: 1;
}

.hr-widget__detail {
  font-size: .78rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.hr-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 18px;
}

.hr-section__title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.holiday-list { list-style: none; }
.holiday-list li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: .86rem;
  border-bottom: 1px solid var(--color-border);
}
.holiday-list li:last-child { border-bottom: none; }
.holiday-list .date { color: var(--color-muted); font-size: .78rem; }

.benefits-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.benefits-links a {
  font-size: .86rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Project Directory ───────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: .86rem;
}

.data-table thead {
  background: var(--color-navy);
  color: #ffffff;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  color: #374151;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f9fafb; }

/* ── Staff Directory ─────────────────────────────────────────────── */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.staff-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  text-align: center;
}

.staff-card__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-navy);
  color: var(--color-gold);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.staff-card__name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-navy);
}

.staff-card__title {
  font-size: .76rem;
  color: var(--color-muted);
  margin-top: 3px;
}

.staff-card__dept {
  font-size: .72rem;
  color: var(--color-gold);
  font-weight: 600;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.staff-card__ext {
  font-size: .76rem;
  color: var(--color-muted);
  margin-top: 8px;
}

/* ── IT Helpdesk ─────────────────────────────────────────────────── */
.ticket-form {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-bottom: 24px;
}

.ticket-form__title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .88rem;
  font-family: inherit;
  color: var(--color-text);
  background: #fafafa;
  transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-gold);
  background: #fff;
}

.form-group textarea { resize: vertical; min-height: 80px; }

.ticket-list { display: flex; flex-direction: column; gap: 14px; }

.ticket-item {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.ticket-item__id {
  font-size: .7rem;
  font-weight: 700;
  color: var(--color-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.ticket-item__body { flex: 1; }

.ticket-item__subject {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-navy);
}

.ticket-item__meta {
  font-size: .76rem;
  color: var(--color-muted);
  margin-top: 3px;
}

.ticket-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge--open       { background: #fee2e2; color: #991b1b; }
.badge--inprogress { background: #fef3c7; color: #92400e; }
.badge--resolved   { background: #d1fae5; color: #065f46; }

/* ── Auth gate notice ────────────────────────────────────────────── */
.auth-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
  color: var(--color-muted);
  text-align: center;
}

.auth-notice__icon { font-size: 2.5rem; }
.auth-notice__msg  { font-size: .95rem; }

/* ── Login page ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
}

.login-card__brand {
  text-align: center;
  margin-bottom: 30px;
}

.login-card__brand-main {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-navy);
  letter-spacing: .03em;
}

.login-card__brand-sub {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--color-gold);
  margin-top: 2px;
}

.login-card__heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.login-card__footer {
  margin-top: 20px;
  text-align: center;
  font-size: .8rem;
  color: var(--color-muted);
}

.login-card__error {
  background: #fee2e2;
  color: #991b1b;
  font-size: .82rem;
  border-radius: var(--radius);
  padding: 9px 14px;
  margin-bottom: 14px;
  display: none;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
    gap: 2px;
  }

  .sidebar__section-label { display: none; }

  .sidebar__item {
    padding: 8px 12px;
    font-size: .8rem;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius);
  }

  .sidebar__item.active {
    border-bottom-color: var(--color-gold);
    border-left-color: transparent;
  }

  .main { padding: 20px 16px; }

  .login-card { padding: 30px 24px; }
}
