* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f8f5;
  --ink: #15211f;
  --muted: #66736f;
  --line: #d9e1dc;
  --panel: #ffffff;
  --brand: #12615d;
  --brand-dark: #0f4543;
  --accent: #c26a2e;
  --danger: #b42318;
  --shadow: 0 14px 36px rgba(24, 45, 40, 0.08);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, "Malgun Gothic", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.workspace-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.page-header,
.dashboard-header,
.header-actions,
.form-actions,
.panel-title-row,
.board-toolbar,
.row-actions,
.automation-panel,
.workboard-hero,
.dashboard-tabs {
  display: flex;
  align-items: center;
}

.dashboard-header {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.dashboard-tabs {
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 5px;
}

.tab-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 18px;
  font-weight: 900;
}

.tab-button.is-active {
  background: var(--brand);
  color: #ffffff;
}

.view-panel[hidden] {
  display: none;
}

.workboard-hero {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: var(--shadow);
}

.workboard-hero h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.work-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.work-column {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 12px;
}

.work-column h3 {
  margin: 0 0 12px;
  color: var(--brand-dark);
  font-size: 15px;
}

.work-card {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  box-shadow: 0 8px 18px rgba(24, 45, 40, 0.04);
}

.work-card strong {
  line-height: 1.35;
}

.work-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.page-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 10px;
  font-size: 17px;
}

.header-actions,
.form-actions,
.row-actions {
  gap: 8px;
}

.primary-button,
.ghost-button,
.row-actions button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.dashboard-button {
  min-height: 38px;
  border: 1px solid #000000;
  border-radius: 8px;
  background: #000000;
  color: #ffffff;
  padding: 0 13px;
  font-weight: 800;
}

.dashboard-button:hover {
  background: #111111;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.sync-local {
  background: #f0eff4;
  color: #5c5870;
}

.sync-pending {
  background: #fff5db;
  color: #8a5a00;
}

.sync-ok {
  background: #e8f6ed;
  color: #19703a;
}

.sync-warn,
.sync-error {
  background: #fdecec;
  color: var(--danger);
}

.ghost-button,
.row-actions button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--brand-dark);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-panel {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  box-shadow: 0 8px 20px rgba(24, 45, 40, 0.04);
}

.metric-panel-wide {
  grid-column: span 2;
}

.metric-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-panel strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 30px;
  line-height: 1;
}

