* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #e9eef2;
  color: #203040;
  font-family: "Noto Sans JP", "Noto Sans", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

a {
  color: #0aa6c8;
  text-decoration: none;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  background: #f8fbfc;
  border: 1px solid #d8e2e7;
  border-radius: 14px;
  box-shadow: 8px 12px 32px rgba(54, 72, 86, 0.12);
}

.login-card h1 {
  margin: 0 0 24px;
  color: #0bbf9a;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #f8fbfc;
  border-right: 1px solid #d8e2e7;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  color: #0bbf9a;
}

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

.side-nav a {
  padding: 12px 14px;
  color: #415263;
  border-radius: 10px;
}

.side-nav a.active,
.side-nav a:hover {
  color: #ffffff;
  background: #0bbf9a;
}

.side-nav form {
  margin-top: auto;
}

.main-area {
  padding: 28px;
}

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

.page-header p {
  margin: 0 0 6px;
  color: #748391;
}

.page-header h1 {
  margin: 0;
  font-size: 30px;
}

.header-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  background: #dff8f2;
  color: #07866d;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge.muted {
  background: #eef2f4;
  color: #687782;
}

.flash {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #e3f8ef;
  color: #0a795e;
  border: 1px solid #bcebdc;
}

.flash.error {
  background: #ffe9e9;
  color: #a32626;
  border-color: #ffc9c9;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.summary-grid article,
.summary-card,
.panel,
.stat-box {
  background: #f8fbfc;
  border: 1px solid #d8e2e7;
  border-radius: 14px;
  box-shadow: 5px 8px 22px rgba(54, 72, 86, 0.08);
}

.summary-grid article,
.summary-card {
  display: block;
  padding: 20px;
  color: #203040;
}

.summary-card.active,
.summary-card:hover {
  border-color: #0bbf9a;
  box-shadow: 0 0 0 3px rgba(11, 191, 154, 0.15);
}

.summary-grid .today-sales-card {
  background: linear-gradient(135deg, #0bbf9a 0%, #14d6b0 45%, #0aa6c8 100%);
  border-color: #0bbf9a;
  color: #ffffff;
}

.summary-grid .today-sales-card span,
.summary-grid .today-sales-card strong {
  color: #ffffff;
}

.summary-grid .today-sales-card:hover {
  border-color: #0aa989;
  box-shadow: 0 0 0 3px rgba(11, 191, 154, 0.2);
}

.summary-grid span,
.stat-box span {
  display: block;
  color: #728291;
  font-size: 14px;
}

.summary-grid strong,
.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.ticket-select-form {
  margin-top: 8px;
}

.ticket-select-form select {
  width: 100%;
  padding: 8px 10px;
  font-size: 18px;
  font-weight: 800;
  color: #203040;
}

.ticket-mode-form {
  min-width: 180px;
}

.ticket-mode-form select {
  padding: 6px 8px;
  font-size: 13px;
}

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

.ticket-card-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ticket-card-controls select {
  padding: 6px 8px;
  font-size: 13px;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.customer-stat-box strong {
  font-size: 22px;
  line-height: 1.3;
  word-break: keep-all;
}

.ticket-meta {
  margin-top: 14px;
  color: #657483;
  font-weight: 700;
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

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

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

.panel-title-row h2,
.panel-title-row p {
  margin: 0;
}

.panel-title-row p {
  margin-top: 4px;
  color: #728291;
}

.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-buttons a {
  padding: 9px 14px;
  border: 1px solid #cdd9df;
  border-radius: 999px;
  background: #ffffff;
  color: #415263;
  font-weight: 700;
}

.tab-buttons a.active {
  background: #0aa6c8;
  border-color: #0aa6c8;
  color: #ffffff;
}

.category-filter-buttons {
  margin-bottom: 16px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-box {
  padding: 16px;
}

.chart-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 170px;
  gap: 12px;
  align-items: center;
}

.bar-row b {
  text-align: right;
  white-space: nowrap;
}

.bar-row div {
  height: 12px;
  overflow: hidden;
  background: #dfe8ed;
  border-radius: 999px;
}

.bar-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0bbf9a 0%, #14d6b0 45%, #0aa6c8 100%);
}

.split-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  align-items: start;
}

.product-page-layout {
  display: block;
}

.product-form-drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  width: min(520px, 92vw);
  height: 100vh;
  padding: 24px;
  overflow-y: auto;
  background: #f8fbfc;
  border-right: 1px solid #d8e2e7;
  box-shadow: 12px 0 32px rgba(54, 72, 86, 0.18);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}

.product-form-drawer.open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  z-index: 35;
  inset: 0;
  background: rgba(32, 48, 64, 0.28);
}

