/* Industrial operations UI system with warmer document cards. */
:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-muted: #eef2ec;
  --surface-soft: #f8faf6;
  --text: #1f2b24;
  --ink: var(--text);
  --muted: #637065;
  --line: #d7ddd5;
  --primary: #245f45;
  --brand: var(--primary);
  --primary-strong: #173b2b;
  --brand-strong: var(--primary-strong);
  --accent: #8a6f28;
  --warning: #8a6f28;
  --danger: #a33d2f;
  --panel: var(--surface);
  --radius-base: 8px;
  --radius-card: 14px;
  --shadow-base: 0 10px 30px rgba(31, 43, 36, 0.08);
  --shadow-soft: 0 18px 45px rgba(31, 43, 36, 0.06);
  --shadow: var(--shadow-base);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.22;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

.app-shell,
.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 56px;
}

.shell.narrow {
  width: min(860px, calc(100% - 28px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 6px 12px;
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-base);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  border-left: 4px solid var(--primary);
  background: var(--surface-muted);
  font-weight: 700;
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-base);
  box-shadow: var(--shadow-base);
}

.hero,
.panel {
  padding: 24px;
}

.panel-head,
.items-header,
.item-top,
.file-row,
.action-row,
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  align-items: flex-start;
  margin-bottom: 20px;
}

.inline-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.card-grid,
.doc-grid,
.file-list,
#items {
  display: grid;
  gap: 14px;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 24px;
}

.card,
.doc-card,
.item-card,
.file-row,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.card,
.doc-card,
.item-card,
.file-row,
.result-card {
  padding: 18px;
}

.card:hover,
.doc-card:hover,
.file-row:hover {
  border-color: rgba(36, 95, 69, 0.35);
}

.card-icon,
.feature-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: var(--radius-base);
  background: var(--surface-muted);
  color: var(--primary);
  font-weight: 800;
}

.card h3,
.doc-card h3 {
  margin-bottom: 8px;
  color: var(--primary-strong);
  font-size: 18px;
}

.card p,
.doc-card p,
.file-row p,
.empty-state,
.meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-block {
  display: grid;
  gap: 16px;
}

.admin-nav {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.upload-zone {
  display: grid;
  gap: 6px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-soft);
  padding: 20px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--surface-muted);
}

.upload-zone strong {
  color: var(--primary-strong);
}

.upload-result {
  margin: 12px 0 18px;
  border-radius: var(--radius-card);
  padding: 12px 14px;
  font-size: 14px;
}

.upload-result.success {
  border: 1px solid rgba(36, 95, 69, 0.25);
  background: rgba(36, 95, 69, 0.08);
  color: var(--primary-strong);
}

.upload-result.error {
  border: 1px solid rgba(163, 61, 47, 0.25);
  background: rgba(163, 61, 47, 0.08);
  color: var(--danger);
}

.loading {
  color: var(--muted);
  font-size: 14px;
}

.tag,
.badge,
.result-score {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--primary);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.tag.warning,
.badge-pending {
  background: #fcf6e3;
  color: var(--warning);
}

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.button,
button,
input,
textarea,
select {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-base);
  background: var(--surface-soft);
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(36, 95, 69, 0.18);
  border-color: var(--primary);
  background: #fff;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  margin-bottom: 24px;
}

.search-form button {
  font-size: 17px;
  font-weight: 800;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-base);
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.button.compact,
button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.button:hover,
button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.button.secondary,
button.secondary,
.btn-secondary {
  background: var(--surface-muted);
  color: var(--primary-strong);
  border: 1px solid var(--line);
}

.button.ghost,
.btn-ghost,
.button.outline,
.btn-outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.button.danger,
button.danger,
.btn-delete {
  background: var(--danger);
  color: #fff;
}

.link-danger {
  min-height: auto;
  background: transparent;
  padding: 0;
  color: var(--danger);
}

.result {
  margin-top: 16px;
  border: 1px solid rgba(36, 95, 69, 0.2);
  border-radius: var(--radius-card);
  background: rgba(36, 95, 69, 0.08);
  padding: 16px;
}

.json-output {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: rgba(31, 43, 36, 0.05);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 16px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 12px;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .app-shell,
  .shell,
  .shell.narrow {
    width: 100%;
    padding: 0 12px 40px;
  }

  .panel-head,
  .items-header,
  .file-row,
  .inline-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 -12px;
    padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
    border-bottom: 1px solid rgba(36, 95, 69, 0.18);
    background: rgba(244, 246, 242, 0.96);
    box-shadow: 0 8px 22px rgba(31, 43, 36, 0.08);
  }

  .brand {
    font-size: 22px;
    line-height: 1.2;
  }

  .topbar .inline-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .user-badge {
    min-height: 44px;
    justify-content: center;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 700;
  }

  .button.compact,
  button.compact {
    min-height: 44px;
    padding: 0 14px;
    font-size: 15px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
  }

  .sidebar {
    display: flex;
    gap: 10px;
    margin: 0 -12px;
    padding: 0 12px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 52px;
    min-width: 104px;
    justify-content: center;
    border-radius: 12px;
    padding: 0 16px;
    box-shadow: 0 6px 16px rgba(31, 43, 36, 0.06);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
  }

  .nav-item.active {
    border-left: 1px solid var(--primary);
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(36, 95, 69, 0.22);
  }

  .hero,
  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 21px;
  }

  .lead,
  .card p,
  .doc-card p,
  .file-row p,
  .empty-state,
  .meta {
    font-size: 15px;
  }

  input,
  textarea,
  select {
    min-height: 48px;
    font-size: 16px;
  }

  .button,
  button {
    min-height: 48px;
    font-size: 16px;
    width: 100%;
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .search-form button {
    width: 44px;
    padding: 0;
  }
}
