:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #fffaf0;
  --surface-2: #f0f7f4;
  --ink: #18221f;
  --muted: #61706a;
  --line: #d9ded5;
  --accent: #1d7f70;
  --accent-2: #a25c25;
  --danger: #b93a3a;
  --good: #146b45;
  --shadow: 0 18px 48px rgba(28, 38, 34, 0.12);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.65), 0 18px 48px rgba(28, 38, 34, 0.14);
  --lift: 0 16px 36px rgba(28, 38, 34, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  position: relative;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 14% 9%, rgba(29, 127, 112, 0.13), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(162, 92, 37, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(240, 247, 244, 0.54));
  content: "";
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(29, 127, 112, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 127, 112, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.62), transparent 78%);
  pointer-events: none;
  content: "";
}

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

button {
  position: relative;
  overflow: hidden;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfaf6);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  padding: 0 14px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button::after,
.file-button::after {
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.7), transparent 65%);
  content: "";
  transition: transform 520ms ease;
}

.file-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfaf6);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  padding: 0 14px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

button:hover,
input:hover,
.file-button:hover {
  border-color: rgba(29, 127, 112, 0.55);
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(28, 38, 34, 0.12);
}

button:hover::after,
.file-button:hover::after {
  transform: translateX(120%);
}

button:active,
.file-button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(29, 127, 112, 0.18);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  background: #fffefb;
  box-shadow: inset 0 0 0 1px rgba(29, 127, 112, 0.12);
}

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

.app-shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.global-panel,
.product-panel,
.detail-panel,
.service-filter-panel,
.service-log-panel,
.store-visit-calendar,
.store-export-panel,
.order-profit-toolbar,
.summary-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.95), rgba(255, 250, 240, 0.87));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.top-link {
  color: var(--accent);
}

.top-link.active {
  border-color: rgba(29, 127, 112, 0.7);
  background: linear-gradient(135deg, var(--accent), #2a9a78);
  color: #fff;
  box-shadow: 0 10px 24px rgba(29, 127, 112, 0.24);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.toolbar,
.cost-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.module-tabs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding: 4px;
  border: 1px solid rgba(217, 222, 213, 0.8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
}

.module-tab {
  isolation: isolate;
}

.module-tab.active {
  border-color: rgba(29, 127, 112, 0.7);
  background: linear-gradient(135deg, var(--accent), #2b9d7b);
  color: #fff;
  box-shadow: 0 10px 26px rgba(29, 127, 112, 0.23);
}

.module-view {
  display: none;
}

.module-view.active {
  display: block;
  animation: moduleIn 280ms ease both;
}

.global-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.order-profit-summary-title {
  margin-top: 14px;
}

.order-profit-summary-title h2 {
  font-size: 1.1rem;
}

.order-profit-summary {
  margin-top: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-grid article,
.result-grid article {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 14px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.summary-grid article::before,
.result-grid article::before {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(110deg, transparent, rgba(29, 127, 112, 0.08), transparent);
  content: "";
  transition: transform 700ms ease;
}

.summary-grid article:hover,
.result-grid article:hover {
  transform: translateY(-2px);
  border-color: rgba(29, 127, 112, 0.36);
  box-shadow: var(--lift);
}

.summary-grid article:hover::before,
.result-grid article:hover::before {
  transform: translateX(100%);
}

.summary-grid span,
.result-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.summary-grid strong,
.result-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 1.28rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.feedback-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.55fr) minmax(520px, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.product-panel,
.detail-panel {
  min-width: 0;
  overflow: hidden;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.product-panel:hover,
.detail-panel:hover {
  border-color: rgba(29, 127, 112, 0.28);
  box-shadow: var(--glow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent);
  padding: 14px;
}

.panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.panel-head p[data-tone="ok"] {
  color: var(--good);
}

.panel-head p[data-tone="bad"] {
  color: var(--danger);
}

.panel-head.compact {
  align-items: flex-start;
}

#searchInput {
  max-width: 280px;
}

.cost-actions {
  align-items: center;
}

.service-filter-panel {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
}

.service-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-filter-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(260px, 1.6fr);
  gap: 8px;
  align-items: center;
}

.store-export-panel {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding: 14px;
}

.order-profit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
}

.order-profit-toolbar .file-button:first-of-type {
  border-color: rgba(29, 127, 112, 0.45);
  animation: softPulse 2.6s ease-in-out infinite;
}

.small-file-button {
  min-height: 34px;
  font-size: 0.82rem;
}

.upload-status-stack {
  display: grid;
  gap: 6px;
  min-width: 190px;
  color: var(--ink);
  font-weight: 750;
}

.upload-status-stack span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border: 1px solid rgba(29, 127, 112, 0.18);
  border-radius: 8px;
  background: rgba(29, 127, 112, 0.08);
  padding: 0 9px;
}

.upload-locked {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(100, 112, 107, 0.24);
  border-radius: 8px;
  background: rgba(100, 112, 107, 0.08);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  padding: 0 10px;
}

.upload-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compact-delete-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.compact-link {
  min-height: 28px;
  margin-left: 8px;
  padding: 0 8px;
}

.muted-inline {
  margin-left: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.order-profit-parent-title td {
  white-space: normal;
}

.order-profit-parent-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.order-profit-parent-heading strong {
  display: inline;
  font-size: 0.95rem;
}

.order-profit-parent-heading .muted-inline {
  margin-left: 0;
  overflow-wrap: anywhere;
}

.order-profit-parent-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  background: rgba(29, 127, 112, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 900;
  padding: 0 8px;
}

.order-profit-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px)) max-content;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  padding: 12px 14px;
}

