:root {
  --yc-bg: #f6f8fb;
  --yc-surface: #ffffff;
  --yc-surface-soft: #f8fafc;
  --yc-text: #172033;
  --yc-text-muted: #64748b;
  --yc-border: #dbe3ee;
  --yc-border-strong: #c7d2df;
  --yc-primary: #0f766e;
  --yc-primary-strong: #0b5f59;
  --yc-primary-soft: #e7f7f4;
  --yc-info: #2563eb;
  --yc-info-soft: #eff6ff;
  --yc-success: #047857;
  --yc-success-soft: #ecfdf5;
  --yc-warning: #b45309;
  --yc-warning-soft: #fffbeb;
  --yc-danger: #b91c1c;
  --yc-danger-soft: #fef2f2;
  --yc-radius: 10px;
  --yc-radius-sm: 7px;
  --yc-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --yc-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --yc-focus: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

body {
  background: var(--yc-bg);
  color: var(--yc-text);
}

.paper {
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow-sm);
}

.toolbar {
  align-items: center;
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow-sm);
  gap: 10px;
  padding: 10px;
}

.toolbar .actions {
  gap: 8px;
}

.stats {
  background: transparent;
  border: 0;
  gap: 10px;
}

.stat {
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow-sm);
}

.stat .label {
  color: var(--yc-text-muted);
  font-weight: 700;
}

.stat .value {
  color: var(--yc-text);
  font-weight: 900;
  letter-spacing: 0;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--yc-border-strong);
  border-radius: var(--yc-radius-sm);
  color: var(--yc-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--yc-primary);
  box-shadow: var(--yc-focus);
  outline: none;
}

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

button {
  border-radius: var(--yc-radius-sm);
  border: 1px solid var(--yc-border-strong);
  color: var(--yc-text);
  font-weight: 800;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(0);
}

button.primary {
  background: var(--yc-primary);
  border-color: var(--yc-primary);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: var(--yc-primary-strong);
  border-color: var(--yc-primary-strong);
}

button.danger,
.danger {
  background: var(--yc-danger);
  border-color: var(--yc-danger);
  color: #fff;
}

button.ghost {
  background: #fff;
  border-color: var(--yc-border);
  color: var(--yc-text);
}

.table-wrap {
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow-sm);
  overflow: auto;
}

.table-wrap > table,
table.grid-excel {
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap > table th,
table.grid-excel thead th {
  background: #f1f5f9;
  border-bottom: 1px solid var(--yc-border);
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-wrap > table td,
table.grid-excel tbody td {
  border-bottom: 1px solid #edf2f7;
  color: #334155;
  vertical-align: middle;
}

.table-wrap > table tbody tr:nth-child(even) td,
table.grid-excel tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.table-wrap > table tbody tr:hover td,
table.grid-excel tbody tr:hover td {
  background: #f8fafc;
}

.badge,
.pill,
.fs-pill {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid var(--yc-border);
  border-radius: 999px;
  color: #475569;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  gap: 4px;
  line-height: 1.2;
  min-height: 22px;
  padding: 3px 9px;
}

.badge.ok,
.pill.ok,
.fs-pill.ok {
  background: var(--yc-success-soft);
  border-color: #a7f3d0;
  color: var(--yc-success);
}

.badge.warn,
.pill.warn,
.fs-pill.warn {
  background: var(--yc-warning-soft);
  border-color: #fde68a;
  color: var(--yc-warning);
}

.home-freestore-boards {
  display: grid;
  gap: 12px;
  margin: 12px 0 18px;
}

.home-fs-board,
.fs-collapse-card {
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow-sm);
  overflow: hidden;
}

.home-fs-board > summary,
.fs-collapse-card > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 900;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
  padding: 12px 14px;
}

.home-fs-board > summary::-webkit-details-marker,
.fs-collapse-card > summary::-webkit-details-marker {
  display: none;
}

.home-fs-board > summary::after {
  color: var(--yc-text-muted);
  content: "展開";
  font-size: 12px;
}

.home-fs-board[open] > summary::after {
  content: "收合";
}

