:root {
  --bg: #f2efe9;
  --card: #ffffff;
  --text: #2b2118;
  --muted: #7a6a5d;
  --accent: #a68064;
  --accent-2: #b08a63;
  --danger: #c44536;
  --ok: #2f7d4b;
  --line: #e7d8c8;
  --shadow: 0 14px 40px rgba(43, 33, 24, 0.08);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

body.detail-open {
  overflow: hidden;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.stats-strip {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.stats-strip-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.85rem max(1rem, env(safe-area-inset-right)) 1.05rem max(1rem, env(safe-area-inset-left));
  box-sizing: border-box;
}

body.detail-open .stats-strip {
  display: none;
}

.topbar-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.05rem max(1rem, env(safe-area-inset-right)) 1.05rem max(1rem, env(safe-area-inset-left));
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
  justify-content: flex-start;
  justify-self: start;
  grid-column: 1;
}

.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.nav-cluster {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: center;
  justify-self: center;
  grid-column: 2;
  min-width: 0;
}

.topbar-tools {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-self: end;
  grid-column: 3;
}

/* Same height, padding rhythm, and flex box model as real buttons */
.topbar-tools > .btn,
.topbar-tools > label.btn,
.topbar-inner .nav-cluster > .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.625rem;
  padding: 0 0.95rem;
  font-size: 0.875rem;
  line-height: 1.2;
  box-sizing: border-box;
}

.topbar-tools > .btn.btn-primary {
  padding: 0 1.2rem;
  min-height: 2.625rem;
}

.topbar-inner .nav-cluster > .btn.secondary.nav-active {
  border-color: rgba(166, 128, 100, 0.55);
  background: rgba(166, 128, 100, 0.1);
  color: var(--text);
}

.btn-compact {
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
}

.btn.ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 0.45rem 0.55rem;
}

.btn.ghost:hover {
  border-color: var(--line);
  color: var(--text);
}

.btn-primary {
  border-radius: 999px;
  padding: 0.72rem 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 26px rgba(166, 128, 100, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.btn-primary .plus {
  margin-right: 0.35rem;
  font-weight: 800;
}

.btn-label-short {
  display: none;
}

@media (max-width: 720px) {
  .topbar-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    grid-column: auto;
    justify-self: auto;
  }

  .nav-cluster {
    grid-column: auto;
    justify-self: center;
    width: 100%;
    justify-content: center;
  }

  .topbar-tools {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
    justify-content: flex-end;
  }

  .btn-label-full {
    display: none;
  }

  .btn-label-short {
    display: inline;
  }
}

#importInput {
  display: none;
}

.layout {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  padding: 1.15rem;
  max-width: none;
  width: 100%;
  margin: 0;
}

.layout.mode-home {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: calc(100vh - 1px);
  height: auto;
  padding: 0.75rem clamp(0.75rem, 2vw, 1.5rem) 1rem;
  box-sizing: border-box;
}

body.subpage-open .layout {
  grid-template-columns: 1fr;
  max-width: none;
  padding: 1rem 1.25rem;
}

.layout.mode-subpage {
  display: grid;
  grid-template-columns: 1fr;
  height: auto;
  min-height: calc(100vh - 1px);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.05rem;
  box-shadow: var(--shadow);
}

.layout.mode-home #settingsBar.panel {
  flex: 0 0 auto;
  padding: 0.65rem 0.85rem;
}

.layout.mode-home #settingsBar.panel h2 {
  font-size: 1.05rem;
}

.layout.mode-home #settingsBar.panel .helper {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
}

.panel.full-width {
  grid-column: 1 / -1;
}

.inline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hidden {
  display: none !important;
}

.view {
  display: block;
  width: 100%;
  min-height: 0;
}

.home-workspace {
  flex: 1 1 auto;
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  grid-template-rows: minmax(360px, auto) minmax(320px, auto);
  grid-template-areas:
    "dash add"
    "dash interviews";
  gap: 0.75rem;
}

.home-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.85rem;
}

.home-panel h2 {
  flex: 0 0 auto;
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.home-panel-dashboard {
  grid-area: dash;
}

.home-panel-add {
  grid-area: add;
}

.home-panel-interviews {
  grid-area: interviews;
}

.home-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.15rem;
  max-height: 34vh;
}

.home-dashboard-split {
  flex: 1 1 auto;
  min-height: 0;
}

