:root {
  --ink: #2f2a24;
  --muted: #7c7166;
  --line: #e8ded2;
  --surface: #fffefa;
  --page: #f8f3eb;
  --charcoal: #463d34;
  --indigo: #5b6f86;
  --copper: #c28b49;
  --moss: #78947e;
  --sage: #a9baa9;
  --vermillion: #c36b50;
  --danger: #9c3b25;
  --paper: #fffaf2;
  /* Matches DASHBOARD_CONFIG.colors.station/shampoo in js.js so the seat-type
     color coding stays identical between the hourly chart and metric cards. */
  --seat-station: #7f91b8;
  --seat-shampoo: #7fa58f;
  --shadow: 0 12px 28px rgba(91, 72, 49, 0.07);
  --page-padding: 18px;
  --section-gap: 12px;
  --panel-radius: 8px;
  --panel-padding: 15px 18px;
  --panel-border: 1px solid rgba(232, 222, 210, 0.95);
  --panel-bg:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 254, 250, 0.98)),
    var(--surface);

  /* Sidebar sizing: shared by the logo mark and the toggle button so they
     can never drift apart into mismatched squares again. */
  --sidebar-width: 264px;
  --sidebar-width-collapsed: 74px;
  --sidebar-icon-box: 44px;
  --nav-icon-size: 20px;
}

/* ============================================================
   Base / reset
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.54) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.48) 1px, transparent 1px),
    linear-gradient(135deg, #fffaf2 0%, var(--page) 46%, #f5f8f3 100%);
  background-size: 26px 26px, 26px 26px, auto;
  font-family: "Noto Sans", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  overflow: hidden;
}

button,
select {
  font: inherit;
}

/* ============================================================
   App shell layout
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
  transition: grid-template-columns 0.24s ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
}

/* ============================================================
   Login page
   ============================================================ */

body.login-page {
  height: 100%;
  overflow: auto;
}

.login-shell {
  width: min(100%, 1240px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(22px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(420px, 560px) minmax(340px, 430px);
  align-items: center;
  gap: clamp(54px, 5.8vw, 88px);
}

.login-intro {
  min-width: 0;
  display: grid;
  gap: clamp(34px, 7vh, 72px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand strong,
.login-brand span {
  display: block;
  white-space: nowrap;
}

.login-brand strong {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 600;
}

.login-brand span {
  color: var(--muted);
  font-size: 13px;
}

.login-copy {
  max-width: 660px;
}

.login-copy h1 {
  max-width: 620px;
  margin-top: 12px;
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.04;
}

.login-copy p {
  max-width: 520px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.login-card {
  width: 100%;
  border: 1px solid rgba(232, 222, 210, 0.95);
  border-radius: 8px;
  padding: clamp(22px, 4vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 254, 250, 0.98)),
    var(--surface);
  box-shadow: 0 18px 42px rgba(91, 72, 49, 0.12);
}

.login-card-header {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-bottom: 24px;
}

.login-card h2 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 500;
}

.login-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  /* Without this, a long error message below can force this grid item wider
     than its column (min-width defaults to the content's intrinsic width),
     visibly shrinking/shifting the other fields sharing the same row. */
  min-width: 0;
}

.login-card .login-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

/* Reusable per-field validation message, meant to sit right under the
   input/select/textarea it belongs to (see the detail.blade.php views under
   resources/views for the `@error('field') ... @enderror` usage). */
.field-error {
  /* !important guards against page-specific "<container> .field span"
     label-color overrides (e.g. .settings-form .field span) always beating
     this on specificity — this class must read as an error everywhere it's
     reused, regardless of which form it's dropped into. */
  display: block;
  margin-top: -2px;
  color: var(--danger) !important;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: break-word;
}

/* A non-editable value shown inside a `.field` in place of an input, e.g. a
   count that's derived from another table rather than typed in directly. */
.field-readout {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
}

.field-readout strong {
  font-size: 15px;
  color: var(--ink);
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.72);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input::placeholder {
  color: rgba(124, 113, 102, 0.58);
}

.field input:focus {
  border-color: rgba(194, 139, 73, 0.78);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(194, 139, 73, 0.14);
}

.login-submit {
  min-height: 48px;
  border: 1px solid #8f714f;
  border-radius: 8px;
  color: #fffaf2;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent),
    #8f714f;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-submit:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent),
    #806446;
  box-shadow: 0 10px 20px rgba(91, 72, 49, 0.14);
  transform: translateY(-1px);
}

.login-submit:active {
  transform: translateY(0);
}

.login-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(232, 222, 210, 0.88);
}

/* ============================================================
   Sidebar: logo, nav, toggle button, user card
   ============================================================ */

.sidebar {
  height: 100vh;
  min-width: 0;
  padding: 18px 14px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 239, 229, 0.94)),
    #f7efe5;
  border-right: 1px solid rgba(226, 216, 202, 0.90);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--sidebar-icon-box);
  padding: 0 4px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: none;
  flex-shrink: 0;
  width: var(--sidebar-icon-box);
  height: var(--sidebar-icon-box);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(232, 222, 210, 0.9);
  background: var(--surface);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.sidebar-collapsed .brand-mark {
  display: grid;
  place-items: center;
}

