/* =========================================================
   BD Career Tracker — v0.2.0
   Design: dark command-center, monospaced data, green accent
   ========================================================= */

:root {
  --bg:        #0f1410;
  --bg-panel:  #151c17;
  --bg-raised: #1c2620;
  --bg-input:  #1a211d;
  --border:    #2a3630;
  --border-md: #334039;
  --text:      #d4ddd7;
  --text-muted:#7a8f82;
  --text-dim:  #4a5e52;
  --green:     #4ade80;
  --green-dim: #1a2e1e;
  --green-mid: #166534;
  --amber:     #fbbf24;
  --amber-dim: #2d1f00;
  --blue:      #60a5fa;
  --blue-dim:  #0d1f3c;
  --red:       #f87171;
  --red-dim:   #2d0f0f;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
  --sans:      'Inter', system-ui, sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
}

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

html { font-size: 14px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---- Utility ---- */
.hidden { display: none !important; }

/* =========================================================
   AUTH GATE
   ========================================================= */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-box {
  width: 360px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  text-align: center;
}

.auth-logo { margin-bottom: 16px; }

.auth-box h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-box p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-field {
  display: flex;
  gap: 8px;
}

.auth-field input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--mono);
  outline: none;
  letter-spacing: 0.05em;
}

.auth-field input:focus { border-color: var(--green); }

.auth-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 12px;
}

/* =========================================================
   HEADER
   ========================================================= */
header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.header-nav {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-btn:hover { color: var(--text); background: var(--bg-raised); }
.nav-btn.active { color: var(--green); background: var(--green-dim); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.version {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary {
  background: var(--green);
  color: #0f1410;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--green); color: var(--green); }
.btn-secondary.btn-sm { padding: 5px 10px; font-size: 12px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--bg-raised); }

/* =========================================================
   VIEWS
   ========================================================= */
.view { min-height: calc(100vh - 52px); }
.view-inner { max-width: 1400px; margin: 0 auto; padding: 28px 24px; }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view-head h2 {
  font-size: 20px;
  font-weight: 600;
}

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

/* =========================================================
   DASHBOARD
   ========================================================= */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.dash-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-card.accent-green { border-color: var(--green-mid); }
.metric-card.accent-amber { border-color: #78450a; }
.metric-card.accent-blue  { border-color: #1e3a5f; }

.metric-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 400;
  color: var(--text);
  line-height: 1;
}

.metric-card.accent-green .metric-value { color: var(--green); }
.metric-card.accent-amber .metric-value { color: var(--amber); }
.metric-card.accent-blue  .metric-value { color: var(--blue); }

/* =========================================================
   PANELS
   ========================================================= */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.panel-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* =========================================================
   NEXT ACTIONS
   ========================================================= */
.next-actions-list { padding: 4px 0; }

.action-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.action-row:last-child { border-bottom: none; }
.action-row:hover { background: var(--bg-raised); }

.action-company {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.action-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.action-task { font-size: 13px; color: var(--text); }

.action-due {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.action-due.overdue { color: var(--red); }
.action-due.today   { color: var(--amber); }

.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--bg-raised); }

.td-company { font-weight: 600; }
.td-role    { color: var(--text-muted); font-size: 12px; }
.td-salary  { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.td-due     { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.td-action  { text-align: right; }

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  white-space: nowrap;
}

.badge-high   { background: #2d1000; color: #fb923c; border: 1px solid #78350f; }
.badge-medium { background: #1a1700; color: #facc15; border: 1px solid #713f12; }
.badge-low    { background: var(--bg-raised); color: var(--text-muted); border: 1px solid var(--border-md); }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.s-active       { background: var(--green-dim); color: var(--green); }
.s-interview    { background: var(--blue-dim); color: var(--blue); }
.s-offer        { background: #1a2d00; color: #86efac; }
.s-closed       { background: var(--bg-raised); color: var(--text-dim); }
.s-referral     { background: #1a1200; color: var(--amber); }
.s-pending      { background: #1a1a00; color: #d4d400; }
.s-neutral      { background: var(--bg-raised); color: var(--text-muted); }

.fit-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fit-num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  min-width: 26px;
}

.fit-track {
  width: 40px;
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  overflow: hidden;
}

.fit-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--green);
}

/* =========================================================
   FILTERS
   ========================================================= */
.select-filter {
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.select-filter:focus { border-color: var(--green); }

/* =========================================================
   DRAWER
   ========================================================= */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.drawer-panel {
  position: relative;
  width: 640px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dr-company {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.dr-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.drawer-meta {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  flex-shrink: 0;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.meta-value.mono { font-family: var(--mono); }

.drawer-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); }

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* Drawer sections */
.dr-section { margin-bottom: 24px; }

.dr-section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.dr-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dr-field { display: flex; flex-direction: column; gap: 2px; }
.dr-field-label { font-size: 11px; color: var(--text-dim); }
.dr-field-value { font-size: 13px; color: var(--text); }
.dr-field-value.mono { font-family: var(--mono); }

.dr-notes {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

/* Activity list */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-body { flex: 1; }
.activity-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  font-weight: 500;
}

.activity-summary { font-size: 13px; font-weight: 500; margin: 2px 0; }
.activity-detail  { font-size: 12px; color: var(--text-muted); }
.activity-meta    { font-size: 11px; color: var(--text-dim); margin-top: 4px; font-family: var(--mono); }

/* Contact cards in drawer */
.contact-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.contact-name { font-weight: 600; font-size: 14px; }
.contact-title { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.contact-meta  { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.contact-tag   { font-size: 11px; color: var(--text-dim); background: var(--bg-panel); padding: 2px 8px; border-radius: 4px; }

/* History list */
.history-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.history-item:last-child { border-bottom: none; }
.history-arrow { color: var(--green); }
.history-date  { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* =========================================================
   MODALS
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.modal-box {
  position: relative;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  background: var(--bg-panel);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  overflow-y: auto;
}

.modal-box-sm { width: 440px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 1;
}

.modal-head h3 { font-size: 15px; font-weight: 600; }

.modal-form { padding: 20px 24px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* =========================================================
   FORMS
   ========================================================= */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row:last-child { margin-bottom: 0; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.req { color: var(--red); }

input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
}

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

select option { background: var(--bg-panel); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .drawer-panel { width: 100vw; }
  .action-row { grid-template-columns: 1fr 1fr; }
  .action-due { display: none; }
}

@media (max-width: 600px) {
  header { padding: 0 14px; gap: 12px; }
  .header-brand span { display: none; }
  .view-inner { padding: 16px 14px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .metric-value { font-size: 28px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .dr-field-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   LOGIN FORM
   ========================================================= */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.login-field input {
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  width: 100%;
}

.login-field input:focus { border-color: var(--green); }
