:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef5fb;
  --line: #d5e3f1;
  --line-strong: #a9c8e8;
  --text: #10243e;
  --muted: #63758c;
  --primary: #0b72d9;
  --primary-dark: #0758ad;
  --success: #08945f;
  --warning: #d97706;
  --danger: #d31f2a;
  --blue-soft: #e8f2ff;
  --green-soft: #e9f8f1;
  --orange-soft: #fff1df;
  --purple-soft: #f1ecff;
  --shadow: 0 12px 32px rgba(22, 46, 78, 0.08);
  --radius: 8px;
  --font: "Segoe UI", Arial, sans-serif;
}

.material-topbar {
  gap: 12px;
}

.material-top-title {
  margin: 0;
  font-size: 24px;
  color: #071d3a;
  white-space: nowrap;
}

.material-main {
  max-width: none;
  padding: 18px 12px 72px;
}

.material-filter {
  padding: 14px;
}

.material-filter-grid,
.material-entry-grid,
.material-stock-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.material-entry-grid {
  align-items: start;
}

.material-stock-grid {
  grid-template-columns: minmax(160px, 1fr) minmax(260px, 2fr) minmax(120px, .8fr) auto auto auto;
}

.material-entry-grid .span-2,
.material-filter-grid .span-2 {
  grid-column: span 2;
}

.material-entry-grid .span-3,
.material-filter-grid .span-3 {
  grid-column: span 3;
}

.material-entry-grid textarea {
  min-height: 76px;
}

.material-section {
  margin-top: 12px;
}

.material-form-actions {
  margin: 10px 0;
}

.material-table-wrap {
  max-height: 430px;
}

.material-table-wrap.small-scroll {
  max-height: 320px;
}

.material-entry-table {
  min-width: 980px;
}