body.sidebar-collapsed .brand {
  padding: 0;
}

.brand strong,
.brand span {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 600;
}

.brand span,
.sidebar-user-card span {
  color: var(--muted);
  font-size: 13px;
}

.sidebar-toggle {
  width: var(--sidebar-icon-box);
  height: var(--sidebar-icon-box);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.62);
  color: var(--charcoal);
  cursor: pointer;
}

.toggle-icon {
  display: grid;
  place-items: center;
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
}

.toggle-icon svg {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-expand {
  display: none;
}

body.sidebar-collapsed .icon-collapse {
  display: none;
}

body.sidebar-collapsed .icon-expand {
  display: grid;
}

.nav-list {
  display: grid;
  gap: 6px;
  align-self: stretch;
}

.nav-list a {
  display: flex;
  align-items: center;
  color: #5f554b;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
}

.nav-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
}

.nav-icon svg {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  min-width: 0;
  margin-left: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity 0.16s ease, margin-left 0.24s ease, width 0.24s ease;
}

.nav-list a.active,
.nav-list a:hover {
  color: #3a3129;
  background: rgba(194, 139, 73, 0.16);
  box-shadow: inset 3px 0 0 var(--copper);
}

.nav-list a.disabled,
.nav-list a.disabled:hover {
  color: rgba(124, 113, 102, 0.48);
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

body.sidebar-collapsed .nav-label {
  width: 0;
  margin-left: 0;
  opacity: 0;
}

.sidebar-user-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(194, 139, 73, 0.08));
}

.collapsed-user {
  display: none;
  width: 38px;
  height: 38px;
  margin-top: auto;
  border: 1px solid rgba(194, 139, 73, 0.26);
  border-radius: 8px;
  place-items: center;
  color: #6f5536;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(194, 139, 73, 0.14)),
    var(--surface);
  font-size: 15px;
  font-weight: 500;
}

body.sidebar-collapsed .brand > div:not(.brand-mark),
body.sidebar-collapsed .sidebar-user-card {
  display: none;
}

body.sidebar-collapsed .collapsed-user {
  display: grid;
}

.sidebar-user-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}

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

.login-user-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  border: 1px solid rgba(143, 113, 79, 0.18);
  border-radius: 999px;
  color: #7b6144;
  background: rgba(255, 250, 242, 0.82);
  font-weight: 500;
  cursor: pointer;
}

.logout-button {
  flex-shrink: 0;
  min-height: 24px;
  padding: 0 9px;
  font-size: 11px;
}

.logout-button:hover {
  color: #5f4b35;
  border-color: rgba(143, 113, 79, 0.32);
  background: rgba(194, 139, 73, 0.14);
}

/* ============================================================
   Dashboard topbar
   ============================================================ */

.dashboard {
  min-width: 0;
  height: 100vh;
  padding: var(--page-padding);
  display: grid;
  grid-template-rows: auto auto minmax(0, 0.98fr) minmax(0, 1fr);
  gap: var(--section-gap);
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  min-height: 78px;
}

.eyebrow {
  color: var(--copper);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 5px;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: 0;
}

.topbar p {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.top-actions select,
.top-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 500;
}

