:root {
  --font-main: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --bg: #edf4ff;
  --bg-soft: #e8f2ff;
  --panel: #f9fbff;
  --panel-2: #ffffff;
  --ink: #112249;
  --muted: #60789f;
  --line: #cfdcf2;
  --primary: #1a3fce;
  --primary-soft: #e3ebff;
  --ok: #0a9f71;
  --warn: #c98c00;
  --danger: #b13052;
  --shadow: 0 14px 34px rgba(39, 68, 158, 0.14);
  --shadow-soft: 0 10px 24px rgba(37, 64, 145, 0.08);
  --shadow-strong: 0 24px 54px rgba(29, 56, 137, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  position: relative;
  font-family: var(--font-main);
  color: var(--ink);
  background:
    radial-gradient(540px 420px at 6% -6%, rgba(80, 142, 255, 0.2), transparent 72%),
    radial-gradient(430px 320px at 98% 0%, rgba(24, 216, 186, 0.16), transparent 70%),
    radial-gradient(300px 220px at 92% 32%, rgba(255, 139, 200, 0.12), transparent 76%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}

body.modal-open {
  overflow: hidden;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 98px;
}

.app-desktop-shell {
  min-height: 100vh;
}

.app-content-shell {
  min-width: 0;
}

.desktop-sidebar,
.desktop-rail {
  display: none;
}

.quick-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.quick-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.quick-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 33, 68, 0.24);
}

.quick-modal-dialog {
  position: relative;
  width: min(390px, calc(100% - 24px));
  border-radius: 24px;
  border: 1px solid rgba(203, 219, 247, 0.9);
  padding: 14px;
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(242, 248, 255, 0.96));
  box-shadow: 0 22px 50px rgba(17, 31, 61, 0.26);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.2s ease;
}

.quick-modal.show .quick-modal-dialog {
  transform: translateY(0) scale(1);
}

.quick-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.quick-modal-head h3 {
  margin: 0;
  font-size: 24px;
}

.quick-modal-head p {
  margin: 4px 0 0;
  color: #60789f;
  font-size: 14px;
}