.home-fs-board > :not(summary),
.fs-collapse-body {
  margin: 0 14px 14px;
}

.fs-notification-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 12px;
}

.fs-notification-card {
  align-items: stretch;
  background: var(--yc-surface-soft);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  text-align: left;
}

.fs-notification-card.has-new {
  background: var(--yc-primary-soft);
  border-color: rgba(15, 118, 110, 0.28);
}

.fs-notification-card-head,
.fs-status-name {
  align-items: center;
  display: inline-flex;
  gap: 7px;
}

.fs-notification-card-head strong {
  margin-left: auto;
}

.fs-notification-type-icon,
.fs-status-icon {
  align-items: center;
  display: inline-flex;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.fs-notification-type-icon svg,
.fs-status-icon svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.fs-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.42);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 1000;
}

.fs-modal.hidden {
  display: none;
}

.fs-modal-panel {
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow);
  max-height: min(86vh, 900px);
  max-width: 980px;
  overflow: auto;
  padding: 16px;
  width: min(96vw, 980px);
}

.fs-order-detail-panel {
  max-width: 1120px;
}

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

.fs-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 14px;
}

.fs-detail-cell {
  background: var(--yc-surface-soft);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius-sm);
  padding: 9px 10px;
}

.fs-detail-cell .label {
  color: var(--yc-text-muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.fs-minor-title {
  color: var(--yc-text);
  font-size: 14px;
  font-weight: 900;
  margin: 14px 0 8px;
}

.badge.doing,
.pill.doing {
  background: var(--yc-info-soft);
  border-color: #bfdbfe;
  color: var(--yc-info);
}

.dialog-mask {
  backdrop-filter: blur(5px);
}

.dialog {
  background: var(--yc-surface);
  border: 1px solid var(--yc-border);
  border-radius: var(--yc-radius);
  box-shadow: var(--yc-shadow);
}

.dialog h2,
.dialog h3 {
  color: var(--yc-text);
  letter-spacing: 0;
}

.muted,
.fs-muted {
  color: var(--yc-text-muted);
}

.menu button {
  border-radius: 8px;
}

.menu button:hover,
.menu button.active {
  background: var(--yc-primary-soft);
  color: var(--yc-primary);
}

@media (max-width: 760px) {
  .paper {
    border-radius: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

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

  .toolbar .actions,
  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
  }

  .stats {
    grid-template-columns: 1fr !important;
  }

  .stat {
    min-height: 64px;
  }

  .table-wrap {
    border-radius: 8px;
    margin-left: -2px;
    margin-right: -2px;
  }

  .dialog {
    max-height: calc(100vh - 24px);
    width: min(96vw, 760px);
  }
}

/* Minimal table style for inventory, product library, and FreeStore surfaces. */
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) .table-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: none;
  overflow: auto;
}

:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table.grid-excel,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) .fs-table {
  background: #fff;
  border: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table th,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table.grid-excel thead th,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) .fs-table th {
  background: #f8fafc !important;
  border-top: 0 !important;
  border-right: 0 !important;
  border-bottom: 1px solid #dbe3ef !important;
  border-left: 0 !important;
  box-shadow: none !important;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 9px 12px;
  text-align: left;
  vertical-align: middle;
}

:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table td,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table.grid-excel tbody td,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) .fs-table td {
  background: #fff !important;
  border-top: 0 !important;
  border-right: 0 !important;
  border-bottom: 1px solid #eef2f7 !important;
  border-left: 0 !important;
  box-shadow: none !important;
  color: #334155;
  padding: 9px 12px;
  vertical-align: middle;
}

:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table tbody tr:nth-child(even),
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table tbody tr:nth-child(even) td,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table.grid-excel tbody tr:nth-child(even) td {
  background: #fff !important;
}

:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table tbody tr:hover td,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table.grid-excel tbody tr:hover td,
:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) .fs-table tr:hover td {
  background: #f9fafb !important;
}

:is(#inventory, #prodLibSection, #freestoreSystem, .dialog-mask[id^="inv"], .dialog-mask[id^="prodLib"], .fs-modal) table tr:last-child td {
  border-bottom-color: transparent !important;
}