.top-actions button {
  color: #fffaf2;
  border-color: #8f714f;
  background: #8f714f;
}

.top-actions .date-selector {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.date-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.date-icon,
.date-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.82;
}

/* ---- Flatpickr date picker overrides ---- */

.flatpickr-calendar {
  border: 1px solid rgba(232, 222, 210, 0.95);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(91, 72, 49, 0.16);
  font-family: "Noto Sans", "Noto Sans JP", system-ui, sans-serif;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover {
  border-color: #8f714f;
  background: #8f714f;
}

.flatpickr-day.today {
  border-color: rgba(143, 113, 79, 0.45);
}

/* ============================================================
   Dashboard metric cards & panels
   ============================================================ */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--section-gap);
  min-height: 0;
}

.metric-card,
.panel {
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.metric-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 15px;
  overflow: hidden;
}

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

.metric-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  /* Flex items don't keep the inter-element whitespace from the source
     HTML (browsers collapse it), so spacing has to come from gap instead
     of a literal space character between the label text and the tags
     that follow it. */
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-condition {
  text-transform: none;
  font-weight: 400;
  letter-spacing: normal;
}

.primary .metric-label,
.primary p {
  color: var(--muted);
}

.metric-value {
  margin-top: 10px;
  font-size: 31px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
}

.metric-card p {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.35;
}

.meter {
  height: 8px;
  margin-top: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(124, 113, 102, 0.16);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--copper);
}