.order-profit-toolbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.order-profit-toolbar p[data-tone="ok"] {
  color: var(--good);
}

.order-profit-toolbar p[data-tone="bad"] {
  color: var(--danger);
}

.project-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(560px, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.project-toolbar p[data-tone="ok"] {
  color: var(--good);
}

.project-toolbar p[data-tone="bad"] {
  color: var(--danger);
}

.project-create-grid,
.project-filters,
.project-task-add {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.45fr) minmax(150px, 0.45fr) max-content;
  gap: 10px;
  align-items: end;
}

.project-workspace {
  grid-template-columns: minmax(260px, 0.35fr) minmax(760px, 1.65fr);
}

.project-list,
.project-task-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.project-card,
.project-task {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
}

.project-card {
  cursor: pointer;
}

.project-card.active {
  border-color: rgba(29, 127, 112, 0.72);
  box-shadow: 0 0 0 3px rgba(29, 127, 112, 0.1);
}

.project-card strong,
.project-card span,
.project-card small {
  display: block;
}

.project-task.done {
  opacity: 0.72;
}

.project-task-main {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
  gap: 10px;
  align-items: start;
}

.project-task-main strong,
.project-task-main span {
  display: block;
}

.project-task-main span,
.project-card span,
.project-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.project-task-main b {
  color: var(--accent);
  font-size: 0.9rem;
}

.project-task-details {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border-left: 3px solid rgba(29, 127, 112, 0.22);
  background: rgba(29, 127, 112, 0.06);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
}

.project-task-details p {
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.5;
}

.project-task-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.35fr) 140px 120px repeat(3, max-content);
  gap: 8px;
  margin-top: 10px;
}

.project-task-browse-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.project-task-browse-actions button,
.compact-link {
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding: 0 8px;
}

.project-child-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-left: 24px;
}

.template-import-actions {
  display: grid;
  gap: 8px;
}

.project-template-modal {
  width: min(1180px, 100%);
}

