/* OEG design system — mirrors oegglobal.com
   primary blue hsl(207 68% 32%) #1a5789, navy hsl(212 55% 14%) #102237 */
:root {
  --primary: hsl(207, 68%, 32%);
  --primary-hover: hsl(207, 68%, 26%);
  --navy: hsl(212, 55%, 14%);
  --foreground: hsl(210, 25%, 15%);
  --muted: hsl(210, 10%, 50%);
  --border: hsl(210, 15%, 90%);
  --secondary: hsl(210, 20%, 96%);
  --accent: hsl(207, 45%, 94%);
  --success: hsl(150, 55%, 32%);
  --warning: hsl(38, 90%, 42%);
  --danger: hsl(0, 70%, 45%);
  --radius: 0.5rem;
  --font-heading: "Plus Jakarta Sans", sans-serif;
  --font-body: "Inter", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--foreground);
  background: #fff;
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--foreground); }
h1 { font-size: 1.7rem; margin: 1.2rem 0 0.6rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1100px, 100% - 2.5rem); margin-inline: auto; }
main.container { flex: 1; padding-bottom: 3rem; }

/* Header / footer */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none !important; }
.brand-mark {
  font-family: var(--font-heading); font-weight: 800; color: #fff;
  background: var(--primary); border-radius: var(--radius); padding: 0.25rem 0.55rem;
}
.brand-logo { height: 38px; width: auto; display: block; }
.brand-text { font-family: var(--font-heading); font-weight: 700; color: var(--foreground); }
/* Header actions: profile chip + hamburger, each with a dropdown */
.header-actions { display: flex; align-items: center; gap: 0.6rem; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 220px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 34, 55, 0.14);
  padding: 0.35rem; display: flex; flex-direction: column;
}
.dropdown-menu a {
  display: block; padding: 0.55rem 0.8rem; border-radius: calc(var(--radius) - 2px);
  color: var(--foreground); font-size: 0.93rem; font-weight: 500;
  text-decoration: none !important;
}
.dropdown-menu a:hover { background: var(--accent); color: var(--primary); }
.dropdown-header {
  padding: 0.55rem 0.8rem 0.5rem; border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem; line-height: 1.35;
}

.profile-chip {
  display: flex; align-items: center; gap: 0.45rem;
  background: var(--secondary); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.25rem 0.7rem 0.25rem 0.3rem;
  font: inherit; font-size: 0.9rem; font-weight: 500; color: var(--foreground);
  cursor: pointer;
}
.profile-chip:hover { border-color: var(--primary); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; font-family: var(--font-heading); font-weight: 700; font-size: 0.8rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.caret { color: var(--muted); font-size: 0.7rem; }

.hamburger {
  width: 42px; height: 38px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
}
.hamburger span {
  display: block; width: 18px; height: 2px; background: var(--foreground);
  border-radius: 2px; transition: transform 0.15s ease, opacity 0.15s ease;
}
.hamburger:hover { border-color: var(--primary); }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.site-footer {
  background: var(--navy); color: #fff; font-size: 0.85rem;
  padding: 1.2rem 0; opacity: 0.95; margin-top: 2rem;
}

/* Section bars — echo the paper form's black section headers */
.section {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); margin: 1.2rem 0; overflow: hidden;
}
.section > .section-title {
  background: var(--navy); color: #fff;
  font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem;
  padding: 0.55rem 1rem; letter-spacing: 0.02em;
}
.section > .section-body { padding: 1rem; }
.section-hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.7rem; font-style: italic; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.65rem; text-align: left; vertical-align: top; }
th { background: var(--secondary); font-weight: 600; }
.table-wrap { overflow-x: auto; }
tr:hover td { background: hsl(207, 45%, 98%); }

/* Forms */
label { display: block; font-weight: 500; font-size: 0.88rem; margin-bottom: 0.25rem; }
input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
  width: 100%; padding: 0.5rem 0.65rem; font: inherit; font-size: 0.92rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: var(--foreground);
}
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary);
}
.field { margin-bottom: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem;
  padding: 0.55rem 1.1rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none !important;
  background: var(--primary); color: #fff; letter-spacing: 0.02em;
}
.btn:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-success { background: var(--success); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-ai {
  background: linear-gradient(120deg, var(--primary), hsl(230, 55%, 40%));
}
.btn-ai:hover { filter: brightness(1.1); background: linear-gradient(120deg, var(--primary), hsl(230, 55%, 40%)); }
.btn[disabled] { opacity: 0.55; cursor: wait; }

/* Cards, badges, flash */
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.2rem; background: #fff;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.stat-value { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  border-radius: 999px; padding: 0.15rem 0.6rem; white-space: nowrap;
}
.badge-draft { background: var(--secondary); color: var(--muted); }
.badge-submitted { background: hsl(38, 90%, 92%); color: var(--warning); }
.badge-in_review { background: var(--accent); color: var(--primary); }
.badge-reviewed { background: hsl(230, 55%, 93%); color: hsl(230, 55%, 40%); }
.badge-approved { background: hsl(150, 55%, 92%); color: var(--success); }