.trend {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 11px;
  margin-bottom: 16px;
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.trend.up {
  color: #236b45;
  background: #e8f8ec;
}

.trend.neutral {
  color: #243b63;
  background: #e9eef4;
}

.trend.down {
  color: #9c3b25;
  background: #f5e5df;
}

.metric-split {
  display: flex;
  /* Anchor the breakdown to the card's bottom edge regardless of how much
     content sits above it, so shorter cards (使用中の座席/平均稼働率) don't
     leave a dead gap once the grid row stretches to match the tallest card. */
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.split-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.split-item + .split-item {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.split-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.split-label i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.split-label .station {
  background: var(--seat-station);
}

.split-label .shampoo {
  background: var(--seat-shampoo);
}

.split-value {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--section-gap);
  min-height: 0;
}

.content-grid .wide {
  grid-column: span 2;
}

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

.panel {
  min-width: 0;
  min-height: 0;
  padding: var(--panel-padding);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.ranking-panel {
  position: relative;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.ranking-panel .panel-header {
  margin-bottom: 6px;
}

.ranking-panel h2 {
  white-space: nowrap;
}

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

.seat-type-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding: 2px;
  border: 1px solid rgba(143, 113, 79, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.92);
}

.seat-type-toggle button {
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.seat-type-toggle button.active {
  color: #3a3129;
  background: rgba(194, 139, 73, 0.16);
}

.panel h2,
.list-panel h2 {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 500;
}

.panel p,
.list-panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-pill {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.status-pill.live {
  color: #236b45;
  background: #e8f8ec;
}

.status-pill.placeholder {
  visibility: hidden;
}

/* ============================================================
   Charts & weekly heatmap
   ============================================================ */

.chart-box {
  position: relative;
  height: 100%;
  min-height: 0;
}

.chart-box.large {
  height: 100%;
}

.weekly-heatmap {
  display: grid;
  grid-template-columns: 22px repeat(11, minmax(0, 1fr));
  grid-template-rows: 18px repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.heatmap-corner,
.heatmap-hour,
.heatmap-day {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

.heatmap-day {
  justify-content: end;
  padding-right: 2px;
}

.heatmap-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(232, 222, 210, 0.80);
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #4c4035;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  overflow: hidden;
}

.heatmap-cell span {
  opacity: 0.86;
}

.heatmap-cell.no-data {
  color: rgba(76, 64, 53, 0.38);
  background: repeating-linear-gradient(
    45deg, rgba(232, 222, 210, 0.35), rgba(232, 222, 210, 0.35) 3px, transparent 3px, transparent 6px
  );
}

.heatmap-cell.level-1 {
  background: #f3f6f2;
}

.heatmap-cell.level-2 {
  background: #dbe9dd;
}

.heatmap-cell.level-3 {
  background: #b8d0bc;
}

.heatmap-cell.level-4 {
  color: #fffaf2;
  background: #85ad91;
  border-color: rgba(133, 173, 145, 0.55);
}

.heatmap-cell.level-5 {
  color: #fffaf2;
  background: #6f9f80;
  border-color: rgba(111, 159, 128, 0.58);
}

.heatmap-cell.level-6 {
  color: #fffaf2;
  background: #5d8f72;
  border-color: rgba(93, 143, 114, 0.60);
}

.heatmap-cell.level-7 {
  color: #fffaf2;
  background: #4d8066;
  border-color: rgba(77, 128, 102, 0.62);
}

.heatmap-cell.level-8 {
  color: #fffaf2;
  background: #3f735b;
  border-color: rgba(63, 115, 91, 0.64);
}

/* ============================================================
   Staff ranking list
   ============================================================ */

.staff-ranking-body {
  position: relative;
  min-height: 0;
}

.record-pill {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid rgba(143, 113, 79, 0.16);
  border-radius: 999px;
  color: #7b6144;
  background: rgba(255, 250, 242, 0.92);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.ranking-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ranking-toolbar select {
  height: 25px;
  min-width: 118px;
  border: 1px solid rgba(143, 113, 79, 0.18);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.92);
  padding: 0 22px 0 8px;
  font-size: 11px;
  font-weight: 500;
}

.staff-list {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  margin-left: -4px;
  padding-left: 4px;
  padding-right: 14px;
  scrollbar-color: rgba(143, 113, 79, 0.42) transparent;
  scrollbar-width: thin;
}

.staff-list::after {
  content: "";
  position: absolute;
  top: 0;
  right: 14px;
  bottom: 0;
  border-right: 1px dashed rgba(143, 113, 79, 0.40);
  pointer-events: none;
}

.staff-list::-webkit-scrollbar {
  width: 5px;
}

.staff-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(143, 113, 79, 0.36);
}

.staff-list-empty {
  padding: 20px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.staff-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.rank {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #8b8175;
  background: transparent;
  font-weight: 500;
  box-shadow: none;
}

.rank span {
  position: relative;
  z-index: 1;
}

.rank-1,
.rank-2,
.rank-3 {
  color: #3f3327;
}

.rank-2::before,
.rank-3::before {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 8px;
  width: 12px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 78% 100%, 50% 64%, 22% 100%);
  opacity: 0.78;
}

.rank-1 {
  background: linear-gradient(145deg, #fff0ad, #d2a33b);
  box-shadow: 0 0 0 1px rgba(210, 163, 59, 0.18), inset 0 -2px 0 rgba(111, 80, 23, 0.12);
}

.rank-1::before {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 8px;
  width: 12px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 78% 100%, 50% 64%, 22% 100%);
  opacity: 0.78;
}

.rank-2 {
  background: linear-gradient(145deg, #f7f5ef, #b9b5aa);
  box-shadow: 0 0 0 1px rgba(185, 181, 170, 0.20), inset 0 -2px 0 rgba(90, 86, 78, 0.10);
}

.rank-3 {
  background: linear-gradient(145deg, #f4c6a4, #b9794e);
  box-shadow: 0 0 0 1px rgba(185, 121, 78, 0.18), inset 0 -2px 0 rgba(104, 62, 36, 0.10);
}

.staff-name {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  font-size: 12px;
}

.staff-name span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.staff-bar {
  position: relative;
  height: 7px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(124, 113, 102, 0.12);
}

.staff-bar span {
  position: relative;
  z-index: 1;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--indigo), var(--copper));
}

.staff-bar b {
  position: absolute;
  right: -8px;
  top: 50%;
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #5f4b35;
  background: #fffaf2;
  border: 1px solid rgba(143, 113, 79, 0.18);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  transform: translate(100%, -50%);
  box-shadow: 0 1px 3px rgba(91, 72, 49, 0.08);
}

.staff-bar .near-record b {
  right: 6px;
  color: #fffaf2;
  background: rgba(95, 75, 53, 0.78);
  border-color: transparent;
  transform: translate(0, -50%);
}

/* ============================================================
   Seat map (dashboard floor panel)
   ============================================================ */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend .busy {
  background: #236b45;
}

.legend .free {
  background: #c9c0b6;
}

.seat-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.seat-zone {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(232, 222, 210, 0.86);
  border-radius: 8px;
  padding: 6px;
  background: rgba(255, 250, 242, 0.42);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
}

.seat-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.seat-zone-header strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.seat-zone-header span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.seat-zone-grid {
  display: grid;
  /* Fixed-ish tile width instead of a fixed column count, so a wider panel
     (e.g. .floor-panel.wide) fits more seats per row instead of stretching
     each tile into an oversized box. */
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  grid-auto-rows: 46px;
  align-content: start;
  gap: 6px;
  min-height: 0;
}

.seat-zone-empty {
  grid-column: 1 / -1;
  padding: 12px 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.floor-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.seat {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  background: #fbf7ef;
}

.seat strong,
.seat em {
  overflow-wrap: anywhere;
}

.seat strong {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 11px;
  line-height: 1.05;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat em {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 3px;
  padding: 2px 3px;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-height: 820px) and (min-width: 1000px) {
  .sidebar {
    padding: 18px 14px;
    gap: 16px;
  }

  .dashboard {
    padding: 14px 18px;
    gap: 10px;
  }

  .topbar {
    min-height: 60px;
  }

  h1 {
    font-size: 34px;
  }

  .topbar p,
  .panel p {
    display: none;
  }

  .ranking-panel p {
    display: block;
  }

  .floor-panel .seat-zone-empty {
    display: block;
  }

  .metric-card {
    padding: 13px 15px;
  }

  .metric-value {
    margin-top: 9px;
    font-size: 30px;
  }

  .metric-card p {
    display: block;
    margin-top: 7px;
  }

  .panel {
    padding: 14px 18px;
  }

  .panel-header {
    margin-bottom: 8px;
  }

  .staff-list {
    gap: 8px;
  }

  .staff-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 9px;
  }

  .rank {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .staff-name {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .staff-bar {
    height: 6px;
  }

  .legend {
    margin-bottom: 7px;
  }

  .seat-map {
    gap: 6px;
  }

  .seat-zone {
    padding: 6px;
    gap: 5px;
  }

  .seat-zone-grid {
    gap: 5px;
    grid-auto-rows: 50px;
  }

  .seat {
    padding: 4px;
  }
}

.seat.busy {
  border-color: rgba(35, 107, 69, 0.46);
  background: linear-gradient(180deg, #e8f8ec, #f3fbf4);
  box-shadow: inset 0 0 0 1px rgba(35, 107, 69, 0.08);
}

.seat.busy strong {
  color: #236b45;
}

.seat.busy em {
  color: #fff;
  background: #236b45;
}

.seat.free {
  border-color: rgba(226, 216, 202, 0.64);
  background: rgba(255, 250, 242, 0.48);
  color: #938a80;
}

.seat.free strong {
  color: #938a80;
}

.seat em.empty {
  visibility: hidden;
}

/* ============================================================
   Management pages: list panels, filter bar, tables
   (devices/stores/users list views)
   ============================================================ */

.management-body {
  overflow: hidden;
}

.management-body .field input,
.management-body .field select,
.management-body .field textarea,
.management-body .primary-button,
.management-body .secondary-button,
.management-body .secondary-link-button {
  font-size: 15px;
}

.management-page {
  min-width: 0;
  height: 100vh;
  padding: var(--page-padding);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--section-gap);
  overflow: hidden;
}

.list-panel {
  min-width: 0;
  min-height: 0;
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  padding: var(--panel-padding);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.list-panel > .panel-header,
.list-panel > .save-banner {
  margin-bottom: 0;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

.table-wrap {
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  overflow: auto;
  border: 1px solid rgba(232, 222, 210, 0.86);
  border-radius: var(--panel-radius);
}

.management-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 15px;
}

.store-management-table,
.device-management-table,
.seat-management-table,
.staff-management-table {
  font-size: 15px;
}

.management-table th,
.management-table td {
  padding: 17px 18px;
  border-bottom: 1px solid rgba(232, 222, 210, 0.72);
  text-align: left;
  white-space: nowrap;
}

.management-table td.wrap-cell {
  white-space: normal;
  max-width: 280px;
}

.management-table tbody tr {
  transition: background-color 0.12s ease;
}

.management-table tbody tr:hover {
  background: rgba(194, 139, 73, 0.16);
}

/* Shrink a column to just its content's width (e.g. a short numeric ID)
   instead of sharing the table's auto-layout space like the other columns. */
.management-table th.col-fit,
.management-table td.col-fit {
  width: 1%;
}

/* Denser row height for tables that can list many rows (e.g. sensors, one
   per seat/store) so more of them fit on screen without scrolling. */
.compact-table th,
.compact-table td {
  padding: 8px 14px;
  font-size: 13px;
}

.management-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #fffaf2;
  font-size: 13px;
  font-weight: 600;
}

/* Sticky th's each create their own stacking context, so the popover's
   z-index alone can't rise above sibling th's painted after it in the DOM.
   Bump the active th itself while its tooltip is open. */
.management-table th:has(.info-tooltip:hover),
.management-table th:has(.info-tooltip:focus),
.management-table th:has(.info-tooltip:focus-visible) {
  z-index: 6;
}

.th-with-info {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.info-tooltip {
  position: relative;
  display: inline-flex;
  cursor: help;
  color: #a89a86;
  border-radius: 50%;
}

.info-tooltip-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  /* Optical nudge - centering the icon's box against the text's line box
     still reads as slightly high next to CJK glyphs, whose line metrics
     carry more space above the ink than below. */
  position: relative;
  top: 1px;
}

.info-tooltip:hover,
.info-tooltip:focus,
.info-tooltip:focus-visible {
  color: #8f714f;
  outline: none;
}

.info-tooltip-panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 10px);
  left: 0;
  width: 280px;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  background: var(--panel-bg, #fffefa);
  /* Deliberately stronger than the ambient --shadow used by flat panels -
     this pops out over page content, so it needs to read as raised, not flush. */
  box-shadow: 0 4px 10px rgba(47, 42, 36, 0.14), 0 18px 34px rgba(47, 42, 36, 0.18);
  white-space: normal;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}

/* Opens toward the left instead - for a tooltip sitting near the right
   edge of its container, where the default left-anchored panel would run
   off the page. */
.info-tooltip--left .info-tooltip-panel {
  left: auto;
  right: 0;
}

.info-tooltip:hover .info-tooltip-panel,
.info-tooltip:focus .info-tooltip-panel,
.info-tooltip:focus-visible .info-tooltip-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.info-tooltip-title {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.info-tooltip-panel dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.info-tooltip-row {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.info-tooltip-row:first-child {
  padding-top: 0;
  border-top: none;
}

.info-tooltip-row dt {
  display: inline-flex;
  align-items: center;
  align-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(143, 113, 79, 0.12);
  color: #8f714f;
  font-size: 12px;
  font-weight: 600;
}

.info-tooltip-row dd {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
}

.info-tooltip-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
}

/* Metric cards clip overflow for their own content (charts, meters), which
   would otherwise also clip the tooltip panel popping out below the header.
   Lift the clip only while a tooltip inside the card is actually open. */
.metric-card:has(.info-tooltip:hover),
.metric-card:has(.info-tooltip:focus),
.metric-card:has(.info-tooltip:focus-visible) {
  overflow: visible;
}

.store-management-table th,
.device-management-table th,
.seat-management-table th,
.staff-management-table th {
  font-size: 13px;
}

.management-table td {
  color: #5f554b;
  background: rgba(255, 254, 250, 0.70);
}

.management-table tr:last-child td {
  border-bottom: 0;
}

.management-table td strong {
  color: var(--ink);
  font-weight: 500;
}

.store-management-table td strong {
  font-weight: 400;
}

.table-status,
.detail-link {
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.table-status {
  display: inline-flex;
  padding: 5px 8px;
}

.table-status.active {
  color: #236b45;
  background: #e8f8ec;
}

.table-status.inactive {
  color: #9c3b25;
  background: #f5e5df;
}

/* Same 使用中/空き colors as the dashboard's seat grid (.seat.busy / .seat.free)
   so a seat's status reads the same way everywhere in the app. */
.table-status.in-use {
  color: #236b45;
  background: #e8f8ec;
}

.table-status.free {
  color: #938a80;
  background: rgba(226, 216, 202, 0.4);
}

.detail-link,
.secondary-link-button {
  border: 1px solid rgba(143, 113, 79, 0.18);
  color: #7b6144;
  background: rgba(255, 250, 242, 0.82);
  text-decoration: none;
  font-weight: 500;
}

.detail-link {
  display: inline-flex;
  padding: 6px 11px;
}

/* Row-level action cell: the "detail" link plus a destructive "delete"
   button, sitting side by side at the end of a management-table row. */
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-actions form {
  display: inline-flex;
}

.danger-link-button {
  display: inline-flex;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(156, 59, 37, 0.35);
  color: #9c3b25;
  background: transparent;
  cursor: pointer;
}

.danger-link-button:hover {
  background: rgba(156, 59, 37, 0.08);
}

.secondary-link-button {
  min-height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
}

.detail-link:hover,
.secondary-link-button:hover {
  color: #5f4b35;
  border-color: rgba(143, 113, 79, 0.32);
  background: rgba(194, 139, 73, 0.14);
}

/* ============================================================
   Detail & report page layout
   (device/store/user detail, reports.html)
   ============================================================ */

.detail-layout {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--section-gap);
}

.single-detail-layout {
  grid-template-rows: minmax(0, 1fr);
}

.report-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--section-gap);
}

.report-condition-panel,
.report-preview-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.report-form {
  min-height: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}

.report-store-field {
  grid-template-columns: 1fr;
}

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

.report-auto-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(143, 113, 79, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.report-auto-note::before {
  content: "";
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #8f714f;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.report-paper-frame {
  min-height: 0;
  height: 100%;
  overflow: auto;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(232, 222, 210, 0.86);
  border-radius: 8px;
  background: #fff;
}

/* ---- Report paper (printable preview) ----
   The actual report content is rendered inside an <iframe>
   (resources/views/reports/preview.blade.php) with its own inline <style>,
   written in dompdf-safe CSS so that exact same markup/CSS can later be fed
   to dompdf for PDF export as-is — it is the real A4 page, with no border
   or shadow of its own. The "sheet of paper" look is purely a browser-side
   mockup, so it lives here on the iframe element instead, where it can
   never leak into the generated PDF. */

.report-preview-iframe {
  display: block;
  align-self: start;
  width: min(100%, 620px);
  aspect-ratio: 210 / 297;
  min-height: 720px;
  margin-bottom: 18px;
  border: 1px solid rgba(232, 222, 210, 0.95);
  box-shadow: 0 16px 34px rgba(91, 72, 49, 0.14);
  background: #fff;
}

/* ---- Store detail: sensor list table ---- */

.sensor-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.sensor-table-wrap {
  max-height: 360px;
}

.sensor-table {
  min-width: 520px;
  font-size: 15px;
}

.sensor-table th,
.sensor-table td {
  padding: 11px 13px;
}

.sensor-table th {
  font-size: 13px;
}

.detail-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  /* Grid items default to align-items: stretch, so a field that grows taller
     (e.g. an error message pushing it to 3 rows) stretches every other field
     sharing that row to match — making them visibly balloon for no reason.
     Aligning to the start keeps each field at its own natural size. */
  align-items: start;
}

/* ============================================================
   Settings page
   ============================================================ */

.settings-panel {
  width: 100%;
}

.save-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 420px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(35, 107, 69, 0.16);
  background: #e8f8ec;
  color: #236b45;
  font-size: 14px;
  font-weight: 500;
  animation: save-banner-fade 4s ease forwards;
}

.save-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes save-banner-fade {
  0% { opacity: 0; transform: translateY(-4px); }
  8%, 82% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .save-banner {
    animation: none;
  }
}

.settings-form {
  max-width: 420px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}

.settings-form .panel-header {
  margin-bottom: 0;
}

.settings-form .field span {
  color: #5f554b;
  font-size: 14px;
}

.threshold-field {
  align-content: start;
}

.percent-input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  background: rgba(255, 250, 242, 0.72);
  overflow: hidden;
}

.percent-input input {
  min-height: 44px;
  border: 0;
  flex: 1;
  padding: 0 13px;
  background: transparent;
  box-shadow: none;
  font: inherit;
}

.percent-input b {
  height: 100%;
  min-width: 46px;
  border-left: 1px solid rgba(232, 222, 210, 0.86);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  background: rgba(232, 222, 210, 0.24);
}

.settings-actions {
  justify-content: center;
  padding-top: 5px;
}

.settings-actions .primary-button {
  min-width: 132px;
  min-height: 42px;
}

.percent-input:focus-within {
  border-color: rgba(194, 139, 73, 0.78);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(194, 139, 73, 0.14);
}

.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 250, 242, 0.72);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field select {
  min-height: 46px;
  padding: 0 13px;
}

.field textarea {
  min-height: 84px;
  padding: 11px 13px;
  resize: vertical;
}

.field select:focus,
.field textarea:focus {
  border-color: rgba(194, 139, 73, 0.78);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(194, 139, 73, 0.14);
}

.field input[readonly] {
  color: var(--muted);
  background: rgba(232, 222, 210, 0.24);
}

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

/* ============================================================
   Form fields, textareas & permission checkboxes
   (used by user-detail.html and reports.html)
   ============================================================ */

.permission-field {
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(232, 222, 210, 0.86);
  border-radius: 8px;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  background: rgba(255, 250, 242, 0.44);
}

.permission-field legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.permission-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}

.permission-action-button {
  min-height: 28px;
  border: 1px solid rgba(143, 113, 79, 0.18);
  border-radius: 999px;
  padding: 0 10px;
  color: #7b6144;
  background: rgba(255, 250, 242, 0.82);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.permission-action-button:hover {
  color: #5f4b35;
  border-color: rgba(143, 113, 79, 0.32);
  background: rgba(194, 139, 73, 0.14);
}

.permission-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
}

.permission-field input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #8f714f;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 500;
  cursor: pointer;
}

.primary-button {
  border: 1px solid #8f714f;
  color: #fffaf2;
  background: #8f714f;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 250, 242, 0.72);
}

.primary-button:hover {
  background: #806446;
}

.primary-button:disabled {
  /* Fades the whole button — background, border, and text together —
     instead of swapping in separate muted colors, which just read as
     "a different-colored button" rather than "disabled". */
  opacity: 0.4;
  cursor: not-allowed;
}

.primary-button:disabled:hover {
  background: #8f714f;
}

.secondary-button:hover {
  background: var(--surface);
}

.danger-button,
.top-actions .danger-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #9c3b25;
  color: #fffaf2;
  background: #b3452c;
}