.material-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.material-band {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.material-band .field {
  width: 170px;
}

.material-subsection {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid #dbe7f3;
}

.material-subsection h3,
.material-manual-panel h3 {
  margin: 0 0 10px;
  color: #123f70;
  font-size: 18px;
}

.material-sub-divider {
  height: 1px;
  margin: 20px 0 16px;
  background: var(--line);
}

.material-check {
  margin: 0 0 8px;
}

.material-progress {
  min-height: 36px;
  min-width: 148px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #b9d2ed;
  border-radius: 6px;
  color: #173957;
  background: #f7fbff;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

.material-progress-track {
  width: 78px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe7f3;
}

.material-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .18s ease;
}

.material-progress-text {
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.material-progress.done .material-progress-fill {
  background: var(--success);
}

.material-progress.error .material-progress-fill {
  background: var(--danger);
}

.simple-table tr.alert td,
.material-table-wrap tr.alert td {
  background: #fff0f0;
  color: #a10000;
  font-weight: 700;
}

.material-report-tools .field.mini {
  width: 110px;
}

.material-report-shell {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #dfe7ef;
  overflow: auto;
}

.material-report-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 28px;
  padding: var(--material-report-top, 25mm) var(--material-report-right, 20mm) var(--material-report-bottom, 20mm) var(--material-report-left, 25mm);
  background: #fff;
  color: #000;
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 1.35;
  box-shadow: 0 2px 10px rgba(15, 33, 56, .18);
  outline: none;
}

.material-report-page:last-child {
  margin-bottom: 0;
}

.material-report-page,
.material-report-page * {
  font-family: "Times New Roman", Times, serif !important;
  letter-spacing: 0;
}

.inchu-main {
  max-width: none;
  padding: 12px 10px 72px;
}

.inchu-workbench {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.inchu-copy-btn {
  width: 100%;
  min-height: 86px;
  border: 0;
  border-radius: 8px;
  background: #07844f;
  color: #fff;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.inchu-copy-btn:active {
  transform: translateY(1px);
}

.inchu-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f6fc;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.segmented button.active {
  background: var(--primary);
  color: #fff;
}

.inchu-form-grid {
  display: grid;
  grid-template-columns: minmax(520px, 3fr) repeat(3, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.inchu-form-grid .span-3 {
  grid-column: span 1;
}

.inchu-size-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 56px;
  font-size: 34px;
  font-weight: 900;
}

.inchu-size-row input,
.inchu-entry-section .field input {
  min-height: 52px;
  border: 2px solid #aac9ea;
  border-radius: 8px;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}

.inchu-size-row .small-input {
  width: 86px;
}

.inchu-size-row .mid-input {
  width: 108px;
}

.inchu-size-row .large-input {
  width: 138px;
}

.inchu-size-row .round-input {
  width: 170px;
}

.inchu-result {
  min-height: 150px;
  margin-top: 14px;
  padding: 22px;
  border: 6px solid #d31f2a;
  border-radius: 8px;
  background: #fff5f5;
  color: #d31f2a;
  font-size: clamp(38px, 6vw, 74px);
  font-weight: 950;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.inchu-logo {
  display: inline-block;
  margin-right: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #d40000;
  color: #fff;
}

.inchu-alert {
  display: none;
  margin-top: 12px;
  padding: 14px;
  border: 2px solid #d31f2a;
  border-radius: 8px;
  background: #fff0f0;
  color: #a10000;
  font-size: 18px;
  font-weight: 900;
}

.inchu-alert.show {
  display: block;
}

.inchu-history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.inchu-catalog-table .row-actions {
  white-space: nowrap;
}

.status-line.ok {
  color: var(--success);
}

@media (max-width: 980px) {
  .inchu-form-grid,
  .inchu-history-grid {
    grid-template-columns: 1fr;
  }

  .inchu-size-row {
    font-size: 30px;
  }

  .inchu-size-row input,
  .inchu-entry-section .field input {
    font-size: 26px;
  }
}

@media (max-width: 620px) {
  .inchu-topbar .material-top-title {
    width: 100%;
  }

  .inchu-copy-btn {
    min-height: 82px;
    font-size: 30px;
  }

  .inchu-tools,
  .inchu-type-tabs {
    width: 100%;
  }

  .inchu-type-tabs button {
    flex: 1;
  }

  .inchu-size-row .small-input {
    width: 78px;
  }

  .inchu-size-row .mid-input {
    width: 96px;
  }

  .inchu-size-row .large-input {
    width: 124px;
  }

  .inchu-size-row .round-input {
    width: 145px;
  }

  .inchu-result {
    padding: 16px;
    border-width: 4px;
    font-size: 40px;
  }
}

.material-report-page h1 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 16pt;
  text-transform: uppercase;
}

.material-report-page h2 {
  margin: 12px 0 4px;
  font-size: 13pt;
}

.material-report-page h3 {
  margin: 8px 0 4px;
  font-size: 12.5pt;
}

.material-report-page p {
  margin: 4px 0;
}

.material-report-page table {
  width: 100%;
  min-width: 0;
  margin: 6px 0 10px;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 10pt;
}

.material-report-page th,
.material-report-page td {
  position: static;
  border: 1px solid #000;
  padding: 4px 5px;
  background: #fff;
  color: #000;
  overflow-wrap: anywhere;
}

.material-report-page th {
  text-align: center;
  font-weight: 700;
}

.material-report-page .num {
  text-align: right;
}

.material-report-page .center {
  text-align: center;
}

.material-report-page[contenteditable="true"] th,
.material-report-page[contenteditable="true"] td {
  resize: both;
}

@media print {
  body.material-page * {
    visibility: hidden;
  }

  body.material-page .material-report-shell,
  body.material-page .material-report-shell * {
    visibility: visible;
  }

  body.material-page .material-report-shell {
    position: absolute;
    inset: 0 auto auto 0;
    width: 210mm;
    padding: 0;
    border: 0;
    background: #fff;
    overflow: visible;
  }

  body.material-page .material-report-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }

  body.material-page .material-report-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  @page {
    size: A4;
    margin: 0;
  }
}

@media (max-width: 900px) {
  .material-main {
    padding-left: 8px;
    padding-right: 8px;
  }

  .material-top-title {
    font-size: 20px;
  }

  .material-filter-grid,
  .material-entry-grid,
  .material-stock-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .material-entry-grid .span-2,
  .material-entry-grid .span-3,
  .material-filter-grid .span-2,
  .material-filter-grid .span-3 {
    grid-column: span 2;
  }

  .material-report-page {
    transform-origin: top left;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  border: 0;
}

.ui-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(15, 45, 77, .06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  font-weight: 800;
  color: #164071;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #2068ff, #08b8b3);
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .48), 0 12px 22px rgba(13, 79, 139, .24);
  background-size: cover;
  background-position: center;
  transition: transform .18s ease, box-shadow .18s ease;
}

.brand-mark.has-image {
  background-color: #fff;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, .7);
}

.brand:hover .brand-mark {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), 0 12px 22px rgba(13, 79, 139, .24);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  background: transparent;
  border-color: transparent;
  padding: 0 4px;
}

.user-meta {
  display: grid;
  gap: 2px;
  min-width: 120px;
}

.user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 10px 22px rgba(15, 45, 77, .18);
  background: #eaf4ff;
}

.user-avatar.placeholder {
  display: grid;
  place-items: center;
  color: #0b72d9;
  font-weight: 900;
}

.user-online {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #edf9f3;
  color: #078052;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 16px rgba(7, 128, 82, .08);
}

.user-online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .16);
}

.topbar-spacer {
  flex: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-actions .btn {
  white-space: nowrap;
}

.topbar .btn {
  min-height: 42px;
  border-color: #dbe8f6;
  background: #f4f8fd;
}

.topbar .btn.primary {
  color: #fff;
  background: linear-gradient(145deg, #1677e8, #075ec2);
}

.topbar .btn:hover {
  transform: translateY(-4px);
}

.notification-btn {
  position: relative;
}

.ui-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.notification-btn.has-alerts {
  color: #8a1515;
  background: #ffe5e5;
}

.main {
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px 28px 34px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: start;
}

.home-main-panel {
  position: relative;
  min-height: calc(100vh - 122px);
  padding: 28px 34px 36px;
  border: 1px solid rgba(207, 226, 246, .74);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(247,251,255,.94), rgba(247,251,255,.82)),
    radial-gradient(circle at 8% 24%, rgba(37, 99, 235, .12), transparent 30%),
    linear-gradient(135deg, #f7fbff, #edf6ff 48%, #f7fbff);
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 42px rgba(20, 56, 94, .08);
}

.home-main-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,.48) 62%, transparent),
    repeating-linear-gradient(90deg, rgba(16, 90, 160, .025) 0 1px, transparent 1px 96px);
}

.home-main-panel > * {
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  min-height: 230px;
  display: flex;
  align-items: center;
  padding: 4px 0 28px;
}