.drawer-title-row,
.panel-heading-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title-row {
  margin-bottom: 18px;
}

.drawer-title-row h2,
.panel-heading-actions h2 {
  margin: 0;
}

.sub-heading {
  margin: 18px 0 10px;
  color: #203040;
  font-size: 20px;
  font-weight: 700;
}

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

.stats-rank-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 18px;
}

.stats-rank-grid > div + div {
  padding-left: 28px;
  border-left: 1px solid #d8e2e7;
}

.compact-table th,
.compact-table td {
  padding: 9px 8px;
}

.split-layout.narrow-left {
  grid-template-columns: 340px 1fr;
}

.stack-form,
.inline-form {
  display: grid;
  gap: 14px;
}

.inline-form {
  grid-template-columns: 1fr 160px auto;
  align-items: end;
}

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

label span {
  display: block;
  margin-bottom: 6px;
  color: #657483;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  color: #203040;
  background: #ffffff;
  border: 1px solid #cdd9df;
  border-radius: 9px;
}

textarea {
  resize: vertical;
}

.image-drop-zone {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 118px;
  padding: 18px;
  border: 2px dashed #b8c8d0;
  border-radius: 10px;
  background: #f7fbfc;
  color: #405060;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.image-drop-zone.drag-over {
  border-color: #0aa6c8;
  background: #e9f8fb;
}

.image-drop-zone input {
  display: none;
}

.image-drop-zone strong {
  font-size: 15px;
}

.image-drop-zone small {
  color: #728291;
}

.image-preview {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  image-orientation: from-image;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #d8e2e7;
}

.image-remove-button {
  width: auto;
}

.hidden {
  display: none !important;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.check-row input {
  width: auto;
}

.primary-button,
.ghost-button,
.danger-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  padding: 12px 18px;
  color: #ffffff;
  background: #0bbf9a;
}

.ghost-button {
  padding: 12px 18px;
  color: #415263;
  background: #eef2f4;
}

.danger-button {
  padding: 8px 12px;
  color: #ffffff;
  background: #e54d4d;
}

.small-button {
  padding: 8px 12px;
  color: #ffffff;
  background: #0aa6c8;
}

.full-width {
  width: 100%;
}

.text-link {
  font-weight: 700;
}

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

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #d8e2e7;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: #657483;
  font-size: 13px;
}

.data-table .right {
  text-align: right;
}

.row-action {
  width: 80px;
  text-align: right;
}

.empty {
  color: #728291;
  text-align: center;
}

.edit-row-form {
  display: grid;
  grid-template-columns: 28px 1fr 90px auto;
  gap: 8px;
  align-items: center;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  color: #728291;
  cursor: grab;
  user-select: none;
}

tr.dragging {
  opacity: 0.45;
}

.sort-save-form {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.category-product-group {
  margin-top: 12px;
}

.category-product-group:first-child {
  margin-top: 0;
}

.category-product-group h3 {
  margin: 0 0 8px;
  padding: 8px 10px;
  color: #405060;
  background: #eef4f6;
  border: 1px solid #d8e2e7;
  border-radius: 8px;
  font-size: 15px;
}

.settings-panel {
  max-width: 760px;
}

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

  .side-nav {
    position: static;
    height: auto;
  }

  .summary-grid,
  .ticket-detail-grid,
  .stats-detail-grid,
  .stats-rank-grid,
  .split-layout,
  .split-layout.narrow-left {
    grid-template-columns: 1fr;
  }

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