.danger-button:hover,
.top-actions .danger-button:hover {
  background: #9c3b25;
}

/* ============================================================
   Responsive breakpoints
   ============================================================ */

@media (max-width: 1180px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    justify-items: center;
  }

  .login-intro,
  .login-card {
    width: 100%;
    max-width: 520px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .management-body {
    overflow: auto;
  }

  .management-body .app-shell,
  .management-page {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    display: block;
  }

  .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .sidebar-user-card {
    margin-top: 18px;
  }

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

  .content-grid .wide,
  .floor-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .login-shell {
    padding: 18px;
    gap: 24px;
  }

  .login-intro {
    gap: 24px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .dashboard {
    padding: 18px;
    width: 100%;
    overflow: hidden;
  }

  .management-page {
    padding: 18px;
  }

  .sidebar {
    padding: 18px;
    display: block;
    width: 100%;
    overflow: hidden;
  }

  .brand {
    margin-bottom: 16px;
  }

  .nav-list a {
    min-width: 0;
    text-align: center;
  }

  .sidebar-user-card {
    width: 100%;
    margin: 16px 0 0;
  }

  .topbar,
  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions select,
  .top-actions button,
  .secondary-link-button {
    width: 100%;
  }

  .metrics-grid,
  .content-grid,
  .content-grid.bottom {
    grid-template-columns: 1fr;
  }

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

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

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .report-layout {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

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

  .preview-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .report-preview-panel .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .permission-field {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions button {
    width: 100%;
  }

  .settings-actions button {
    width: auto;
  }

  .chart-box,
  .chart-box.large {
    height: 300px;
  }

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

@media (max-width: 440px) {
  .nav-list a {
    text-align: center;
  }

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