.hero-brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  width: min(760px, 100%);
}

.hero-brand-image {
  display: block;
  width: min(680px, 100%);
  max-height: 220px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 18px 28px rgba(6, 31, 72, .16));
}

.hero:not(.has-logo) .hero-brand-image {
  display: none;
}

.hero-fallback-copy {
  display: flex;
  align-items: center;
  gap: 24px;
}

.hero.has-logo .hero-fallback-copy {
  display: none;
}

.hero-logo {
  width: 104px;
  height: 104px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 35%),
    conic-gradient(from 220deg, #0f766e, #11a5ce, #174ea6, #092b63, #0f766e);
  box-shadow: var(--shadow);
  position: relative;
  background-size: cover;
  background-position: center;
}

.hero-logo::after {
  content: "Q";
  position: absolute;
  inset: 16px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  color: #0d4f8b;
  font-size: 48px;
  font-weight: 900;
}

.hero-logo.has-image::after {
  display: none;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 48px;
  line-height: 1.05;
  color: #071d3a;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.hero-dots {
  position: absolute;
  right: 8px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 14px;
}

.hero-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 999px;
  background: rgba(15, 45, 77, .30);
  box-shadow: 0 1px 3px rgba(15, 45, 77, .18);
  transition: width .2s ease, background .2s ease, transform .2s ease;
}

.hero-dots button:hover {
  transform: translateY(-1px);
}

.hero-dots button.active {
  width: 24px;
  background: #0b72d9;
}

.home-tools {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 240px 260px;
  gap: 16px;
  margin: 0 0 26px;
}

.searchbox,
.metric-tile {
  height: 66px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .88);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  box-shadow: 0 14px 28px rgba(22, 46, 78, 0.10), inset 0 1px 0 rgba(255,255,255,.88);
}

.searchbox input {
  flex: 1;
  height: 38px;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
}

.keycap {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fbff;
  white-space: nowrap;
}

.metric-icon,
.app-icon,
.notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  font-weight: 800;
}

.metric-icon {
  width: 44px;
  height: 44px;
  color: #fff;
  background: linear-gradient(145deg, #1b7dff, #0a5fc2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 12px 22px rgba(11, 114, 217, .20);
}

.metric-icon.green {
  background: linear-gradient(145deg, #12b981, #087a55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 12px 22px rgba(8, 148, 95, .20);
}

.metric-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.metric-tile strong {
  display: block;
  font-size: 17px;
}

.metric-tile > div > span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.welcome-band {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0 22px;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaf4ff;
  color: var(--primary);
  box-shadow: 0 12px 24px rgba(11, 114, 217, .16);
}

.welcome-icon .ui-icon {
  width: 30px;
  height: 30px;
}

.welcome-band h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.welcome-band p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 18px 20px;
}

.app-card {
  position: relative;
  min-height: 226px;
  padding: 22px 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.90)),
    radial-gradient(circle at 50% 42%, var(--app-soft), transparent 62%);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  box-shadow: 0 18px 34px rgba(22, 46, 78, 0.10), inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), border-color 0.18s ease, box-shadow 0.22s ease, background 0.18s ease;
  overflow: hidden;
  isolation: isolate;
  perspective: 900px;
}

.app-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background:
    linear-gradient(90deg, transparent, var(--app-color), transparent),
    linear-gradient(90deg, var(--app-soft), var(--app-color));
  opacity: .86;
  box-shadow: 0 -8px 20px color-mix(in srgb, var(--app-color) 22%, transparent);
}

.app-card:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 34px rgba(22, 46, 78, 0.15), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.app-card:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(22, 46, 78, 0.12), inset 0 1px 0 rgba(255, 255, 255, .7);
}

.app-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app-order {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--app-color), color-mix(in srgb, var(--app-color) 78%, #ffffff));
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--app-color) 52%, #ffffff);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34), 0 10px 18px color-mix(in srgb, var(--app-color) 18%, transparent);
}

.app-visual {
  position: relative;
  width: min(152px, 74%);
  height: 92px;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.app-visual::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 4px;
  height: 34px;
  border-radius: 50%;
  background: var(--app-soft);
  filter: blur(1px);
  opacity: .95;
}

.app-visual::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 8px;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--app-color) 20%, transparent);
}

.app-visual-glow {
  position: absolute;
  width: 104px;
  height: 78px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.84), transparent 32%),
    linear-gradient(145deg, rgba(255,255,255,.78), var(--app-soft));
  transform: rotate(-2deg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 12px 24px color-mix(in srgb, var(--app-color) 14%, transparent);
}

.app-icon-flip {
  position: relative;
  z-index: 1;
  width: 86px;
  height: 86px;
  transform-style: preserve-3d;
  transition: transform .58s cubic-bezier(.22,.8,.2,1);
}

.app-card:hover .app-icon-flip,
.app-card:focus-visible .app-icon-flip,
.app-card:active .app-icon-flip {
  transform: rotateY(180deg);
}

.app-icon-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 22px;
  backface-visibility: hidden;
  overflow: hidden;
  color: var(--app-color);
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), var(--app-soft)),
    #fff;
  border: 1px solid color-mix(in srgb, var(--app-color) 20%, #ffffff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88), 0 16px 28px color-mix(in srgb, var(--app-color) 15%, transparent);
}