.project-template-editor {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.project-template-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.project-template-item-list {
  display: grid;
  gap: 10px;
  max-height: min(560px, calc(100vh - 310px));
  overflow: auto;
  padding-right: 4px;
}

.project-template-item {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 0.8fr) minmax(130px, 0.55fr) 140px 120px minmax(220px, 1fr) max-content;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.project-template-notes textarea {
  min-height: 44px;
}

.order-profit-workspace {
  grid-template-columns: minmax(760px, 1fr) minmax(300px, 0.28fr);
}

.order-profit-table-wrap,
.order-profit-result-wrap {
  max-height: calc(100vh - 300px);
}

.order-profit-table,
.order-profit-result-table {
  table-layout: auto;
}

.order-profit-result-table {
  min-width: 3600px;
}

.order-profit-table th,
.order-profit-table td,
.order-profit-result-table th,
.order-profit-result-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.order-profit-result-table .order-profit-sticky-cell {
  background: #fffaf0;
  box-shadow: 1px 0 0 rgba(29, 127, 112, 0.18);
  left: 0;
  min-width: 280px;
  position: sticky;
  white-space: normal;
  z-index: 2;
}

.order-profit-result-table thead .order-profit-sticky-cell {
  background: #e8dfcf;
  z-index: 4;
}

.order-profit-result-table .order-profit-overall-row .order-profit-sticky-cell {
  background: #f7efd7;
}

.order-profit-group-cell strong,
.order-profit-group-cell span {
  display: block;
}

.order-profit-group-cell strong {
  color: var(--ink);
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.order-profit-group-cell span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.order-profit-table .asin-input {
  min-width: 140px;
}

.order-profit-table .amount-input {
  min-width: 120px;
}

.order-profit-constant-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px;
}

.order-profit-constant-actions p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.order-profit-result-table th:nth-child(3),
.order-profit-result-table td:nth-child(3) {
  min-width: 220px;
}

.order-profit-result-table td strong,
.order-profit-result-table td span {
  display: block;
}

.order-profit-result-table td span {
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 800;
}

.calc-error {
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: normal;
}

.order-profit-unmatched {
  background: #fff8d7;
}

.order-profit-parent-row {
  background: #eaf6f2;
  font-weight: 850;
}

.order-profit-overall-row th {
  background: #f7efd7;
  color: var(--ink);
  font-weight: 850;
}

.order-profit-parent-row td {
  border-top: 2px solid rgba(29, 127, 112, 0.3);
}

.order-profit-child-row td:first-child {
  padding-left: 24px;
}

.empty-row {
  height: 120px;
  color: var(--muted);
  text-align: center;
}

.store-visit-calendar {
  margin-top: 14px;
  overflow: hidden;
}

.store-visit-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  padding: 14px;
}

.store-visit-day {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.store-visit-day:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(28, 38, 34, 0.1);
}

.store-visit-day strong {
  font-size: 0.84rem;
}

.store-visit-day span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.store-visit-day.missing {
  border-left-color: var(--danger);
  background: #fff0ee;
}

.store-visit-day.complete {
  border-left-color: var(--good);
  background: #f2fbf5;
}

.store-visit-day.today {
  border-color: rgba(29, 127, 112, 0.7);
}

.store-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.store-panel-actions input,
.store-panel-actions select {
  width: auto;
  min-width: 180px;
  flex: 1 1 180px;
}

.service-workspace {
  grid-template-columns: minmax(360px, 0.72fr) minmax(520px, 1fr);
}

.service-log-panel {
  margin-top: 14px;
  overflow: hidden;
}

.service-log-wrap {
  max-height: 360px;
  min-height: 220px;
}

.service-log-table {
  font-size: 0.8rem;
}

.service-log-table th,
.service-log-table td {
  max-width: 260px;
  padding: 8px;
  text-align: left;
  white-space: normal;
}

.service-log-table th:nth-child(1),
.service-log-table td:nth-child(1) {
  min-width: 135px;
}

.service-detail-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.service-log-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}

.service-log-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 7px 10px;
}

.service-log-stats strong {
  color: var(--ink);
  margin-right: 6px;
}

.service-log-table th:nth-child(8),
.service-log-table td:nth-child(8),
.service-log-table th:nth-child(9),
.service-log-table td:nth-child(9),
.service-log-table th:nth-child(10),
.service-log-table td:nth-child(10),
.service-log-table th:nth-child(11),
.service-log-table td:nth-child(11) {
  min-width: 220px;
}

.service-log-empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.feedback-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 260px);
  min-height: 360px;
  overflow: auto;
  padding: 14px;
}

.feedback-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.feedback-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(28, 38, 34, 0.1);
}

.feedback-item.open {
  border-left-color: var(--danger);
  background: #fff8f6;
}

.feedback-item.resolved {
  border-left-color: var(--good);
  background: #f2fbf5;
}

.feedback-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.feedback-line strong {
  overflow-wrap: anywhere;
}