.home-dashboard-split > .home-scroll {
  min-height: 0;
}

.layout.mode-home .stats {
  flex: 0 0 auto;
  margin-bottom: 0.5rem;
}

.layout.mode-home .split {
  min-height: 0;
}

@media (max-width: 1100px) {
  .home-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "dash"
      "add"
      "interviews";
  }

  .layout.mode-home {
    height: auto;
    min-height: calc(100vh - 1px);
  }

  .home-scroll {
    max-height: none;
  }
}

.full-page-view:not(.hidden) {
  display: block !important;
}

.full-page-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: auto;
  z-index: 30;
  background: var(--bg);
  padding: 5.75rem 1.5rem 2rem;
}

.full-page-view .panel {
  max-width: none;
  width: 100%;
  margin: 0;
}

.full-bleed {
  grid-column: 1 / -1;
}

.detail-panel {
  min-height: calc(100vh - 2.5rem);
}

.detail-panel .form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

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

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid textarea {
  min-height: 85px;
  grid-column: 1 / -1;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #fff;
}

label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.93rem;
}

/* Form labels use grid; button-styled file labels must not inherit grid layout */
label.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.btn.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn:not(.btn-primary):hover {
  filter: brightness(0.98);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
}

.stat .label {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat .value {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--serif);
}

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

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
  max-height: 62vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

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

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

th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.pill {
  border-radius: 999px;
  padding: 0.25rem 0.62rem;
  font-size: 0.8rem;
  border: 1px solid var(--line);
}

.pill.warn {
  color: #fff;
  background: var(--danger);
  border-color: transparent;
}

.pill.ok {
  color: #fff;
  background: var(--ok);
  border-color: transparent;
}

.helper {
  color: var(--muted);
}

.agent-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.7rem 0;
}

.action-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.update-cell {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.update-cell select {
  min-width: 120px;
}

.row-details {
  margin-top: 0.35rem;
  color: var(--muted);
}

.row-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent);
}

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

.layout.mode-pipeline {
  padding-top: 0.5rem;
}

.pipeline-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pipeline-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1rem;
}

.pipeline-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
  min-height: 104px;
}

.pipeline-stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.pipeline-stat-value {
  margin-top: 0.45rem;
  font-size: clamp(1.85rem, 3.2vw, 2.35rem);
  font-weight: 700;
  font-family: var(--serif);
  color: var(--text);
  line-height: 1.05;
}

@media (max-width: 980px) {
  .pipeline-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .pipeline-stats {
    grid-template-columns: 1fr;
  }
}

.pipeline-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

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

.pipeline-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pipeline-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.65rem;
}

.pipeline-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.pipeline-search {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pipeline-search input {
  min-width: 220px;
}

.pipeline-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.pipeline-column {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.65rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.column-head {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.35rem 0.25rem 0.5rem;
}

.column-title {
  font-weight: 700;
}

.column-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.column-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.25rem;
  overflow: auto;
}

.column-add {
  margin-top: 0.35rem;
  width: 100%;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot-grey {
  background: #c4c4c4;
}
.dot-orange {
  background: #f0a045;
}
.dot-green {
  background: #3cb878;
}

.job-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.65rem 0.7rem;
  background: #fffdf9;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.job-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(43, 33, 24, 0.08);
}

.job-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.job-card-title {
  font-weight: 650;
  font-size: 0.95rem;
}

.card-meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.card-next {
  margin-top: 0.45rem;
  font-size: 0.85rem;
  color: var(--text);
}

.card-next-arrow {
  color: var(--accent-2);
  margin-right: 0.15rem;
}

.empty-column {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.35rem;
}

.pipeline-aside {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aside-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.reminder-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0.35rem;
}

.reminder-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.reminder-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  background: #fffdf9;
}

.reminder-item.done span {
  text-decoration: line-through;
  color: var(--muted);
}

.reminder-row {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  font-size: 0.9rem;
}

.reminder-delete {
  padding: 0.35rem 0.55rem;
}

.snippet-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.snippet-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.snippet-rating {
  margin-left: 0.35rem;
  color: #c49a3c;
  font-size: 0.85rem;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.25rem 0 0.5rem;
}

@media (max-width: 1100px) {
  .pipeline-shell {
    grid-template-columns: 1fr;
  }

  .pipeline-board {
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    overflow: visible;
  }

  .pipeline-column {
    min-height: auto;
  }
}