.app-icon-face .ui-icon {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 5px 7px color-mix(in srgb, var(--app-color) 16%, transparent));
}

.app-icon-back {
  transform: rotateY(180deg);
  background: #fff;
}

.app-icon-back.has-image {
  border-radius: 50%;
  border: 3px solid #fff;
}

.app-icon-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-card strong {
  text-align: center;
  font-size: 18px;
  line-height: 1.25;
  margin-top: 2px;
  color: #071d3a;
  z-index: 1;
}

.app-desc {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  z-index: 1;
}

.app-go {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--app-color), color-mix(in srgb, var(--app-color) 72%, #ffffff));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .18s ease, background .18s ease;
  z-index: 1;
}

.app-card:hover .app-go {
  transform: translateX(3px);
  background: linear-gradient(145deg, color-mix(in srgb, var(--app-color) 88%, #ffffff), var(--app-color));
}

.notice-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.95);
  padding: 18px 16px;
  box-shadow: 0 18px 42px rgba(22, 46, 78, 0.10), inset 0 1px 0 rgba(255,255,255,.85);
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 118px);
  overflow: auto;
}

.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.notice-head h2 {
  margin: 0;
  font-size: 20px;
}

.notice-list {
  display: grid;
}

.notice {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.notice-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.notice-edit-btn {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 12px;
}

.notice-icon {
  width: 48px;
  height: 48px;
  background: var(--orange-soft);
  color: var(--warning);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 18px rgba(217, 119, 6, .10);
}

.notice-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.notice h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

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

.notice-time {
  color: #64748b;
  white-space: nowrap;
  padding-top: 3px;
}

.alert-notice {
  background: #fff7ed;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}

.alert-notice.warning {
  background: #fff1f1;
}

.footer-status {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: center;
  min-height: 54px;
  padding: 8px 28px;
  border-top: 1px solid var(--line);
  background: rgba(240, 247, 255, 0.94);
  color: #314760;
  backdrop-filter: blur(12px);
}

.footer-status > div:nth-child(2) {
  text-align: center;
}

.footer-status > div:nth-child(3) {
  text-align: right;
}

.btn,
.icon-btn,
.link-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(11, 114, 217, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 7px 14px rgba(22, 46, 78, .08);
  transition: filter 0.15s ease, transform 0.18s cubic-bezier(.2,.8,.2,1), background 0.15s ease, box-shadow .18s ease;
}

.btn:hover,
.icon-btn:hover,
.link-btn:hover {
  filter: brightness(0.98);
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 12px 22px rgba(22, 46, 78, .13);
}

.btn:active,
.icon-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .08), 0 4px 10px rgba(22, 46, 78, .08);
}

.btn.primary {
  color: #fff;
  background: var(--primary);
}

.btn.success {
  color: #fff;
  background: var(--success);
}

.btn.warning {
  color: #a24b00;
  background: #fff7ec;
  border: 1px solid #f5b76a;
}

.btn.danger {
  color: #fff;
  background: var(--danger);
}

.btn.ghost,
.icon-btn,
.link-btn {
  color: #173957;
  background: #e7f0f8;
}

.btn.small {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-btn {
  width: 38px;
  padding: 0;
}

.text-link {
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title h1 {
  margin: 0;
  font-size: 28px;
}

.qc-topbar {
  min-height: 74px;
  gap: 14px;
  padding: 8px 22px;
}

.qc-top-title {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  color: #071d3a;
  white-space: nowrap;
}

.qc-topbar .field {
  width: 86px;
}

.qc-topbar .btn {
  min-width: 102px;
}

.qc-staff-board {
  margin: -2px 0 8px;
}

.qc-staff-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(142px, 1fr));
  gap: 6px;
  align-items: stretch;
}

.qc-staff-card {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 6px 8px;
  padding: 6px;
}

.qc-staff-card.stale {
  border: 2px solid #ef4444;
  background: #fff1f1;
}

.qc-staff-avatar {
  position: relative;
  grid-row: 1 / 3;
  min-width: 0;
}

.qc-staff-avatar img,
.qc-avatar-placeholder {
  width: 62px;
  height: 78px;
  border: 1px solid #cfe2f6;
  border-radius: 6px;
  background: #f1f7ff;
  object-fit: cover;
}

.qc-avatar-placeholder {
  display: grid;
  place-items: center;
}

.qc-avatar-placeholder span {
  width: 26px;
  height: 26px;
  border: 2px solid #82aee8;
  border-radius: 50%;
  position: relative;
}

.qc-avatar-placeholder span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 34px;
  height: 24px;
  border: 2px solid #82aee8;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  transform: translateX(-50%);
}

.qc-camera-badge {
  position: absolute;
  left: 18px;
  bottom: 4px;
  width: 24px;
  height: 20px;
  border: 1px solid #b9d2ed;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 12px;
}

.qc-staff-content {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.qc-staff-state {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 3px;
  background: #e9f8f1;
  color: #08945f;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.qc-staff-state span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.qc-staff-card.stale .qc-staff-state {
  background: #fff1df;
  color: #d97706;
}

.qc-staff-metric {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  color: #27425e;
  font-size: 11px;
  line-height: 1.15;
}

.qc-staff-metric strong {
  color: var(--primary);
  font-size: 14px;
  white-space: nowrap;
}

.qc-mini-icon {
  color: #5d91dd;
  text-align: center;
}

.qc-staff-name {
  grid-column: 2;
  align-self: end;
  overflow: hidden;
  color: #0a1f35;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-staff-card.stale .qc-staff-name {
  color: #b91c1c;
}

.qc-staff-empty {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--warning);
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
}