.metric-panel small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.control-band {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.task-form,
.board-section,
.automation-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-form {
  padding: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.name-field {
  grid-column: span 2;
}

.notice-field {
  grid-column: span 2;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd7d1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 116px;
  resize: vertical;
  padding: 11px;
  line-height: 1.5;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.panel-title-row {
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h2 {
  margin-bottom: 0;
}

.helper-text {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.board-toolbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.search-wrap {
  position: relative;
  flex: 1;
}

.search-wrap span {
  position: absolute;
  left: 12px;
  top: 50%;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-wrap input {
  padding-left: 36px;
}

.board-toolbar select {
  width: 180px;
}

.status-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 720px;
}

.status-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-dark);
  padding: 0 11px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-tab.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.status-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  background: rgba(18, 97, 93, 0.1);
  color: inherit;
  font-size: 12px;
}

.status-tab.is-active span {
  background: rgba(255, 255, 255, 0.2);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f9fbf8;
  color: #52615d;
  font-size: 13px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

td strong {
  display: block;
  max-width: 420px;
  line-height: 1.4;
}

.task-title-wrap {
  display: grid;
  gap: 9px;
  min-width: 470px;
}

.task-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.task-name-line strong {
  display: inline;
  max-width: 520px;
}

.task-description {
  max-width: 680px;
  border-left: 3px solid #97b9b4;
  background: #f4faf8;
  padding: 8px 10px;
  color: #3d4c47;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
}

.urgency-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.urgency-green {
  border: 1px solid #9bd3ad;
  background: #e8f6ed;
  color: #176f38;
}

.urgency-orange {
  border: 1px solid #efc27b;
  background: #fff2dc;
  color: #9a5600;
}

.urgency-red {
  border: 1px solid #efa29b;
  background: #fdecec;
  color: var(--danger);
}

.task-note-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: 620px;
}

.task-note span {
  margin-bottom: 4px;
  font-size: 12px;
}

.task-note textarea {
  min-height: 58px;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.task-note-owner span,
.task-note-owner textarea {
  color: var(--danger);
}

.task-note-owner textarea {
  border-color: #e8aaa3;
  background: #fffafa;
}

.task-note-manager span,
.task-note-manager textarea {
  color: #151515;
}

.task-note-manager textarea {
  border-color: #b9c5bf;
  background: #ffffff;
}

.number-cell {
  width: 58px;
  color: var(--muted);
  font-weight: 800;
}

.amount-cell {
  color: var(--brand-dark);
  font-weight: 900;
  white-space: nowrap;
}

.due-label {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.row-status-select {
  width: 118px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0 28px 0 11px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.row-status-select:focus {
  outline: 2px solid rgba(18, 97, 93, 0.25);
  outline-offset: 2px;
}

.status-ready {
  background: #edf3ff;
  color: #2555a6;
}

.status-review {
  background: #fff5db;
  color: #8a5a00;
}

.status-submitted {
  background: #e8f4f3;
  color: var(--brand-dark);
}

.status-pass {
  background: #e8f6ed;
  color: #19703a;
}

.status-fail,
.status-unavailable {
  background: #fdecec;
  color: var(--danger);
}

.status-hold {
  background: #f0eff4;
  color: #5c5870;
}

.notice-cell a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.notice-cell a:hover {
  text-decoration: underline;
}

.notice-cell small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.row-actions button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 13px;
}

.empty-state {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.automation-panel {
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  padding: 14px;
}

.automation-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar-controls,
.page-size-control,
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-size-control span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.page-size-control select,
.pagination-controls .page-button {
  min-height: 32px;
}

.pagination-controls #pageInfo {
  min-width: 120px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-panel-wide {
    grid-column: span 2;
  }

  .control-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .workspace-shell {
    padding: 18px;
  }

  .page-header,
  .dashboard-header,
  .workboard-hero,
  .automation-panel,
  .board-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .work-summary-grid,
  .workboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-panel-wide {
    grid-column: span 2;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .name-field,
  .notice-field {
    grid-column: span 2;
  }

  .board-toolbar select {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .toolbar-controls,
  .page-size-control,
  .pagination-controls {
    width: 100%;
  }

  .toolbar-controls {
    justify-content: stretch;
  }

  .page-size-control select,
  .toolbar-controls select,
  .pagination-controls .page-button {
    flex: 1;
  }

  .status-tabs {
    width: 100%;
    max-width: none;
  }

  .status-tab {
    flex: 1 0 calc(50% - 6px);
  }

  .task-note-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 27px;
  }

  .summary-grid,
  .work-summary-grid,
  .workboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-panel-wide,
  .name-field,
  .notice-field {
    grid-column: auto;
  }

  .header-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}


.toolbar-controls,
.page-size-control,
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-size-control span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.page-size-control select,
.pagination-controls .page-button {
  min-height: 32px;
}

.pagination-controls #pageInfo {
  min-width: 120px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.recommendation-page {
  display: grid;
  gap: 14px;
}

.recommendation-panel,
.recommendation-results,
.source-manager-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.source-manager-panel[hidden] {
  display: none;
}

.recommendation-panel .panel-title-row,
.recommendation-results .panel-title-row,
.source-manager-panel .panel-title-row {
  justify-content: space-between;
  gap: 14px;
}

.recommendation-profile {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
}

.recommendation-profile label,
.recommendation-profile-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.recommendation-profile input,
.recommendation-profile-grid input,
.recommendation-profile-grid textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 0 12px;
  color: var(--ink);
}

.recommendation-profile-grid textarea {
  min-height: 120px;
  padding-top: 10px;
  line-height: 1.5;
  resize: vertical;
}

.recommendation-company-profile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.recommendation-company-profile summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.recommendation-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.recommendation-profile-grid .wide-field {
  grid-column: 1 / -1;
}

.recommendation-logic-note,
.recommendation-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.recommendation-logic-note {
  border-left: 3px solid var(--brand);
  background: #f3f8f6;
  padding: 10px 12px;
  font-weight: 700;
}

.recommendation-list {
  display: grid;
  gap: 10px;
}

.recommendation-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 12px;
}

.recommendation-fit {
  border-left: 4px solid var(--brand);
}

.recommendation-maybe {
  border-left: 4px solid #c26a2e;
}

.recommendation-no {
  border-left: 4px solid #8b949e;
  opacity: 0.72;
}

.recommendation-score {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
}

.recommendation-maybe .recommendation-score {
  background: #c26a2e;
}

.recommendation-no .recommendation-score {
  background: #697084;
}

.recommendation-score span {
  display: block;
  font-size: 11px;
}

.recommendation-body {
  min-width: 0;
}

.recommendation-topline,
.recommendation-reasons,
.recommendation-actions,
.recommendation-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.recommendation-topline {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.recommendation-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
  line-height: 1.35;
}

.recommendation-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.recommendation-reasons span {
  border: 1px solid #cfd9d4;
  border-radius: 999px;
  background: #ffffff;
  padding: 4px 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.fit-badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

.fit-fit {
  background: #e8f6ed;
  color: #19703a;
}

.fit-maybe {
  background: #fff5db;
  color: #8a5a00;
}

.fit-no {
  background: #f0eff4;
  color: #5c5870;
}

.recommendation-maybe .recommendation-reasons span {
  border-color: #ead7a9;
  background: #fffaf0;
  color: #7a5415;
}

.recommendation-no .recommendation-reasons span {
  border-color: #d7dce1;
  background: #f4f6f8;
  color: #52616b;
}

.recommendation-actions {
  justify-content: flex-end;
  min-width: 170px;
}

.recommendation-actions a {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
}

.recommendation-actions button:disabled {
  cursor: default;
  opacity: 0.58;
}

.recommendation-actions .reject-button {
  border-color: #d8b8b8;
  color: #9b2f2f;
}

.recommendation-actions .reject-button:hover {
  background: #fff5f5;
}

.source-add-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.source-add-panel summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.source-manager-form {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1.4fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.source-manager-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.source-manager-form input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 0 12px;
  color: var(--ink);
}

.source-manager-list {
  display: grid;
  gap: 8px;
}

.source-site-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  padding: 12px;
}

.source-site-card div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.source-site-card strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.source-site-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-site-card a {
  overflow-wrap: anywhere;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.source-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.source-status.is-ok {
  border-color: #b8d6cc;
  background: #ecf8f4;
  color: var(--brand-dark);
}

.source-status.is-empty {
  border-color: #d8d2bf;
  background: #fffaf0;
  color: #7a5415;
}

.source-status.is-pending {
  border-color: #d7dce1;
  background: #f4f6f8;
  color: #52616b;
}

@media (max-width: 720px) {
  .toolbar-controls,
  .page-size-control,
  .pagination-controls {
    width: 100%;
  }

  .toolbar-controls {
    justify-content: stretch;
  }

  .page-size-control select,
  .toolbar-controls select,
  .pagination-controls .page-button {
    flex: 1;
  }

  .recommendation-profile,
  .recommendation-profile-grid,
  .recommendation-card,
  .source-manager-form,
  .source-site-card {
    grid-template-columns: 1fr;
  }

  .recommendation-panel .panel-title-row,
  .recommendation-results .panel-title-row,
  .source-manager-panel .panel-title-row,
  .recommendation-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .source-status {
    justify-self: start;
    white-space: normal;
  }

  .recommendation-score {
    min-height: 44px;
  }
}