.feedback-line span {
  border-radius: 8px;
  background: rgba(29, 127, 112, 0.11);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
}

.feedback-item p {
  margin-top: 8px;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.feedback-item small,
.feedback-empty {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.feedback-empty {
  padding: 22px;
  text-align: center;
}

.store-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(760px, 1.58fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.name-input {
  width: min(100%, 560px);
  min-height: 42px;
  border-color: transparent;
  background: #ffffff;
  font-size: 1rem;
  font-weight: 850;
  padding: 8px 10px;
}

.name-input:disabled {
  color: var(--accent);
  opacity: 1;
}

.table-wrap {
  max-height: calc(100vh - 350px);
  min-height: 420px;
  overflow: auto;
}

.store-table-wrap {
  max-height: calc(100vh - 410px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f0e8d9, #e8dfcf);
  box-shadow: 0 6px 14px rgba(28, 38, 34, 0.06);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

th:nth-child(2),
td:nth-child(2) {
  min-width: 240px;
  max-width: 360px;
  text-align: left;
  white-space: normal;
}

.select-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 10px;
  padding-right: 6px;
  text-align: center;
}

.select-col input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 0;
}

tbody tr {
  cursor: pointer;
  transition:
    background 130ms ease,
    transform 130ms ease,
    box-shadow 130ms ease;
}

tbody tr:hover,
tbody tr.active {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

tbody tr.service-row-danger {
  background: #fff0ee;
}

tbody tr.service-row-warning {
  background: #fff8d7;
}

tbody tr.service-row-future {
  background: #eef4ff;
}

tbody tr.service-row-done {
  background: #ffffff;
}

.service-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 320px);
  min-height: 420px;
  overflow-y: auto;
  padding: 10px;
}

.service-item {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.service-item.active,
.service-item:hover {
  border-color: rgba(29, 127, 112, 0.58);
  box-shadow: 0 10px 24px rgba(28, 38, 34, 0.1);
  transform: translateY(-1px);
}

.service-line,
.service-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.service-line strong {
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.service-line span,
.service-line a,
.service-meta span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-line a {
  color: var(--accent);
  font-weight: 850;
}

.danger-button {
  border-color: rgba(185, 58, 58, 0.45);
  color: var(--danger);
}

#markInviteButton {
  border-color: rgba(20, 107, 69, 0.45);
  background: var(--good);
  color: #fff;
}

.field-link,
.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.field-link {
  color: var(--accent);
  font-weight: 850;
  text-decoration: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(24, 34, 31, 0.34);
  backdrop-filter: blur(8px);
  padding: 18px;
  animation: fadeIn 180ms ease both;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-page {
  display: grid;
  gap: 12px;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 72px rgba(24, 34, 31, 0.26);
  padding: 16px;
  animation: modalIn 220ms ease both;
}

.system-config-modal {
  width: min(980px, 100%);
}

.modal-panel {
  display: grid;
  gap: 12px;
  width: min(900px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 72px rgba(24, 34, 31, 0.26);
  padding: 16px;
  animation: modalIn 220ms ease both;
}

.wide-modal {
  width: min(1180px, 100%);
}

.modal-head,
.category-add,
.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
}

.category-list {
  display: grid;
  gap: 8px;
  max-height: min(520px, calc(100vh - 260px));
  overflow: auto;
  padding-right: 4px;
}

.system-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.config-list-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.config-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
}

.config-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(29, 127, 112, 0.16);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.config-row span {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.config-row button {
  border-color: rgba(190, 67, 67, 0.28);
  color: var(--danger);
}

.config-empty {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.category-row input {
  min-height: 34px;
}

.service-issue {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 780;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.service-item.service-row-danger {
  border-left-color: var(--danger);
  background: #fff0ee;
}

.service-item.service-row-warning {
  border-left-color: #d0a000;
  background: #fff8d7;
}

.service-item.service-row-future {
  border-left-color: #4c77b9;
  background: #eef4ff;
}

.service-item.service-row-done {
  border-left-color: #aeb8b3;
}

td strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.25;
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.positive {
  color: var(--good);
  font-weight: 800;
}

.negative {
  color: var(--danger);
  font-weight: 800;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.result-grid article {
  background: #ffffff;
  box-shadow: none;
}

.result-grid strong {
  font-size: 1rem;
}

.product-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.service-form {
  padding-bottom: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

legend {
  padding: 0 5px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 850;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.template-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.template-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.template-current {
  display: grid;
  grid-template-columns: minmax(130px, 170px) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.template-current label {
  display: grid;
  gap: 5px;
}

.template-current strong {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  overflow-wrap: anywhere;
}

.template-panel textarea {
  min-height: 220px;
  background: #fff;
}

.store-bulk-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) max-content;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.store-table {
  font-size: 0.82rem;
}

.store-table th,
.store-table td {
  padding: 8px;
}

.store-link-table th,
.store-link-table td {
  text-align: left;
  white-space: normal;
}

.store-link-table th:nth-child(1),
.store-link-table td:nth-child(1) {
  min-width: 170px;
  max-width: none;
}

.store-link-table th:nth-child(2),
.store-link-table td:nth-child(2) {
  width: 92px;
  min-width: 92px;
  text-align: right;
}

.store-link-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.store-link-anchor {
  color: var(--accent);
  font-weight: 900;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.store-link-anchor.muted {
  color: var(--ink);
}

.store-link-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.store-visit-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
}

.store-visit-badge.missing {
  background: #fff0ee;
  color: var(--danger);
}

.store-visit-badge.visited {
  background: #f2fbf5;
  color: var(--good);
}

.store-link-actions-cell {
  white-space: nowrap;
}

.store-table th:nth-child(2),
.store-table td:nth-child(2) {
  min-width: 120px;
  max-width: 180px;
  white-space: normal;
}

.store-table th:nth-child(5),
.store-table td:nth-child(5) {
  min-width: 220px;
  max-width: 420px;
  text-align: left;
  white-space: normal;
}

.store-table th:nth-child(7),
.store-table td:nth-child(7) {
  min-width: 240px;
  max-width: 420px;
  text-align: left;
}

.store-link-table th:nth-child(1),
.store-link-table td:nth-child(1) {
  min-width: 170px;
  max-width: none;
  text-align: left;
}

.store-link-table th:nth-child(2),
.store-link-table td:nth-child(2) {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  text-align: right;
}

.store-issue-table {
  table-layout: auto;
}

.store-issue-table th,
.store-issue-table td {
  white-space: normal;
  vertical-align: top;
}

.store-issue-table th:nth-child(6),
.store-issue-table td:nth-child(6),
.store-issue-table th:nth-child(8),
.store-issue-table td:nth-child(8) {
  min-width: 220px;
  max-width: 360px;
}

.store-issue-table th:nth-child(5),
.store-issue-table td:nth-child(5),
.store-issue-table th:nth-child(7),
.store-issue-table td:nth-child(7) {
  min-width: 124px;
  max-width: 150px;
}

.store-issue-table th:nth-child(9),
.store-issue-table td:nth-child(9) {
  min-width: 128px;
  max-width: 150px;
}

.store-issue-table textarea.inline-input {
  min-height: 54px;
  white-space: normal;
}

.store-issue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.inline-input {
  min-height: 34px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 8px;
  font-size: 0.82rem;
}

.inline-input:focus {
  border-color: var(--accent);
  background: #fff;
}

.status-input {
  min-width: 108px;
}

.compact-input {
  min-width: 90px;
}

.date-input {
  min-width: 130px;
}

.issue-input {
  min-width: 220px;
}

.conclusion-input {
  min-width: 220px;
}

.url-cell {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) max-content;
  gap: 8px;
  align-items: center;
}

.url-input {
  min-width: 180px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0 10px;
  text-decoration: none;
  white-space: nowrap;
}

.store-issue-0 {
  background: #fff0ee;
}

.store-issue-1 {
  background: #fff8d7;
}

.store-issue-2 {
  background: #f2fbf5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes moduleIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    transform: translateY(12px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes softPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(29, 127, 112, 0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(29, 127, 112, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1180px) {
  .workspace,
  .store-workspace,
  .feedback-workspace,
  .project-workspace,
  .order-profit-workspace {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .panel-head,
  .project-toolbar,
  .order-profit-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-end;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar button {
    flex: 1;
  }

  .global-panel,
  .summary-grid,
  .result-grid,
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  #searchInput {
    max-width: none;
  }

  .service-filter-panel {
    grid-template-columns: 1fr;
  }

  .service-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .store-panel-actions,
  .store-bulk-bar,
  .system-config-grid,
  .project-create-grid,
  .project-filters,
  .project-task-add,
  .project-task-actions,
  .project-template-item {
    grid-template-columns: 1fr;
  }

  .template-head {
    align-items: stretch;
    flex-direction: column;
  }

  .template-current {
    grid-template-columns: 1fr;
  }

  .feedback-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .global-panel,
  .summary-grid,
  .result-grid,
  .field-grid,
  .service-filter-grid {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 10px;
  }
}

/* Clean workspace refresh */
:root {
  --bg: #f7f8f2;
  --surface: #ffffff;
  --surface-2: #f5f7f0;
  --ink: #171c19;
  --muted: #747b75;
  --line: #e5e7e0;
  --accent: #2a9ca8;
  --accent-2: #5a8f64;
  --danger: #c44747;
  --good: #47a34a;
  --shadow: none;
  --glow: none;
  --lift: none;
}

body {
  background: var(--bg);
}

body::before,
body::after {
  display: none;
}

.app-shell {
  width: 100%;
  padding: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 242, 0.94);
  padding: 0 18px;
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.brand-mark strong {
  font-size: 1.22rem;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-mark span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.global-search {
  width: min(260px, 28vw);
  min-height: 34px;
  border-radius: 999px;
  background: #fff;
  padding-inline: 14px;
}

.module-tabs {
  position: sticky;
  top: 58px;
  z-index: 11;
  justify-content: center;
  gap: 22px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(247, 248, 242, 0.94);
  padding: 10px 18px;
  backdrop-filter: blur(12px);
}

button,
.file-button {
  min-height: 34px;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
  font-weight: 800;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

button::after,
.file-button::after {
  display: none;
}

button:hover,
.file-button:hover {
  transform: none;
  box-shadow: none;
}

.module-tab,
.top-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding-inline: 4px;
}

.module-tab.active,
.top-link.active {
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.module-tab.active::before {
  position: absolute;
  right: 2px;
  bottom: -11px;
  left: 2px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.module-view {
  padding: 0 18px 32px;
}

.topbar,
.global-panel,
.product-panel,
.detail-panel,
.service-filter-panel,
.service-log-panel,
.store-visit-calendar,
.store-export-panel,
.order-profit-toolbar,
.project-toolbar,
.summary-grid article {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.product-panel,
.detail-panel,
.service-log-panel,
.store-visit-calendar,
.store-export-panel,
.order-profit-toolbar,
.project-toolbar,
.global-panel,
.service-filter-panel {
  border: 0;
  border-bottom: 1px solid var(--line);
}

.summary-grid {
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.summary-grid article,
.result-grid article {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 12px 16px;
}

.summary-grid article:hover,
.result-grid article:hover {
  transform: none;
  box-shadow: none;
}

.summary-grid article::before,
.result-grid article::before {
  display: none;
}

.workspace,
.store-workspace,
.project-workspace,
.order-profit-workspace,
.feedback-workspace {
  gap: 0;
  margin-top: 0;
}

.panel-head {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.table-wrap,
.store-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}

thead {
  background: #fafbf7;
}

th {
  color: var(--muted);
  font-weight: 800;
}

td,
th {
  border-bottom: 1px solid var(--line);
}

tr:hover td,
.service-item:hover,
.project-card:hover,
.project-task:hover,
.feedback-item:hover {
  background: rgba(42, 156, 168, 0.045);
}

input,
select,
textarea {
  border-radius: 7px;
  background: #fff;
}

.service-item,
.feedback-item,
.project-card,
.project-task,
.config-row,
.config-list-panel {
  border-radius: 0;
  box-shadow: none;
}

.modal-page,
.modal-panel {
  border-radius: 10px;
  box-shadow: 0 18px 54px rgba(23, 28, 25, 0.16);
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-block: 10px;
  }

  .topbar-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .global-search {
    width: 100%;
  }

  .module-tabs {
    top: 104px;
    justify-content: flex-start;
    overflow-x: auto;
  }
}