.flash { border-radius: var(--radius); padding: 0.65rem 1rem; margin: 0.9rem 0; font-size: 0.9rem; }
.flash-success { background: hsl(150, 55%, 94%); color: var(--success); border: 1px solid hsl(150, 55%, 80%); }
.flash-error { background: hsl(0, 70%, 96%); color: var(--danger); border: 1px solid hsl(0, 70%, 85%); }
.flash-message, .flash-info { background: var(--accent); color: var(--primary); border: 1px solid var(--border); }

/* AI panels */
.ai-panel {
  border: 1px solid hsl(230, 45%, 85%); border-radius: var(--radius);
  background: linear-gradient(180deg, hsl(230, 60%, 98%), #fff);
  padding: 1rem 1.2rem; margin-top: 0.8rem;
}
.ai-panel h4 { margin: 0 0 0.5rem; }
.ai-tag {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: hsl(230, 55%, 40%); text-transform: uppercase;
}
.score-pill {
  display: inline-block; min-width: 2.6rem; text-align: center;
  font-weight: 700; border-radius: 999px; padding: 0.1rem 0.5rem; color: #fff;
}
.score-high { background: var(--success); }
.score-mid { background: var(--warning); }
.score-low { background: var(--danger); }

/* AI interview chat */
.chat-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--secondary); padding: 1rem;
  max-height: 460px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.chat-msg {
  max-width: 78%; padding: 0.55rem 0.85rem; border-radius: 0.75rem;
  font-size: 0.93rem; white-space: pre-wrap; line-height: 1.45;
}
.chat-assistant { background: #fff; border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 0.2rem; }
.chat-user { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 0.2rem; }
.chat-error { background: hsl(0, 70%, 96%); color: var(--danger); align-self: center; }
.chat-input-row { display: flex; gap: 0.6rem; margin-top: 0.8rem; align-items: flex-end; }
.chat-input-row textarea { flex: 1; }

/* Login */
.login-wrap { max-width: 420px; margin: 8vh auto; }
.login-hero {
  background: var(--navy); color: #fff; border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.6rem 1.5rem;
}
.login-logo-wrap {
  display: inline-block; background: #fff; border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
}
.login-logo { height: 44px; width: auto; display: block; }
.login-hero h1 { color: #fff; margin: 0.8rem 0 0; font-size: 1.35rem; }
.login-hero p { margin: 0.4rem 0 0; opacity: 0.8; font-size: 0.9rem; }
.login-body { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 1.5rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; }
.row-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .site-header, .site-footer, .btn, .flash { display: none !important; }
}

/* ------------------------------------------------------ mobile (≤768px) */
@media (max-width: 768px) {
  .container { width: 100%; padding-inline: 0.9rem; }
  h1 { font-size: 1.3rem; }

  /* Header stays one compact row: logo left, profile + hamburger right */
  .header-inner { height: 56px; gap: 0.5rem; }
  .brand-logo { height: 28px; }
  .brand-text { font-size: 0.9rem; }
  .profile-name { display: none; }
  .dropdown-menu { min-width: 200px; }

  /* Tables scroll horizontally instead of squishing */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap > table { min-width: 540px; }
  th, td { padding: 0.4rem 0.5rem; font-size: 0.85rem; }

  .section > .section-title { font-size: 0.85rem; padding: 0.5rem 0.75rem; }
  .section > .section-body { padding: 0.75rem; }

  /* Inputs: 16px prevents iOS auto-zoom on focus */
  input[type=text], input[type=email], input[type=password], input[type=date],
  select, textarea { font-size: 16px; }

  /* Full-width action buttons for thumb-friendly taps */
  .row-actions { flex-direction: column; align-items: stretch; }
  .row-actions .btn, .row-actions form { width: 100%; }
  .row-actions form .btn { width: 100%; }
  .btn { justify-content: center; }

  /* Chat */
  .chat-box { max-height: 55vh; padding: 0.7rem; }
  .chat-msg { max-width: 92%; font-size: 0.9rem; }
  .chat-input-row { flex-direction: column; align-items: stretch; }
  .chat-input-row .btn { width: 100%; }

  /* Login */
  .login-wrap { margin: 4vh auto; }
  .login-hero, .login-body { padding: 1.1rem 1rem; }

  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.4rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .card-grid { grid-template-columns: 1fr; }
  .brand-text { display: none; }
}