.field.user-badge {
  display: flex;
  align-items: center;
  gap: 9px;
}

.field.user-badge .user-avatar.placeholder {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
}

.field span,
.field label {
  font-size: 12px;
  font-weight: 700;
  color: #27425e;
}

.field input,
.field select,
.field textarea,
.table-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #b9d2ed;
  border-radius: 5px;
  padding: 6px 8px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.table-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 114, 217, 0.12);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.invalid-input {
  border-color: #ef4444 !important;
  background: #fff1f1 !important;
}

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

.status-line {
  min-height: 20px;
  color: var(--success);
  font-weight: 700;
}

.status-line.warn {
  color: var(--warning);
}

.qc-section {
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.qc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.qc-section-head h2 {
  margin: 0;
  font-size: 20px;
}

.qc-section-body {
  padding: 12px 0 0;
}

.section-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 0 12px 10px;
}

.qc-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #b9d9f8;
  border-radius: 6px;
  background: #eef7ff;
  color: #24506f;
  font-size: 12px;
  font-weight: 800;
}

.qc-live-indicator > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3984bc;
  box-shadow: 0 0 0 3px rgba(57, 132, 188, 0.14);
}

.qc-live-indicator.ok > span {
  background: #0a9b63;
  box-shadow: 0 0 0 3px rgba(10, 155, 99, 0.14);
}

.qc-live-indicator.updated {
  border-color: #86d9b6;
  background: #eafaf3;
  color: #08734a;
}

.qc-live-indicator.updated > span {
  background: #08a66a;
  animation: qc-live-pulse 1s ease-out 2;
}

.qc-live-indicator.error {
  border-color: #fecaca;
  background: #fff1f1;
  color: #a31919;
}

.qc-live-indicator.error > span {
  background: #dc2626;
}

@keyframes qc-live-pulse {
  50% { transform: scale(1.35); box-shadow: 0 0 0 6px rgba(8, 166, 106, 0.12); }
}

.data-note {
  padding: 0 12px 8px;
  color: #d76600;
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.data-table,
.summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.data-table th,
.data-table td,
.summary-table th,
.summary-table td {
  border: 1px solid var(--line);
  padding: 6px 7px;
  vertical-align: middle;
  color: #0f273f;
}

.data-table th,
.summary-table th {
  background: #e9f4ff;
  color: #001d3d;
  font-weight: 800;
  text-align: center;
}

.qc-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 2px 1px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.qc-filter-trigger span {
  flex: 0 0 auto;
  color: #4b6987;
  font-size: 11px;
}

.qc-filter-trigger.active {
  color: #075cb5;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.qc-filter-popup {
  position: fixed;
  z-index: 180;
  width: 320px;
  max-height: min(430px, calc(100vh - 24px));
  overflow: auto;
  padding: 12px;
  border: 1px solid #a9c8e7;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 45, 75, 0.25);
}

.qc-filter-popup-head,
.qc-filter-sort-row,
.qc-filter-popup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qc-filter-popup-head {
  margin-bottom: 9px;
  color: #092b4d;
}

.qc-filter-sort-row {
  margin-bottom: 8px;
}

.qc-filter-sort-row .btn {
  flex: 1 1 0;
}

.qc-filter-popup > .table-input {
  min-height: 36px;
  margin-bottom: 7px;
}

.qc-filter-select-all,
.qc-filter-options label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 5px;
  color: #173a5c;
  cursor: pointer;
}

