/* App chrome. None of this reaches the PDF - see resume.css @media print. */

* {
  box-sizing: border-box;
}

:root {
  --bg: #f2f3f5;
  --panel: #ffffff;
  --line: #e2e4e8;
  --text: #1c1e21;
  --muted: #6b7280;
  --accent: #1f3a52;
  --accent-hover: #2b4f6d;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --ok: #065f46;
  --ok-bg: #ecfdf5;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 14px;
}

.app {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: 100vh;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.panel {
  min-height: 0;
}

/* ---------------- Input panel ---------------- */

.panel-input {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Row one: the title, with the signed-in address pushed to the far edge. */
.panel-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

/* Session controls sit apart from the app's own actions on purpose - a muted
   Log out next to three underlined links reads as a fourth link otherwise. */
.session {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.link-btn.subtle {
  color: var(--muted);
}

.panel-head h1 {
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.01em;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cli-status {
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.45;
  word-break: break-word;
}

.cli-status.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.cli-status.bad {
  background: var(--danger-bg);
  color: var(--danger);
}

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

.field-grow {
  flex: 1;
  min-height: 220px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select,
textarea {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  width: 100%;
}

select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 200px;
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
}

.paste-box {
  min-height: 130px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  margin: 8px 0;
}

/* ---------------- Tabs ---------------- */

.tabs {
  display: flex;
  gap: 4px;
  background: #eef0f3;
  padding: 3px;
  border-radius: 7px;
}

.tab {
  flex: 1;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted);
}

.tab.is-active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ---------------- Buttons ---------------- */

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

.btn:hover:not(:disabled) {
  background: #f7f8f9;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.5;
}

.hint code {
  background: #eef0f3;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11.5px;
}

/* ---------------- Validation report ---------------- */

.report:empty {
  display: none;
}

.report {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-block {
  font-size: 12.5px;
  border-radius: 6px;
  padding: 9px 11px;
  line-height: 1.5;
}

.report-block h3 {
  margin: 0 0 5px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-block ul {
  margin: 0;
  padding-left: 16px;
}

.report-block li + li {
  margin-top: 3px;
}

.report-block.errors {
  background: var(--danger-bg);
  color: var(--danger);
}

.report-block.warnings {
  background: var(--warn-bg);
  color: var(--warn);
}

.report-block.stats {
  background: #f5f6f8;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
}

.stat-grid .val {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

.stat-grid .val.bad {
  color: var(--danger);
}

/* ---------------- Preview panel ---------------- */

.panel-preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.preview-head .btn {
  width: auto;
  flex: 0 0 auto;
}

.preview-meta {
  font-size: 12.5px;
  color: var(--muted);
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 26px 22px 60px;
  display: flex;
  justify-content: center;
}

#print-root {
  width: 100%;
  max-width: 8.5in;
  min-height: 11in;
  align-self: flex-start;
}

.empty-state {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 44ch;
  margin: 60px auto;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

/* Busy state */

.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

/* ---------------- Profile editor ---------------- */

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.field-actions {
  display: flex;
  gap: 10px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.overlay[hidden] {
  display: none;
}

.dialog {
  background: var(--panel);
  border-radius: 10px;
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
}

.dialog-head,
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
}

.dialog-head {
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
}

.dialog-head h2 {
  margin: 0;
  font-size: 16px;
}

.dialog-foot {
  border-top: 1px solid var(--line);
}

.dialog-foot .spacer {
  flex: 1;
}

.dialog-foot .btn {
  width: auto;
}

.icon-btn {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.icon-btn:hover {
  color: var(--text);
}

.dialog-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.form-section h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.f {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}

.f em {
  font-style: normal;
  opacity: 0.75;
}

.f input,
.f select {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  width: 100%;
}

.f input:focus,
.f select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

@media (max-width: 620px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rows:empty {
  display: none;
}

.row {
  display: grid;
  gap: 8px;
  align-items: end;
  padding: 9px;
  background: #f7f8f9;
  border-radius: 7px;
}

.row-education {
  grid-template-columns: 1.4fr 1.4fr 0.9fr auto;
}

.row-experience {
  /* company · role · period · location · level · remove */
  grid-template-columns: 1fr 1fr 0.85fr 0.9fr 0.62fr auto;
}

.row-skill {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 6px 8px;
}

/* Skill groups are short strings - two per line keeps the dialog compact. */
#rows-skill {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 620px) {
  #rows-skill {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .row-education,
  .row-experience {
    grid-template-columns: 1fr 1fr;
  }
}

.row-remove {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 7px 10px;
  height: 33px;
}

.row-remove:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.row-empty {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  font-style: italic;
}

.btn-danger {
  color: var(--danger);
  border-color: #f3c6c2;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-bg);
}

#editor-errors ul {
  margin: 0;
  padding-left: 16px;
}

/* ---------------- History ---------------- */

.field-label .opt {
  font-style: normal;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.8;
}

input[type='text'] {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  width: 100%;
}

input[type='text']:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.search {
  font-size: 13.5px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-item:hover {
  border-color: #c9ced6;
}

.hi-main {
  min-width: 0;
}

.hi-company {
  font-weight: 600;
  font-size: 14px;
}

.hi-role {
  font-weight: 400;
  color: var(--muted);
}

.hi-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.hi-jd {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hi-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.hi-actions .btn {
  width: auto;
  padding: 6px 11px;
  font-size: 12.5px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  vertical-align: 1px;
  margin-left: 6px;
}

.pill-exported {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill-issues {
  background: var(--danger-bg);
  color: var(--danger);
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 30px 10px;
  line-height: 1.6;
}

/* ---------------- Application questions ---------------- */

.dialog-wide {
  width: min(860px, 100%);
}

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

.q-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.q-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.q-item textarea {
  min-height: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

/*
 * Specificity note: `.q-item textarea` above would out-rank a bare `.q-a`,
 * so these are qualified. Without it the answer box collapses to a few lines
 * and you scroll a cover letter through a slot.
 */
.q-item .q-q {
  min-height: 56px;
}

.q-item .q-a {
  min-height: 190px;
  background: #fbfcfd;
}

.q-answer {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.q-answer[hidden] {
  display: none;
}

.q-answer-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.q-copy {
  width: auto;
  padding: 5px 10px;
  font-size: 12.5px;
}

.q-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  padding: 24px 4px;
  text-align: center;
}

.pill-answers {
  background: #eef2ff;
  color: #3730a3;
}

/* ---------------- Welcome + sign-in ---------------- */

/* These two pages replace the .app grid entirely: one centred card, no panels. */
body.gate {
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.gate-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.gate-lead {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.gate-form {
  display: grid;
  gap: 14px;
  text-align: left;
}

/* .btn is width:100%, but an <a> needs the box treatment to match. */
.gate-action {
  display: block;
  margin-top: 6px;
  text-decoration: none;
  text-align: center;
}

.gate-note {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.gate-note a {
  color: var(--muted);
}

/* Signed-in address in the panel header, next to the Log out link. */
.who {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