.quick-modal-close {
  width: 38px;
  min-height: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  background: linear-gradient(180deg, #eff5ff, #e0ebff);
}

.quick-modal-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.quick-menu-dialog {
  width: min(320px, calc(100% - 28px));
  padding: 14px;
}

.quick-delete-dialog {
  width: min(360px, calc(100% - 24px));
  padding: 16px;
}

.quick-menu-actions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.quick-menu-btn {
  border: none;
  min-height: 52px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #3967e6, #2045b5);
  box-shadow: 0 10px 18px rgba(31, 66, 165, 0.25);
}

.quick-menu-btn.quick-menu-btn-alt {
  color: #2f4f8c;
  background: linear-gradient(180deg, #f4f8ff, #e8effd);
  box-shadow: none;
  border: 1px solid #cbd9f3;
}

.quick-menu-btn.quick-menu-btn-danger {
  background: linear-gradient(180deg, #e74f79, #b82252);
  box-shadow: 0 10px 18px rgba(166, 35, 78, 0.24);
}

.quick-menu-btn-chip {
  display: grid;
  align-content: center;
  justify-items: start;
  text-align: left;
  padding: 10px 14px;
}

.quick-menu-main {
  font-size: 18px;
  line-height: 1.1;
}

.quick-menu-sub {
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.quick-menu-btn-alt .quick-menu-sub {
  color: #6b80aa;
}

#create-menu-modal {
  inset: auto 0 calc(max(12px, env(safe-area-inset-bottom)) + 84px) 0;
  display: block;
  z-index: 45;
}

#create-menu-modal .quick-menu-dialog {
  margin: 0 auto;
  border-radius: 20px;
  box-shadow: 0 16px 32px rgba(15, 35, 88, 0.24);
}

.form-floating-dialog {
  width: min(408px, calc(100% - 14px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 14px;
}

.form-floating-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.form-floating-body .ocr-panel,
.form-floating-body .print-ocr-panel {
  margin-top: 0;
}

#quick-modal-submit {
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
}

#quick-modal-submit.consume {
  background: linear-gradient(180deg, #3663e3, #2247bd);
}

#quick-modal-submit.restock {
  background: linear-gradient(180deg, #16af8a, #0f8d6f);
}

.app-toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%) translateY(-10px);
  background: linear-gradient(180deg, #1f4bc2, #102b78);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(24, 52, 136, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(249, 252, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(199, 216, 245, 0.82);
  max-height: 140px;
  overflow: hidden;
  transition: max-height 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.app-header-main {
  padding: 12px 16px 10px;
  text-align: center;
  transition: padding 0.22s ease, opacity 0.18s ease, transform 0.18s ease;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 44px);
  letter-spacing: 0.8px;
  line-height: 1;
  transition: font-size 0.22s ease;
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-header.page-home .app-header-main {
  padding-top: 16px;
  padding-bottom: 12px;
}

.app-header.page-home h1 {
  font-size: clamp(34px, 10vw, 56px);
}

.app-header.page-sub p {
  opacity: 0.7;
  transform: translateY(-1px);
}

.app-header.header-hidden {
  max-height: 0;
  border-bottom-color: transparent;
  background: rgba(249, 252, 255, 0.4);
}

.app-header.header-hidden .app-header-main {
  opacity: 0;
  transform: translateY(-26px);
}

.app-main {
  padding: 14px 12px 0;
}

.app-page {
  display: none;
  gap: 12px;
}

.app-page.active {
  display: grid;
}

.app-page.active.page-enter {
  animation: page-enter 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.992);
    filter: saturate(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: saturate(1);
  }
}

.panel {
  background: linear-gradient(180deg, #fafdff, var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.home-hero {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  background:
    radial-gradient(250px 180px at 92% 18%, rgba(98, 143, 255, 0.14), transparent 68%),
    linear-gradient(180deg, #eef3ff, #e7eefc);
}

.home-hero-text h2 {
  font-size: clamp(42px, 12vw, 70px);
  line-height: 1.05;
}

.home-hero-text p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.home-hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #c6d3eb;
  border-radius: 999px;
  overflow: hidden;
  max-width: 278px;
  background: #f7f9ff;
}

.hero-btn {
  border: none;
  min-height: 58px;
  border-radius: 0;
  font-size: 20px;
  font-weight: 700;
}

.hero-btn-light {
  background: #f7f9ff;
  color: #6a7890;
}

.hero-btn-dark {
  background: linear-gradient(180deg, #173382, #0a1d55 70%, #09153f);
  color: #ffffff;
}

.home-overview {
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
}

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

.stat-item {
  background: linear-gradient(180deg, #fafdff, #edf4ff);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}

.stat-item .label {
  color: var(--muted);
  font-size: 17px;
}

.stat-item .value {
  font-size: 52px;
  line-height: 1;
  font-weight: 700;
  color: var(--primary);
}

.value-row {
  margin-top: 6px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.stat-item .unit {
  color: var(--muted);
  font-size: 19px;
  font-weight: 600;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.desktop-rail-head {
  align-items: flex-start;
}

.desktop-rail-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 17px;
}

.app-page[data-page='home'] .section-head h2 {
  font-size: 46px;
  line-height: 1.05;
}

.visual-grid {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.viz-card {
  border: 1px solid #cfd9ec;
  background: linear-gradient(180deg, #f8fcff, #eef5ff);
  border-radius: 16px;
  padding: 12px;
}

.health-meter,
.stock-track {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #d4dff3;
}

.health-meter-fill,
.stock-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f79ff, #2a9dff 56%, #12d1b2);
  transition: width 0.25s ease;
}

.stock-fill {
  min-width: 0;
}

.health-value {
  margin-top: 10px;
  font-size: 56px;
  font-weight: 700;
  color: var(--primary);
}

.material-pie-wrap {
  display: grid;
  grid-template-columns: minmax(130px, 150px) 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.category-pies {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.category-pie-item {
  border: 1px solid #d1dcef;
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(180deg, #f8fbff, #f0f5ff);
}

.material-pie {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  position: relative;
  border: 1px solid #c9d7f0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.pie-center {
  position: absolute;
  inset: 50%;
  width: 84px;
  height: 84px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #f7fbff;
  border: 1px solid #d3ddef;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(20, 40, 88, 0.1);
}

.pie-center strong {
  font-size: 26px;
  line-height: 1;
}

.pie-center span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.pie-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.pie-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.pie-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pie-legend .name {
  color: #334767;
}

.pie-legend .val {
  color: var(--muted);
}

.pie-empty {
  color: var(--muted);
  font-size: 13px;
}

.reminder-visual {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

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

.reminder-kpi {
  border-radius: 14px;
  border: 1px solid #cfdbef;
  background: linear-gradient(180deg, #f8fbff, #eff5ff);
  padding: 10px 10px 8px;
  display: grid;
  gap: 2px;
}

.reminder-kpi span {
  color: #6f81a2;
  font-size: 12px;
  font-weight: 600;
}

.reminder-kpi strong {
  font-size: 26px;
  line-height: 1;
}

.reminder-kpi.high {
  border-color: #f0ccd4;
  background: linear-gradient(180deg, #fff7f9, #ffeff3);
}

.reminder-kpi.medium {
  border-color: #f0e0b3;
  background: linear-gradient(180deg, #fffbed, #fff3d5);
}

.reminder-kpi.info {
  border-color: #ccd9ef;
  background: linear-gradient(180deg, #f4f8ff, #eaf1ff);
}

.deadline-board {
  border: 1px solid #cfd9ec;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff, #f0f5ff);
  padding: 10px;
}

.deadline-title {
  font-size: 15px;
  font-weight: 700;
  color: #223767;
}

.deadline-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.deadline-item {
  border: 1px solid #d3deef;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.deadline-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.deadline-top strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.deadline-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #6f81a2;
}

.deadline-days {
  border-radius: 999px;
  background: #eaf1ff;
  color: #3a5391;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.deadline-track {
  margin-top: 8px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #d8e2f3;
  overflow: hidden;
}

.deadline-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.deadline-sub {
  margin-top: 4px;
  color: #6f81a2;
  font-size: 12px;
}

.deadline-item.overdue {
  border-color: #efc6cf;
  background: #fff5f7;
}

.deadline-item.overdue .deadline-days {
  background: #fae2e8;
  color: #a02846;
}

.deadline-item.soon {
  border-color: #f3dfb4;
  background: #fffaf0;
}

.deadline-item.soon .deadline-days {
  background: #f7e8c0;
  color: #996300;
}

.deadline-empty {
  border: 1px dashed #c9d7ef;
  border-radius: 12px;
  padding: 10px;
  color: #6f81a2;
  font-size: 13px;
  background: #f6f9ff;
}

.timeline-board {
  border: 1px solid #cfd9ec;
  border-radius: 16px;
  background: linear-gradient(180deg, #fafdff, #eef5ff);
  padding: 10px;
}

.timeline-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.timeline-title-main {
  font-size: 16px;
  font-weight: 800;
  color: #1c2f5f;
}

.timeline-title-sub {
  font-size: 12px;
  color: #7184a6;
}

.reminder-timeline {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
}

.timeline-axis {
  position: relative;
  display: grid;
  justify-items: center;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #9db2d8;
  z-index: 1;
}

.timeline-line {
  width: 2px;
  flex: 1;
  min-height: 26px;
  background: linear-gradient(180deg, #c9d8ef, #dce6f6);
  border-radius: 999px;
  margin-top: 2px;
}

.timeline-item:last-child .timeline-line {
  opacity: 0;
}

.timeline-card {
  border: 1px solid #d3dff2;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.timeline-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.timeline-date {
  color: #5f789f;
  font-size: 12px;
  font-weight: 700;
}

.timeline-risk {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.timeline-risk.high {
  background: #f9dbe3;
  color: #aa2d4c;
}

.timeline-risk.medium {
  background: #f9e9bf;
  color: #9b6500;
}

.timeline-risk.info {
  background: #dfeaff;
  color: #2b4f95;
}

.timeline-title {
  margin-top: 4px;
  color: #1b2f5f;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.timeline-meta {
  margin-top: 2px;
  color: #5f789f;
  font-size: 12px;
}

.timeline-sub {
  margin-top: 3px;
  color: #7184a6;
  font-size: 12px;
}

.timeline-item.high .timeline-card {
  border-color: #efc7d1;
  background: #fff7f9;
}

.timeline-item.medium .timeline-card {
  border-color: #f1dfb4;
  background: #fffbf2;
}

.timeline-empty {
  border: 1px dashed #c9d7ef;
  border-radius: 12px;
  padding: 10px;
  color: #6f81a2;
  font-size: 13px;
  background: #f6f9ff;
}

.low-stock-list,
.reminder-list,
.print-job-list,
.tx-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.low-stock-item {
  border: 1px solid #ffd18b;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8e7, #ffefd2);
  padding: 7px 8px;
  font-size: 14px;
  color: #9a6400;
}

.spool-meta,
.print-job-meta,
.ocr-status,
.reminder-action {
  color: var(--muted);
  font-size: 13px;
}

#spool-form,
.print-job-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

#section-form {
  display: none !important;
}

#spool-form {
  padding-top: 6px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.color-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #c6d3eb;
  background: #d7dfec;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.field-label {
  padding-left: 2px;
  color: #7183a5;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.ocr-panel,
.print-ocr-panel {
  margin-top: 10px;
  border: 1px dashed #cad6e7;
  border-radius: 12px;
  background: #f5f8fe;
  padding: 10px;
}

.ocr-panel p {
  margin: 0 0 8px;
}

.ocr-review-panel {
  margin-top: 10px;
  border: 1px solid #d5e0f4;
  border-radius: 20px;
  padding: 14px;
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(34, 197, 255, 0.12), transparent 72%),
    radial-gradient(120px 90px at 0% 100%, rgba(76, 97, 255, 0.12), transparent 72%),
    linear-gradient(180deg, #ffffff, #f4f8ff);
  box-shadow: 0 14px 30px rgba(33, 65, 150, 0.1);
}

.ocr-review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.ocr-review-head-main {
  min-width: 0;
}

.ocr-review-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e7eeff, #dbe7ff);
  color: #2348b4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.ocr-review-head strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.ocr-review-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.ocr-review-color-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #d8e3f6;
  color: #4b6493;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ocr-review-color-chip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d7e2f4;
  background: #dbe4f4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.ocr-review-summary {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
}

.ocr-review-summary-card {
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #dce6f7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ocr-review-summary-card span {
  display: block;
  color: #7386aa;
  font-size: 12px;
  font-weight: 700;
}

.ocr-review-summary-card strong {
  display: block;
  margin-top: 7px;
  color: #12275a;
  font-size: 19px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.ocr-review-summary-name {
  background: linear-gradient(180deg, #eef4ff, #e6efff);
}

.ocr-review-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ocr-review-field {
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid #dce5f6;
}

.ocr-review-field input,
.ocr-review-field select {
  background: #fff;
}

.ocr-review-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ocr-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.print-job-item,
.tx-item,
.reminder-item,
.spool-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #ffffff;
  overflow: hidden;
}

.print-job-head,
.reminder-head,
.spool-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.spool-card-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.spool-card-head strong {
  display: block;
  overflow-wrap: anywhere;
}

.spool-card-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.job-status,
.reminder-badge,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.job-status {
  background: #fff2cf;
  color: var(--warn);
}

.job-status.completed {
  background: #ddf4eb;
  color: var(--ok);
}

.reminder-item.resolved {
  opacity: 0.75;
}

.reminder-item.high {
  border-color: #ebc1cc;
  background: #fff0f3;
}

.reminder-item.medium {
  border-color: #eadba9;
  background: #fff8e8;
}

.reminder-item.info {
  border-color: #ccdae9;
  background: #f3f8ff;
}

.reminder-badge.high {
  background: #f9d7df;
  color: var(--danger);
}

.reminder-badge.medium {
  background: #f8e7b8;
  color: var(--warn);
}

.reminder-badge.info {
  background: #dce9fb;
  color: #244782;
}

.reminder-toolbar {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.checkbox-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  border-radius: 4px;
  accent-color: #2a4cab;
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

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

th,
td {
  border-bottom: 1px solid #e4eaf2;
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}

tr.low-stock,
.spool-card.low-stock {
  background: #fff6de;
}

.stock-line {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.stock-cell {
  min-width: 140px;
}

.spool-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  font-size: 14px;
}

.spool-op-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.spool-op-btn {
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #c7d4eb;
  background: #f6f9ff;
  color: #334f8e;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
}

.spool-op-btn.active {
  color: #fff;
  border-color: #21439b;
  background: linear-gradient(180deg, #2f5dd2, #183b95);
}

.spool-quick-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #d2dcef;
}

.spool-quick-panel .compact-form {
  gap: 8px;
}

.spool-quick-panel .compact-form + .compact-form {
  margin-top: 8px;
}

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

.mobile-cards .spool-card {
  height: 100%;
  border-radius: 16px;
  padding: 10px;
  touch-action: manipulation;
}

.mobile-cards .spool-card-head {
  align-items: flex-start;
  gap: 6px;
}

.mobile-cards .spool-card-head strong {
  display: -webkit-box;
  font-size: 16px;
  line-height: 1.25;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mobile-cards .spool-meta {
  margin-top: 2px;
  font-size: 12px;
}

.mobile-cards .spool-card-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 92px;
  width: 92px;
}

.mobile-cards .spool-op-buttons {
  gap: 3px;
  justify-content: flex-end;
  width: 100%;
}

.mobile-cards .spool-op-btn {
  width: 28px;
  min-height: 28px;
  height: 28px;
  font-size: 17px;
}

.mobile-cards .spool-card-grid {
  margin-top: 8px;
  gap: 4px;
  font-size: 12px;
}

.mobile-cards .stock-line {
  margin-top: 6px;
  font-size: 11px;
}

.desktop-only {
  display: none;
}

.action-box {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.desktop-form-host {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.desktop-form-host > * {
  margin-top: 0 !important;
}

.desktop-rail-btn {
  width: auto;
  min-width: 112px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  flex: 0 0 auto;
}

.desktop-tip-panel h2 {
  margin-bottom: 10px;
}

.desktop-tip-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: #42597f;
  font-size: 14px;
}

.compact-form {
  display: grid;
  gap: 6px;
}

input:not([type='checkbox']),
select,
button,
.upload-btn {
  min-height: 54px;
  width: 100%;
  border-radius: 20px;
  border: 1px solid #c7d4eb;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 18px;
  background: #f8fbff;
}

button,
.upload-btn {
  cursor: pointer;
  color: var(--primary);
  background: linear-gradient(180deg, #f1f6ff, #e6efff);
  font-weight: 600;
}

button:hover,
.upload-btn:hover {
  filter: brightness(0.98);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.upload-btn input {
  display: none;
}

.inline-btn {
  margin-top: 8px;
}

.danger-btn {
  color: #91263c;
  border-color: #e8b4c0;
  background: linear-gradient(180deg, #fff2f5, #ffe3ea);
}

.submit-btn {
  min-height: 58px;
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  border: none;
  background: linear-gradient(180deg, #274fb8, #122d7b);
  box-shadow: 0 10px 20px rgba(27, 52, 130, 0.25);
}

.tag {
  background: linear-gradient(180deg, #e8eeff, #dbe7ff);
  color: #1e43a4;
}

#camera-preview {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  display: none;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f1d3f;
  object-fit: contain;
}

@media (max-width: 480px) {
  .ocr-review-summary,
  .ocr-review-grid,
  .ocr-review-actions {
    grid-template-columns: 1fr;
  }

  .ocr-review-head {
    flex-direction: column;
  }

  .ocr-review-color-pill {
    align-self: flex-start;
  }
}

#capture-canvas {
  display: none;
}

#ocr-raw-text,
#print-job-ocr-raw-text {
  max-height: 180px;
  overflow: auto;
  margin-top: 8px;
  border-radius: 10px;
  padding: 10px;
  background: #12244a;
  color: #d4e2ff;
  font-size: 12px;
}

.profile-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.profile-actions {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.profile-action-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 248, 255, 0.96));
  box-shadow: var(--shadow-soft);
}

.profile-action-head h3 {
  margin: 0;
  font-size: 18px;
}

.profile-action-head p,
.profile-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.profile-action-buttons {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-btn {
  border-radius: 14px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid #c9d6ef;
  background: linear-gradient(180deg, #f7faff, #e8f0ff);
  color: #2648a2;
  font-weight: 700;
}

.favorite-spools {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.favorite-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.favorite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.favorite-name {
  font-size: 16px;
  font-weight: 700;
}

.favorite-color-chip {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #9eb2d4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.favorite-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.favorite-remain {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.favorite-placeholder {
  border: 2px dashed #d2dceb;
  border-radius: 14px;
  padding: 34px 14px;
  color: #9aa9be;
  text-align: center;
  font-size: 18px;
}

.empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  border: 1px dashed #c9d7ef;
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(249, 252, 255, 0.98), rgba(238, 245, 255, 0.92));
}

.empty-state.compact {
  border-radius: 16px;
  padding: 14px;
}

.empty-state-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e4edff;
  color: #284db0;
  font-size: 12px;
  font-weight: 800;
}

.empty-state strong {
  font-size: 20px;
  color: #16305e;
}

.empty-state p {
  margin: 0;
  color: #5f7598;
  line-height: 1.6;
}

.empty-state-btn {
  border: none;
  min-height: 42px;
  border-radius: 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #355edf, #2146b7);
  color: #fff;
  font-weight: 700;
}

.form-feedback {
  margin-bottom: 10px;
  border: 1px solid #efc6d1;
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fff6f8, #ffe9ef);
  color: #982b4d;
  font-size: 14px;
  font-weight: 700;
}

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

.analytics-chip,
.analytics-card {
  border: 1px solid #d6e3f7;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 255, 0.96));
}

.analytics-chip {
  padding: 12px 14px;
}

.analytics-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.analytics-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.analytics-grid {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.analytics-card {
  padding: 14px;
}

.analytics-card-head h3 {
  margin: 0;
  font-size: 18px;
}

.analytics-card-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.usage-chart,
.breakdown-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.usage-row,
.breakdown-row {
  display: grid;
  gap: 8px;
}

.usage-row {
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
}

.usage-label,
.usage-value {
  font-size: 13px;
  font-weight: 700;
}

.usage-track,
.breakdown-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e6eefc;
}

.usage-fill,
.breakdown-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #355ede, #1cc2a0);
}

.breakdown-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.spool-toolbar {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.spool-results-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.spool-link-btn,
.card-detail-btn {
  border: none;
  padding: 0;
  background: transparent;
  color: #16305e;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.card-detail-btn {
  margin-top: 12px;
  justify-self: start;
  padding: 9px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #eff5ff, #e4edff);
  color: #2947a2;
}

.spool-op-btn.detail {
  color: #2747ab;
}

.job-status.failed {
  background: linear-gradient(180deg, #ffe7ef, #ffd8e4);
  color: #a12e50;
}

.print-job-meta.failure {
  color: #9a2e4f;
  font-weight: 700;
}

.desktop-shortcuts {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.desktop-rail-btn.desktop-rail-btn-alt {
  background: linear-gradient(180deg, #f3f8ff, #e7efff);
  color: #2146b7;
}

.desktop-rail-btn.desktop-rail-btn-ghost {
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  color: #48648c;
}

.detail-kicker {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e4edff;
  color: #2749a8;
  font-size: 12px;
  font-weight: 800;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 88;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.detail-drawer.show {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 32, 70, 0.26);
}

.detail-drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(560px, 100%);
  padding: 18px;
  background: linear-gradient(180deg, rgba(252, 254, 255, 0.98), rgba(242, 247, 255, 0.97));
  box-shadow: -16px 0 42px rgba(25, 45, 105, 0.22);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow: auto;
}

.detail-drawer.show .detail-drawer-panel {
  transform: translateX(0);
}

.detail-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-drawer-head h3 {
  margin: 12px 0 4px;
  font-size: 28px;
}

.detail-drawer-head p {
  margin: 0;
  color: var(--muted);
}

.detail-drawer-body {
  margin-top: 16px;
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-card {
  border: 1px solid #d5e1f5;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 248, 255, 0.95));
}

.detail-card h4 {
  margin: 0 0 10px;
  font-size: 17px;
}

.detail-meta {
  margin: 0;
  display: grid;
  gap: 10px;
}

.detail-meta div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
}

.detail-meta dt {
  color: var(--muted);
}

.detail-meta dd {
  margin: 0;
  font-weight: 700;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: #183160;
}

.detail-note-card p,
.detail-loading {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.detail-loading.error {
  color: #a12e50;
  font-weight: 700;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 25, 58, 0.4);
  backdrop-filter: blur(8px);
}

.onboarding-dialog {
  position: relative;
  width: min(640px, calc(100% - 24px));
  border-radius: 28px;
  padding: 22px;
  border: 1px solid rgba(208, 222, 245, 0.94);
  background:
    radial-gradient(240px 120px at 100% 0%, rgba(94, 138, 255, 0.14), transparent 72%),
    linear-gradient(180deg, rgba(253, 254, 255, 0.99), rgba(241, 247, 255, 0.97));
  box-shadow: 0 28px 56px rgba(20, 39, 92, 0.28);
}

.onboarding-head h2 {
  margin: 10px 0 8px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
}

.onboarding-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.onboarding-steps {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.onboarding-step {
  border: 1px solid #d6e2f5;
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.onboarding-step strong {
  display: block;
  font-size: 17px;
}

.onboarding-step p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.onboarding-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f7f9fd;
}

.profile-label {
  color: var(--muted);
  font-size: 12px;
}

.profile-value {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
}

.install-btn {
  margin-top: 12px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(430px, calc(100% - 20px));
  background: rgba(252, 253, 255, 0.96);
  border: 1px solid #d5deea;
  border-radius: 22px;
  box-shadow: 0 12px 24px rgba(18, 35, 64, 0.14);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 7px;
  align-items: center;
  z-index: 30;
}

.tab-btn {
  border: none;
  min-height: 48px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #8b9ab0;
  background: transparent;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.tab-btn.active {
  color: #ffffff;
  background: linear-gradient(180deg, #3d62da, #2143b7);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(35, 68, 177, 0.34);
}

.tab-btn.active-pop {
  animation: tab-pop 0.24s ease-out;
}

@keyframes tab-pop {
  0% {
    transform: translateY(0) scale(0.95);
  }
  70% {
    transform: translateY(-3px) scale(1.04);
  }
  100% {
    transform: translateY(-2px) scale(1);
  }
}

.tab-btn:active {
  transform: scale(0.96);
}

.tab-btn-plus {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  display: grid;
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 0;
  padding: 4px 0 2px;
  color: #2f53b0;
  background: linear-gradient(180deg, #f1f6ff, #e6efff);
  border: 1px solid #c6d4f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tab-btn-plus:active {
  transform: scale(0.96);
}

.tab-plus-icon {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
}

.tab-plus-label {
  margin-top: -1px;
  font-size: 11px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0.4px;
}

@media (min-width: 1024px) {
  body {
    padding: 18px;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 18px;
    border-radius: 34px;
    border: 1px solid rgba(214, 226, 247, 0.92);
    background:
      radial-gradient(460px 180px at 0% 0%, rgba(88, 131, 255, 0.08), transparent 72%),
      radial-gradient(420px 180px at 100% 0%, rgba(41, 204, 177, 0.08), transparent 68%),
      rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: -1;
  }

  .app-shell {
    max-width: 1500px;
    padding-bottom: 0;
  }

  .app-desktop-shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr) 396px;
    gap: 20px;
    align-items: start;
  }

  .desktop-sidebar,
  .desktop-rail {
    display: grid;
    gap: 18px;
    position: sticky;
    top: 18px;
    align-self: start;
  }

  .desktop-sidebar {
    grid-auto-rows: max-content;
  }

  .desktop-brand,
  .desktop-sidebar-note {
    border: 1px solid #cfdbf2;
    border-radius: 24px;
    padding: 18px;
    background:
      radial-gradient(200px 120px at 100% 0%, rgba(86, 126, 255, 0.1), transparent 72%),
      linear-gradient(180deg, rgba(249, 252, 255, 0.98), rgba(237, 244, 255, 0.95));
    box-shadow: var(--shadow-soft);
  }

  .desktop-brand-kicker {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: #e2ebff;
    color: #284db0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
  }

  .desktop-brand strong {
    display: block;
    margin-top: 12px;
    font-size: 32px;
    line-height: 1.05;
  }

  .desktop-brand p,
  .desktop-sidebar-note p {
    margin: 8px 0 0;
    color: #587095;
    font-size: 14px;
    line-height: 1.55;
  }

  .desktop-sidebar-note h2 {
    font-size: 20px;
  }

  .desktop-nav {
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid #cfdbf2;
    border-radius: 26px;
    background: rgba(249, 252, 255, 0.94);
    box-shadow: var(--shadow-soft);
  }

  .desktop-tab-btn {
    min-height: 56px;
    justify-content: flex-start;
    text-align: left;
    padding: 14px 16px;
    border-radius: 18px;
    font-size: 15px;
    position: relative;
    overflow: hidden;
  }

  .desktop-tab-btn::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(47, 93, 210, 0.95), rgba(17, 191, 164, 0.7));
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .desktop-tab-btn:hover {
    color: #2847a2;
    background: linear-gradient(180deg, #f7faff, #edf3ff);
  }

  .desktop-tab-btn.active::after {
    opacity: 1;
  }

  .app-content-shell {
    min-width: 0;
  }

  .app-header {
    position: relative;
    top: 0;
    border-radius: 28px;
    border: 1px solid rgba(199, 216, 245, 0.92);
    box-shadow: var(--shadow-strong);
    background:
      radial-gradient(220px 120px at 100% 0%, rgba(109, 145, 255, 0.12), transparent 72%),
      linear-gradient(180deg, rgba(251, 253, 255, 0.94), rgba(244, 248, 255, 0.9));
  }

  .app-header-main {
    padding: 20px 24px 18px;
    text-align: left;
  }

  .app-header h1 {
    font-size: clamp(38px, 4vw, 56px);
  }

  .app-header.page-home .app-header-main {
    padding-top: 24px;
    padding-bottom: 20px;
  }

  .app-header.page-home h1 {
    font-size: clamp(44px, 5vw, 68px);
  }

  .app-main {
    padding: 18px 0 0;
  }

  .app-page {
    gap: 16px;
  }

  .app-page[data-page='home'].active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-page[data-page='home'] .home-hero,
  .app-page[data-page='home'] .home-overview {
    grid-column: 1 / -1;
  }

  .app-page[data-page='records'].active {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }

  .app-page[data-page='reminders'].active {
    display: block;
  }

  .desktop-only {
    display: block;
  }

  .mobile-cards {
    display: none;
  }

  .bottom-nav {
    display: none;
  }

  .panel {
    padding: 20px;
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
  }

  .panel:hover {
    transform: translateY(-1px);
    border-color: #c2d3f1;
    box-shadow: 0 18px 36px rgba(35, 64, 145, 0.12);
  }

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

  .visual-grid {
    grid-template-columns: 1.2fr 1fr 0.9fr;
    gap: 14px;
  }

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

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

  .analytics-grid {
    grid-template-columns: 1.15fr 1fr 1fr;
  }

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

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

  .home-hero {
    position: relative;
    grid-template-columns: minmax(0, 1.15fr) auto;
    align-items: center;
    gap: 22px;
    padding: 26px;
    overflow: hidden;
  }

  .home-hero::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    right: -34px;
    top: -50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43, 99, 255, 0.16), transparent 68%);
    pointer-events: none;
  }

  .home-hero-text h2 {
    max-width: 8ch;
    font-size: clamp(52px, 5vw, 76px);
  }

  .home-hero-text p {
    max-width: 30ch;
    font-size: 18px;
    line-height: 1.55;
  }

  .home-hero-actions {
    min-width: 248px;
    justify-self: end;
    box-shadow: 0 12px 28px rgba(31, 57, 129, 0.12);
  }

  .stat-item {
    padding: 14px 16px;
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(237, 244, 255, 0.95));
  }

  .stat-item .label {
    font-size: 15px;
  }

  .stat-item .value {
    font-size: 48px;
  }

  .viz-card {
    padding: 14px;
    border-radius: 18px;
    background:
      radial-gradient(120px 70px at 100% 0%, rgba(94, 136, 255, 0.08), transparent 72%),
      linear-gradient(180deg, #fbfdff, #eff5ff);
  }

  .favorite-card:hover,
  .print-job-item:hover,
  .tx-item:hover,
  .reminder-item:hover {
    transform: translateY(-2px);
    border-color: #bdd0ef;
    box-shadow: 0 14px 28px rgba(39, 67, 148, 0.12);
  }

  .favorite-card {
    padding: 14px;
    border-radius: 16px;
  }

  .favorite-name {
    font-size: 18px;
  }

  .favorite-remain {
    font-size: 20px;
  }

  .table-wrap {
    overflow: auto;
    margin-top: 14px;
    border: 1px solid #d8e4f6;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  }

  .spool-toolbar {
    grid-template-columns: 1.2fr repeat(5, minmax(0, 1fr));
    align-items: center;
  }

  th,
  td {
    padding: 12px 12px;
  }

  th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(240, 246, 255, 0.96);
    color: #60759b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.35px;
  }

  tbody tr {
    transition: background-color 0.2s ease;
  }

  tbody tr:hover {
    background: rgba(241, 247, 255, 0.9);
  }

  td strong {
    font-size: 15px;
    color: #152a5d;
  }

  .action-box {
    min-width: 232px;
    gap: 6px;
  }

  .action-cell input,
  .action-cell button {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 14px;
  }

  .action-cell .danger-btn {
    min-height: 38px;
  }

  .stock-cell {
    min-width: 190px;
  }

  .stock-line {
    font-size: 13px;
  }

  .print-job-list,
  .tx-list,
  .reminder-list {
    gap: 10px;
  }

  .print-job-item,
  .tx-item,
  .reminder-item {
    padding: 16px;
  }

  .desktop-rail {
    gap: 16px;
  }

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

  .desktop-rail-panel,
  .desktop-tip-panel {
    position: relative;
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(252, 254, 255, 0.98), rgba(242, 247, 255, 0.96));
  }

  .desktop-rail-panel::before,
  .desktop-tip-panel::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, rgba(52, 94, 216, 0.9), rgba(31, 198, 171, 0.6));
  }

  .desktop-rail-panel:nth-of-type(2)::before {
    background: linear-gradient(90deg, rgba(20, 168, 140, 0.95), rgba(72, 116, 255, 0.68));
  }

  .desktop-rail-head {
    margin-bottom: 2px;
  }

  .desktop-form-host #spool-form,
  .desktop-form-host .print-job-form {
    margin-top: 0;
  }

  .desktop-form-host input:not([type='checkbox']),
  .desktop-form-host select,
  .desktop-form-host button,
  .desktop-form-host .upload-btn {
    min-height: 48px;
    border-radius: 16px;
    font-size: 16px;
    padding: 11px 14px;
  }

  .desktop-form-host .submit-btn {
    min-height: 52px;
    font-size: 20px;
  }

  .desktop-form-host .color-preview {
    width: 28px;
    height: 28px;
  }

  .desktop-tip-list li {
    padding: 10px 0;
    border-bottom: 1px dashed #d9e3f4;
  }

  .desktop-tip-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

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

  .detail-note-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .reminder-kpi-grid {
    grid-template-columns: 1fr;
  }

  .reminder-toolbar {
    grid-template-columns: 1fr;
  }

  .material-pie-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

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

  .spool-card-grid {
    grid-template-columns: 1fr;
  }

  .tab-btn {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-page.active.page-enter,
  .tab-btn.active-pop {
    animation: none;
  }

  .tab-btn {
    transition: none;
  }
}

.onboarding-overlay[hidden],
.detail-drawer[hidden],
.quick-modal[hidden] {
  display: none !important;
}