.qc-filter-select-all {
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.qc-filter-options {
  max-height: 230px;
  overflow: auto;
  margin-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.qc-filter-options label:hover {
  background: #eef6ff;
}

.qc-filter-options input,
.qc-filter-select-all input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #1478d4;
}

.qc-filter-popup-foot {
  justify-content: flex-end;
}

.data-table td {
  min-height: 42px;
  word-break: break-word;
}

.data-table .input-row td {
  background: #f8fbff;
}

.data-table textarea.table-input {
  min-height: 34px;
  resize: vertical;
}

.qc-main {
  max-width: none;
  padding-left: 14px;
  padding-right: 14px;
}

.qc-main .table-wrap {
  overflow-x: hidden;
}

.qc-main .data-table,
.qc-main .summary-table {
  min-width: 0;
  table-layout: fixed;
}

.qc-main .data-table th,
.qc-main .data-table td,
.qc-main .summary-table th,
.qc-main .summary-table td {
  padding: 5px 5px;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.qc-main .table-input {
  min-width: 0;
  min-height: 32px;
  padding: 5px 5px;
  font-size: 12px;
}

.qc-main .data-table textarea.table-input {
  min-height: 32px;
}

.actions-cell {
  width: 112px;
  min-width: 112px;
  text-align: center;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.row-actions .btn {
  min-height: 28px;
}

.qc-main .actions-cell {
  width: auto;
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
}

.qc-main .row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.qc-main .row-actions .btn {
  width: 100%;
  min-width: 0;
  padding: 5px 4px;
  white-space: normal;
}

.tt-col {
  width: 42px;
  text-align: center;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #314760;
  font-weight: 700;
}

.summary-block {
  margin: 12px 6px 22px;
}

.summary-block h3 {
  margin: 18px 0 10px;
  font-size: 18px;
}

.summary-table td {
  text-align: center;
}

.summary-table td:nth-child(2),
.summary-table th:nth-child(2) {
  text-align: left;
}

.summary-table .total-row td {
  background: #fff7d6;
  font-weight: 800;
}

.summary-editor {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #f3f8ff;
}

.summary-editor label {
  font-weight: 800;
  color: #0f4d89;
}

.summary-editor input {
  width: 260px;
}

.qc-monitor-table .admin-qc-avatar {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #f1f7ff;
}

.qc-monitor-table .admin-qc-avatar.placeholder {
  display: grid;
  place-items: center;
  color: #487bc1;
  font-size: 20px;
}

.admin-user-avatar-cell {
  display: grid;
  gap: 6px;
  min-width: 130px;
}

.admin-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 8px 16px rgba(15, 45, 77, .15);
  background: #eaf4ff;
}

.admin-user-avatar.placeholder {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 900;
}

.push-status {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1fbf7;
  color: #07543b;
}

.push-status.warn {
  background: #fff7ed;
  color: #9a3412;
}

.push-settings-grid,
.push-task-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.push-settings-grid .wide,
.push-task-form .wide {
  grid-column: 1 / -1;
}

.check-field {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
  font-weight: 800;
  color: #173957;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.push-actions {
  margin-bottom: 14px;
}

.push-code-block {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
}

.push-code-block code {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 5px;
  background: #0f2d4d;
  color: #fff;
}

.mobile-suggest-panel {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 220;
  display: none;
  max-height: 42vh;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(12, 30, 52, 0.22);
  overscroll-behavior: contain;
}

.mobile-suggest-panel.open {
  display: block;
}

.mobile-suggest-list {
  display: grid;
  gap: 6px;
  max-height: inherit;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-suggest-list button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
}

.doc-page-wrap {
  padding: 22px 0 40px;
  overflow-x: auto;
  background: #eef3f8;
}

.doc-page {
  width: 794px;
  margin: 0 auto;
  color: #000;
  font-family: "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
}

.report-page {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto 28px;
  padding: 38px;
  background: #fff;
  box-shadow: 0 6px 30px rgba(20, 42, 66, 0.14);
}

.report-page:last-child {
  margin-bottom: 0;
}

.doc-page h1 {
  text-align: center;
  font-size: 18px;
  margin: 0 0 20px;
}

.doc-page h2 {
  font-size: 15px;
  margin: 12px 0 6px;
}

.doc-page p {
  margin: 4px 0;
}

.doc-page table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 6px 0 10px;
}

.doc-page th,
.doc-page td {
  border: 1px solid #000;
  padding: 3px 5px;
  vertical-align: top;
  min-width: 24px;
  min-height: 18px;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.doc-page[contenteditable="true"] th,
.doc-page[contenteditable="true"] td {
  resize: both;
}

.doc-page.report-col-resize,
.doc-page.report-col-resize * {
  cursor: col-resize !important;
}

.doc-page.report-row-resize,
.doc-page.report-row-resize * {
  cursor: row-resize !important;
}

.doc-page:focus .report-page {
  box-shadow: 0 0 0 2px rgba(23, 119, 216, 0.22), 0 6px 30px rgba(20, 42, 66, 0.14);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 14, 28, 0.46);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(760px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.modal.large {
  width: min(1160px, 100%);
}

.modal.confirm-modal {
  width: min(440px, 100%);
}

.confirm-modal .modal-body p {
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
}

.modal.defect-limit-modal {
  width: min(1480px, 98vw);
  max-height: 94vh;
}

.defect-limit-modal .modal-head > div > p {
  margin: 4px 0 0;
}

.defect-limit-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.defect-limit-tabs .tab {
  display: grid;
  min-height: 56px;
  padding: 7px 9px;
  text-align: left;
}

.defect-limit-tabs .tab span {
  overflow: hidden;
  color: #526b83;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defect-limit-tabs .tab.active span {
  color: #eaf5ff;
}

.defect-limit-add {
  display: grid;
  grid-template-columns: minmax(260px, 540px) auto;
  align-items: end;
  gap: 9px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid #c8dcf0;
  border-radius: 6px;
  background: #f4f9ff;
}

.defect-limit-help {
  margin: 8px 0;
}

.defect-limit-table-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.defect-limit-table {
  min-width: 1060px;
  table-layout: fixed;
}

.defect-limit-table th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.defect-limit-table th:nth-child(1) { width: 48px; }
.defect-limit-table th:nth-child(2) { width: 210px; }
.defect-limit-table th:nth-child(3) { width: 145px; }
.defect-limit-table th:nth-child(n+4):nth-child(-n+8) { width: 88px; }
.defect-limit-table th:nth-child(9) { width: 170px; }

.defect-limit-table tr.editing td {
  background: #fffbee;
}

.defect-limit-table tr:nth-child(3n+1) td {
  border-top-width: 2px;
  border-top-color: #a9c8e7;
}

.defect-limit-order {
  text-align: center;
  font-weight: 900;
}

.defect-limit-name {
  vertical-align: top !important;
}

.defect-limit-name strong {
  display: block;
  margin-bottom: 12px;
  color: #092b4d;
  font-size: 14px;
}

.defect-level-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 5px;
  background: #eef5fc;
  color: #234867;
  font-size: 12px;
  font-weight: 800;
}

.defect-level-label.max { background: #fff0f0; color: #a52626; }
.defect-level-label.common { background: #fff7df; color: #8d5b00; }
.defect-level-label.min { background: #eaf8f2; color: #08704a; }

.defect-image-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 34px;
  margin: auto;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.defect-image-cell {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.defect-image-note-btn {
  min-width: 54px;
  padding: 2px 5px;
  border: 1px solid #bdd0e3;
  border-radius: 4px;
  background: #f4f8fc;
  color: #35526d;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.defect-image-note-btn.has-note {
  border-color: #7caee0;
  background: #e5f2ff;
  color: #075baa;
}

.defect-image-note-btn.hidden-note {
  border-color: #e1ae67;
  background: #fff4dc;
  color: #965500;
}

.defect-image-note-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 55, 90, 0.14);
}

button.defect-image-slot:hover:not(:disabled),
label.defect-image-slot:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(15, 55, 90, 0.16);
}

.defect-image-slot.empty {
  border-color: #f4b8b8;
  background: #ffe8e8;
  color: #a92b2b;
}

.defect-image-slot.has-image {
  border-color: #65c39c;
  background: #dff7ec;
  color: #08724b;
}

.defect-image-slot.selected {
  border-color: #136fca;
  background: #dceeff;
  color: #075baa;
  box-shadow: inset 0 0 0 2px #86bff2;
}

.defect-image-slot input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.defect-image-slot.delete input:disabled + span {
  opacity: 0.45;
}

.defect-limit-actions .row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.defect-limit-actions .btn {
  width: 100%;
  min-width: 0;
  padding-left: 5px;
  padding-right: 5px;
}

.defect-limit-status {
  min-height: 22px;
  padding-top: 9px;
  color: #526b83;
  font-size: 12px;
  font-weight: 700;
}

.modal.defect-limit-image-modal {
  width: min(1380px, 98vw);
  max-height: 96vh;
}

.defect-limit-image-viewer {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  min-height: 320px;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.defect-limit-image-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f9fc;
}

.defect-limit-image-toolbar .icon-btn {
  font-size: 22px;
  line-height: 1;
}

.defect-limit-image-toolbar .muted {
  margin-left: 6px;
  font-size: 12px;
}

.defect-limit-image-stage {
  display: grid;
  place-items: center;
  height: min(68vh, 860px);
  min-height: 260px;
  overflow: hidden;
  background: #0d1a27;
  touch-action: none;
  user-select: none;
}

.defect-limit-image-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
  cursor: zoom-in;
  will-change: transform;
}

.defect-limit-image-stage.zoomed img {
  cursor: grab;
}

.defect-limit-image-stage.dragging img {
  cursor: grabbing;
}

.defect-limit-image-note-panel {
  max-height: 220px;
  padding: 10px 14px 12px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: #fff;
}

.defect-limit-image-note-panel.hidden {
  display: none;
}

.defect-image-note-head,
.defect-image-note-actions,
.defect-image-note-view,
.defect-image-note-hidden-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.defect-image-note-hidden-row {
  justify-content: space-between;
  min-height: 34px;
}

.defect-image-note-head {
  justify-content: space-between;
  margin-bottom: 7px;
}

.defect-image-note-panel textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
}

.defect-image-note-actions {
  justify-content: flex-end;
  margin-top: 7px;
}

.defect-note-state {
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.defect-note-state.visible {
  background: #e1f6eb;
  color: #08704a;
}

.defect-note-state.hidden-note {
  background: #fff0dc;
  color: #965500;
}

.defect-image-note-view {
  align-items: flex-start;
  line-height: 1.5;
}

.defect-image-note-view strong {
  flex: 0 0 auto;
  color: #123b61;
}

.defect-image-note-view span {
  white-space: pre-wrap;
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-body {
  padding: 18px;
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
}

.alert-item.warning {
  border-color: #fecaca;
  background: #fff1f1;
}

.alert-item strong {
  display: block;
  color: #0f273f;
}

.alert-item p {
  margin: 5px 0;
  color: #314760;
}

.alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.alert-meta {
  color: var(--muted);
  font-size: 12px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #173b63;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.login-remember input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.login-security-note {
  margin: -5px 0 0;
  line-height: 1.45;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 6px;
  background: #e7f0f8;
  color: #173957;
  font-weight: 800;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  background: var(--primary);
}

.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.side-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

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

.simple-table th,
.simple-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: middle;
}

.simple-table th {
  color: #173957;
  background: #f1f7ff;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 72px;
  z-index: 200;
  display: none;
  max-width: 440px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #0f2d4d;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.open {
  display: block;
}

.placeholder-view {
  max-width: 760px;
  margin: 60px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.placeholder-view h1 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .home-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .notice-panel {
    position: static;
    max-height: none;
  }

  .home-tools {
    grid-template-columns: 1fr;
  }

  .qc-staff-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pwa-actions {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar-spacer {
    display: none;
  }

  .top-actions {
    order: 4;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .topbar .btn {
    white-space: nowrap;
  }

  .user-badge {
    flex: 0 0 auto;
  }

  .user-meta {
    min-width: 100px;
  }

  .main {
    padding: 12px 10px 28px;
  }

  .home-main-panel {
    min-height: auto;
    padding: 18px 14px 22px;
  }

  .hero {
    min-height: 152px;
    padding-bottom: 20px;
  }

  .hero-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .hero-logo::after {
    inset: 12px;
    font-size: 32px;
  }

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

  .hero-brand-image {
    width: min(100%, 460px);
    max-height: 148px;
  }

  .hero-dots {
    right: 2px;
    bottom: 8px;
  }

  .home-tools {
    gap: 10px;
    margin-bottom: 18px;
  }

  .searchbox,
  .metric-tile {
    height: 58px;
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(138px, 1fr));
    gap: 12px;
  }

  .app-card {
    min-height: 190px;
    padding: 20px 12px 18px;
  }

  .app-visual {
    width: 132px;
    height: 78px;
  }

  .app-icon-flip {
    width: 70px;
    height: 70px;
  }

  .app-icon-face {
    border-radius: 18px;
  }

  .app-icon-face .ui-icon {
    width: 36px;
    height: 36px;
  }

  .app-card strong {
    font-size: 15px;
  }

  .app-desc {
    font-size: 12px;
  }

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

  .notice-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .notice-icon {
    width: 40px;
    height: 40px;
  }

  .footer-status {
    grid-template-columns: 1fr;
    text-align: left;
  }

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

  .footer-status > div:nth-child(2),
  .footer-status > div:nth-child(3) {
    text-align: left;
  }

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

  .qc-topbar .field {
    width: 92px;
  }

  .qc-topbar .btn {
    min-width: 0;
  }

  .qc-staff-grid {
    grid-template-columns: 1fr;
  }

  .push-settings-grid,
  .push-task-form {
    grid-template-columns: 1fr;
  }

  .qc-main {
    padding-left: 8px;
    padding-right: 8px;
  }

  .qc-main .table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .qc-main .data-table {
    min-width: 1480px;
  }

  .qc-main .data-table[data-render-table="quality"],
  .qc-main .data-table[data-render-table="kph"] {
    min-width: 1780px;
  }

  .qc-main .summary-table {
    min-width: 1280px;
  }

  .qc-main .data-table th,
  .qc-main .data-table td,
  .qc-main .summary-table th,
  .qc-main .summary-table td {
    font-size: 13px;
    line-height: 1.3;
  }

  .qc-main .table-input {
    min-height: 40px;
    font-size: 16px;
  }

  .qc-main .data-table textarea.table-input {
    min-height: 54px;
    font-size: 16px;
  }

  .qc-live-indicator {
    flex: 1 1 150px;
    justify-content: center;
  }

  .qc-filter-popup {
    inset: auto 8px 8px 8px !important;
    width: auto;
    max-height: 72vh;
    border-radius: 8px;
  }

  .modal.defect-limit-modal {
    width: 100%;
    max-height: 96vh;
  }

  .defect-limit-modal .modal-body {
    padding: 10px;
  }

  .defect-limit-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .defect-limit-tabs .tab {
    flex: 0 0 142px;
  }

  .defect-limit-add {
    grid-template-columns: 1fr;
  }

  .defect-limit-add .btn {
    width: 100%;
  }

  .defect-limit-table-wrap {
    max-height: 60vh;
    -webkit-overflow-scrolling: touch;
  }

  .defect-image-slot {
    width: 48px;
    height: 40px;
  }

  .defect-limit-actions .btn {
    min-height: 36px;
    font-size: 12px;
  }

  .modal.defect-limit-image-modal {
    width: 100%;
    max-height: 96vh;
  }

  .defect-limit-image-modal .modal-head {
    padding: 10px 12px;
  }

  .defect-limit-image-modal .modal-head h2 {
    font-size: 16px;
  }

  .defect-limit-image-toolbar {
    flex-wrap: wrap;
    min-height: 42px;
    padding: 5px 8px;
  }

  .defect-limit-image-toolbar .muted {
    flex: 1 0 100%;
    margin: 0;
    text-align: center;
  }

  .defect-limit-image-stage {
    height: 54vh;
    min-height: 220px;
  }

  .defect-limit-image-note-panel {
    max-height: 28vh;
    padding: 9px 10px;
  }

  .defect-image-note-actions {
    flex-wrap: wrap;
  }

  .defect-image-note-actions .btn {
    flex: 1 1 110px;
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .pwa-actions,
  .top-actions {
    gap: 6px;
  }

  .topbar .btn {
    min-height: 38px;
    padding: 7px 10px;
  }

  .user-online {
    min-height: 34px;
    padding: 7px 9px;
  }

  .home-main-panel {
    padding: 14px 10px 18px;
  }

  .hero {
    min-height: 122px;
  }

  .hero-brand-image {
    max-height: 120px;
  }

  .keycap {
    display: none;
  }

  .welcome-band {
    align-items: flex-start;
    gap: 12px;
  }

  .welcome-icon {
    width: 48px;
    height: 48px;
  }

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

  .app-order {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

body.material-page .material-main {
  max-width: none;
  padding: 18px 12px 72px;
}

body.material-page .material-topbar {
  gap: 12px;
}

body.material-page .material-filter-grid,
body.material-page .material-entry-grid,
body.material-page .material-stock-grid {
  display: grid;
}

body.material-page .material-table-wrap {
  max-height: 430px;
}

body.material-page .material-table-wrap.small-scroll {
  max-height: 320px;
}

body.material-page .material-report-shell {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #dfe7ef;
  overflow: auto;
}

body.material-page .material-report-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 28px;
}
