:root {
  --bg: #f3f6f2;
  --surface: #ffffff;
  --surface-soft: #f9faf8;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dfd8;
  --green: #1f7a4d;
  --green-dark: #134f35;
  --blue: #315f88;
  --amber: #a16500;
  --mint: #dfeee5;
  --cyan: #dbecef;
  --red: #a13d3d;
  --shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
  --shadow-strong: 0 18px 48px rgba(31, 41, 51, 0.12);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-line: rgba(255, 255, 255, 0.54);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, #eef6ef 0, #f8fbf9 42%, #e7eef2 100%),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  background:
    linear-gradient(135deg, rgba(31, 122, 77, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(49, 95, 136, 0.08), transparent 42%);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 34px 20px;
  background:
    linear-gradient(120deg, rgba(18, 58, 41, 0.92) 0 42%, rgba(49, 95, 136, 0.24) 42% 68%, rgba(246, 250, 247, 0.98) 68% 100%),
    linear-gradient(180deg, #f5faf6, #e7eff1);
}

.login-shell {
  width: min(1020px, 100%);
  min-height: 610px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 32px 90px rgba(15, 42, 30, 0.22);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.82fr);
  overflow: hidden;
}

.login-hero {
  min-width: 0;
  padding: clamp(34px, 5vw, 62px);
  color: white;
  background:
    linear-gradient(160deg, rgba(15, 53, 37, 0.92), rgba(20, 78, 53, 0.78)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent);
  display: grid;
  align-content: center;
  gap: 28px;
  position: relative;
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.login-hero img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.login-hero span {
  display: block;
  color: #a8e6bc;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.login-hero h1 {
  max-width: 560px;
  margin: 10px 0 12px;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.04;
  color: #fff;
}

.login-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
}

.login-role-strip {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  z-index: 1;
}

.login-role-strip span {
  min-height: 38px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.login-card {
  width: 100%;
  min-height: 100%;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: clamp(34px, 5vw, 56px);
  display: grid;
  align-content: center;
  gap: 20px;
  position: relative;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--radius);
  pointer-events: none;
}

.login-card-head {
  display: grid;
  gap: 8px;
}

.login-card h2,
.login-card p {
  margin: 0;
}

.login-card h2 {
  font-size: 32px;
  line-height: 1.15;
}

.login-card p {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 8px;
  font-weight: 800;
  color: #21362b;
}

.login-card input {
  height: 52px;
  border: 1px solid rgba(146, 167, 153, 0.68);
  border-radius: var(--radius);
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.login-card .primary-button {
  min-height: 52px;
  font-size: 16px;
  border-radius: var(--radius);
  box-shadow: 0 18px 36px rgba(31, 122, 77, 0.26);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(12, 35, 25, 0.96) 0, rgba(18, 43, 32, 0.94) 54%, rgba(10, 25, 20, 0.97) 100%);
  color: #edf5ee;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: white;
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  margin-top: 4px;
  color: #a9bab0;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  color: #dce9df;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(127, 213, 156, 0.35);
  color: white;
  box-shadow: inset 3px 0 0 #7fd59c, 0 10px 26px rgba(0, 0, 0, 0.14);
}

.sidebar-metrics {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sidebar-metrics div {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.sidebar-metrics strong {
  font-size: 24px;
  line-height: 1;
}

.sidebar-metrics span {
  color: #b7c8bd;
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.88), rgba(250, 253, 251, 0.68)),
    var(--glass);
  box-shadow: 0 18px 50px rgba(31, 41, 51, 0.11);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

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

.user-chip {
  min-height: 42px;
  border: 1px solid rgba(202, 216, 207, 0.95);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  padding: 7px 12px;
  display: grid;
  align-content: center;
  min-width: 116px;
}

.user-chip strong,
.user-chip span {
  display: block;
  line-height: 1.2;
}

.user-chip span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  flex: 1 1 300px;
  min-width: 280px;
  max-width: 520px;
  min-height: 42px;
  border: 1px solid rgba(202, 216, 207, 0.95);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
}

.search-box input {
  border: 0;
  padding: 0;
  min-height: 38px;
  box-shadow: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.records-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
}

.table-records-layout {
  grid-template-columns: 236px minmax(0, 1fr);
}

.filters-panel,
.record-table-panel,
.detail-panel,
.analysis-panel,
.upload-panel,
.draft-panel,
.summary-strip,
.analysis-context,
.source-card {
  background: var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.source-card {
  margin-bottom: 14px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 0.9fr);
  gap: 16px;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.source-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.source-copy,
.source-metrics {
  min-width: 0;
}

.source-copy {
  display: grid;
  gap: 6px;
  padding-left: 4px;
}

.source-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.source-copy strong {
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.source-copy span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.source-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.source-metrics div {
  min-height: 70px;
  border: 1px solid #dce8df;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfdfb, #f3f8f4);
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.source-metrics strong {
  font-size: 24px;
  line-height: 1;
}

.source-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.filters-panel {
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.filter-head,
.panel-title-row,
.dialog-head,
.dialog-actions,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-head strong,
.panel-title-row strong {
  font-size: 16px;
}

.panel-title-row span {
  color: var(--muted);
  font-size: 13px;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5cf;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.15);
}

.filter-block {
  display: grid;
  gap: 8px;
}

.filter-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip-list {
  display: grid;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  color: var(--ink);
  text-align: left;
}

.chip:hover,
.chip.active {
  border-color: #8cb7a0;
  background: #edf6f0;
  color: var(--green-dark);
}

.chip span {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chip small {
  color: var(--muted);
  white-space: nowrap;
}

.chip-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 2px;
}

.record-table-panel {
  min-width: 0;
  overflow: hidden;
}

.daily-upload-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px minmax(220px, 1fr) minmax(220px, 1.1fr) auto;
  gap: 12px;
  align-items: end;
}

.daily-upload-panel > div {
  display: grid;
  gap: 4px;
}

.daily-upload-panel strong {
  font-size: 16px;
}

.daily-upload-panel span,
.daily-upload-panel .message {
  color: var(--muted);
}

.daily-upload-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.daily-upload-panel input {
  min-height: 40px;
}

.daily-upload-panel .message {
  grid-column: 1 / -1;
}

.file-button {
  min-height: 42px;
  border: 1px dashed #9eb7a8;
  border-radius: var(--radius);
  background: #fbfdfb;
  color: var(--green-dark);
  padding: 8px 10px;
  display: flex !important;
  grid-auto-flow: column;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px !important;
  cursor: pointer;
}

.file-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--green-dark);
}

.record-table-panel .panel-title-row,
.analysis-panel .panel-title-row,
.upload-panel .panel-title-row,
.draft-panel .panel-title-row {
  padding: 14px 14px 0;
}

.table-shell {
  overflow: auto;
  max-height: calc(100vh - 170px);
  scrollbar-color: #9fb3a8 transparent;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e7ebe7;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(248, 251, 249, 0.96);
  color: #53605a;
  font-weight: 800;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: rgba(230, 244, 235, 0.72);
}

tbody tr:nth-child(even):not(:hover):not(.selected) {
  background: rgba(255, 255, 255, 0.48);
}

td strong,
td span {
  display: block;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.record-action-cell {
  min-width: 150px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.inline-actions button {
  border: 1px solid #bfd6c8;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--green-dark);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.inline-actions button:hover {
  border-color: #8fb59f;
  background: #edf6f0;
}

.inline-actions .danger-inline {
  color: var(--red);
  border-color: #e8c7c7;
  background: #fff7f7;
}

.inline-actions .danger-inline:hover {
  border-color: #ca8f8f;
  background: #fff0f0;
}

.inline-actions button:disabled {
  color: var(--muted);
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9f1ff;
  color: var(--blue);
  font-weight: 700;
  font-size: 12px;
}

.status-pill.review {
  background: #fff2d8;
  color: var(--amber);
}

.status-pill.done {
  background: #e5f5eb;
  color: var(--green-dark);
}

.detail-panel {
  min-height: calc(100vh - 136px);
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.empty-detail {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  gap: 8px;
  padding: 18px;
}

.empty-detail strong {
  color: var(--ink);
}

.detail-title {
  display: grid;
  gap: 8px;
}

.detail-title h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  min-height: 24px;
  border-radius: 999px;
  background: #edf2ef;
  color: #476157;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

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

.detail-item {
  border: 1px solid #e3e8e4;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
  min-width: 0;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.detail-text {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 8px;
  color: #344054;
  line-height: 1.55;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-link {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 38px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--green-dark);
  text-decoration: none;
  background: var(--surface-soft);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  white-space: nowrap;
}

.primary-button {
  background: linear-gradient(180deg, #248955, var(--green));
  color: white;
  box-shadow: 0 10px 22px rgba(31, 122, 77, 0.22);
}

.primary-button:hover {
  background: linear-gradient(180deg, #1f7a4d, var(--green-dark));
  transform: translateY(-1px);
}

.primary-button:disabled {
  background: #a8b8ad;
  cursor: not-allowed;
}

.secondary-button {
  background: rgba(244, 249, 246, 0.9);
  border-color: #bdd5c5;
  color: var(--green-dark);
  box-shadow: 0 6px 16px rgba(31, 41, 51, 0.06);
}

.danger-button {
  background: rgba(255, 244, 244, 0.9);
  border-color: #e7c1c1;
  color: var(--red);
  box-shadow: 0 6px 16px rgba(161, 61, 61, 0.08);
}

.icon-button {
  width: 38px;
  padding: 0;
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--line);
  color: var(--ink);
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.sheet-detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-width: 0;
}

.raw-detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-width: 0;
}

.analysis-grid > *,
.summary-strip > *,
.analysis-context > *,
.category-row,
.ranking-row,
.insight {
  min-width: 0;
}

.analysis-context {
  grid-column: 1 / -1;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.analysis-context div {
  display: grid;
  gap: 5px;
}

.analysis-context span {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.analysis-context strong {
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.analysis-context p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.summary-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  min-width: 0;
}

.summary-strip div {
  padding: 16px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 6px;
  min-width: 0;
}

.summary-strip div:last-child {
  border-right: 0;
}

.summary-strip span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.summary-strip strong {
  font-size: 28px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.analysis-panel {
  min-height: 240px;
  padding-bottom: 14px;
}

.analysis-panel.wide {
  grid-column: span 1;
}

.sheet-table-panel {
  min-height: 520px;
  min-width: 0;
  overflow: hidden;
}

.sheet-table-shell {
  max-height: calc(100vh - 330px);
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

.sheet-detail-table {
  width: auto;
  min-width: 1080px;
  border-collapse: collapse;
  background: white;
}

.sheet-detail-table th,
.sheet-detail-table td {
  border: 1px solid #8f9a92;
  white-space: pre-wrap;
  text-align: center;
  vertical-align: middle;
  min-width: 86px;
  padding: 8px 10px;
  color: #101820;
  line-height: 1.35;
}

.sheet-detail-table tbody tr {
  cursor: default;
}

.sheet-detail-table tbody tr:hover,
.sheet-detail-table tbody tr:nth-child(even):not(:hover):not(.selected) {
  background: transparent;
}

.sheet-detail-table .sheet-title-cell {
  background: #f8fbf8;
  font-size: 18px;
  font-weight: 900;
}

.sheet-detail-table .sheet-header-cell {
  background: #eef4f0;
  font-weight: 800;
}

.sheet-detail-table .sheet-empty-cell {
  background: #fff;
  color: transparent;
}

.sheet-detail-table .editable-cell {
  cursor: text;
}

.sheet-detail-table .editable-cell:focus {
  outline: 2px solid var(--green);
  outline-offset: -2px;
  background: #f3fbf6;
}

.sheet-detail-table .dirty-cell {
  background: #fff8e8;
}

.raw-sheet-panel {
  min-height: calc(100vh - 210px);
}

.raw-sheet-shell {
  max-height: calc(100vh - 260px);
  overflow: auto;
  background: #fff;
}

.raw-sheet-table {
  min-width: 1480px;
}

.raw-sheet-table th,
.raw-sheet-table td {
  min-width: 92px;
  padding: 7px 8px;
  font-size: 12px;
  border-color: #9aa49c;
}

.raw-sheet-table .sheet-title-cell {
  font-size: 16px;
}

.raw-file-preview {
  min-height: 520px;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 18px;
  background: #fff;
}

.raw-file-preview img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid #c9d0ca;
  background: #fff;
}

.raw-file-image-button {
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-grid;
  max-width: 100%;
}

.raw-file-image-button:hover img,
.cell-image-button:hover img {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.12);
}

.cell-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 6px;
  min-width: 120px;
}

.cell-image-button {
  border: 0;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
}

.cell-image-button img {
  width: 100%;
  max-width: 150px;
  height: 92px;
  object-fit: contain;
  border: 1px solid #c9d0ca;
  border-radius: 4px;
  background: #fff;
}

.cell-text {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.bar-chart {
  min-height: 260px;
  padding: 18px 16px 10px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(48px, 1fr);
  gap: 12px;
  align-items: end;
  overflow-x: auto;
  background:
    repeating-linear-gradient(180deg, transparent 0 43px, rgba(216, 223, 216, 0.55) 44px),
    linear-gradient(180deg, #fbfdfb, #ffffff);
}

.bar-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-height: 220px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.bar-fill {
  align-self: end;
  min-height: 8px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #2f9c66, var(--green));
  box-shadow: 0 6px 14px rgba(31, 122, 77, 0.18);
}

.bar-fill.empty {
  background: #d9e2dd;
}

.category-bars,
.ranking-list,
.insight-list,
.draft-view {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.category-row,
.ranking-row,
.insight {
  border: 1px solid #e3e8e4;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
}

.category-row {
  display: grid;
  gap: 8px;
}

.category-top,
.ranking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress {
  height: 8px;
  background: #e6ebe7;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.ranking-row strong {
  font-size: 18px;
}

.insight {
  line-height: 1.55;
}

.table-note-editor {
  display: grid;
  gap: 12px;
}

.table-note-editor textarea {
  min-height: 132px;
  line-height: 1.6;
  background: #fbfdfb;
}

.summary-read-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-read-header > div {
  display: grid;
  gap: 4px;
}

.summary-read-header strong {
  font-size: 18px;
}

.summary-eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.summary-note-read,
.summary-note-empty {
  border: 1px solid rgba(31, 122, 77, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(246, 250, 247, 0.96), rgba(255, 255, 255, 0.98));
  padding: 16px 18px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.summary-note-empty {
  color: var(--muted);
}

.table-note-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.summary-image-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.summary-paste-zone {
  border: 1px dashed #a9beb1;
  border-radius: var(--radius);
  background: #fbfdfb;
  color: var(--muted);
  padding: 12px;
  min-height: 44px;
  outline: none;
}

.summary-paste-zone:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.12);
}

.summary-image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.summary-image-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(31, 41, 51, 0.06);
}

.summary-image-preview {
  width: 100%;
  border: 0;
  padding: 0;
  background: #f6f8f6;
  display: block;
  cursor: zoom-in;
}

.summary-image-preview:hover {
  filter: brightness(0.98);
}

.summary-image-card img {
  display: block;
  width: 100%;
  height: 168px;
  object-fit: contain;
  background: linear-gradient(180deg, #f8faf8, #ffffff);
}

.summary-image-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.summary-image-card figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-image-card figcaption button {
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 800;
  padding: 4px;
}

.empty-inline {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
}

.source-note-list {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.format-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.format-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.format-section.wide {
  grid-column: 1 / -1;
}

.format-section h3 {
  margin: 0;
  font-size: 14px;
  color: #344054;
}

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

.format-card,
.format-note {
  border: 1px solid #e0e8e2;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
  min-width: 0;
}

.format-card {
  display: grid;
  gap: 5px;
}

.format-card.compact {
  background: #f8fbfc;
}

.format-card strong,
.format-note strong {
  overflow-wrap: anywhere;
}

.format-card span,
.format-note span,
.format-note p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.format-note p {
  margin: 6px 0 0;
}

.format-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(440px, 1.22fr);
  gap: 14px;
  align-items: start;
}

.upload-panel,
.draft-panel {
  padding-bottom: 14px;
}

.upload-panel > label,
.upload-panel .button-row,
.upload-panel .message {
  margin: 14px;
}

.drop-zone {
  min-height: 250px;
  border: 2px dashed #a9b8ae;
  border-radius: var(--radius);
  background: #fbfcfb;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.drop-zone input {
  display: none;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: #eef7f1;
}

.drop-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: #eef6f1;
  color: var(--green-dark);
  display: grid;
  place-items: center;
}

.drop-icon svg {
  width: 26px;
  height: 26px;
}

.drop-zone strong {
  color: var(--ink);
}

.user-management-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(360px, 430px);
  gap: 14px;
  align-items: start;
}

.user-table-panel,
.user-editor-panel {
  min-width: 0;
  background: var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.user-editor-panel {
  padding-bottom: 14px;
}

.user-table-shell {
  max-height: calc(100vh - 154px);
}

.user-form {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-form label {
  min-width: 0;
}

.user-form input,
.user-form select {
  min-height: 42px;
}

.user-form input:disabled {
  color: #58645f;
  background: rgba(241, 245, 242, 0.78);
}

.user-permission-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.user-permission-cards div {
  border: 1px solid #dbe8df;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
  padding: 11px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.user-permission-cards svg {
  color: var(--green);
}

.user-permission-cards strong {
  font-size: 14px;
}

.user-permission-cards span {
  color: var(--muted);
  font-size: 12px;
}

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

.user-form-actions .message {
  margin-right: auto;
}

.role-badge {
  display: inline-grid;
  min-height: 26px;
  place-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #eef4ff;
  color: var(--blue);
}

.role-admin {
  background: #e9f8ef;
  color: var(--green-dark);
}

.role-technician {
  background: #edf4ff;
  color: var(--blue);
}

.role-viewer {
  background: #f2f3f2;
  color: #5d6b64;
}

.file-preview {
  margin: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
}

.file-preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  background: white;
}

.file-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.draft-field {
  border: 1px solid #e3e8e4;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 9px;
}

.draft-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.draft-field input,
.draft-field textarea {
  padding: 7px 8px;
  background: white;
}

.draft-field.wide {
  grid-column: 1 / -1;
}

.message {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--muted);
}

.message.success {
  color: var(--green-dark);
}

.message.error {
  color: var(--red);
}

dialog {
  width: min(920px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 80px rgba(20, 37, 29, 0.28);
}

dialog::backdrop {
  background: rgba(15, 24, 20, 0.45);
}

.image-lightbox {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  background: #0f1713;
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  overflow: hidden;
}

.image-lightbox::backdrop {
  background: rgba(6, 12, 9, 0.78);
}

.image-lightbox > button {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}

.image-lightbox figure {
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 72vh;
}

.image-lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 108px);
  align-self: center;
  justify-self: center;
  object-fit: contain;
  padding: 26px;
}

.image-lightbox figcaption {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 18px;
  color: rgba(255, 255, 255, 0.82);
}

.dialog-head {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
}

.dialog-body {
  padding: 16px;
  max-height: min(68vh, 680px);
  overflow: auto;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
}

.dialog-actions .message {
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: 1 / -1;
}

@media (max-width: 1280px) {
  .records-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .detail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-card {
    border-left: 0;
  }

  .login-hero {
    min-height: 320px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .brand img {
    width: 48px;
    height: 48px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
    text-align: center;
  }

  .sidebar-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .source-card,
  .daily-upload-panel,
  .records-layout,
  .analysis-grid,
  .raw-detail-layout,
  .upload-layout,
  .user-management-layout {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    grid-template-columns: 1fr auto auto;
  }

  .filters-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-head,
  .filter-block {
    grid-column: 1 / -1;
  }

  .detail-grid,
  .draft-grid,
  .user-form,
  .format-grid,
  .format-note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 24px;
  }

  .login-screen {
    padding: 12px;
  }

  .login-hero,
  .login-card {
    padding: 24px;
  }

  .login-hero h1 {
    font-size: 32px;
  }

  .nav-button span {
    display: none;
  }

  .nav-button {
    display: flex;
  }

  .topbar-actions,
  .filters-panel,
  .summary-strip,
  .detail-grid,
  .draft-grid,
  .form-grid,
  .user-form,
  .user-permission-cards,
  .sidebar-metrics,
  .source-metrics,
  .format-grid,
  .format-card-grid,
  .format-note-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: 1;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    width: 100%;
  }

  .analysis-context {
    display: grid;
  }

  .button-row,
  .dialog-actions {
    display: grid;
  }

  .table-shell {
    margin-left: -1px;
    margin-right: -1px;
  }
}
