:root {
  --ink: #10251f;
  --ink-2: #19382f;
  --paper: #f6f0e4;
  --card: rgba(255, 252, 243, 0.9);
  --muted: #6f776f;
  --line: rgba(16, 37, 31, 0.14);
  --green: #237a54;
  --gold: #c88a1d;
  --red: #b94a3a;
  --shadow: 0 24px 80px rgba(16, 37, 31, 0.16);
  --font-xs: 10px;
  --font-sm: 11px;
  --font-base: 12px;
  --font-md: 13px;
  --font-lg: 14px;
  --font-xl: 16px;
  --font-2xl: 18px;
  --font-3xl: 20px;
  --font-4xl: 24px;
  --font-5xl: 28px;
  --font-6xl: 32px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: var(--font-base);
  line-height: 1.5;
  letter-spacing: 0.02em;
  background:
    radial-gradient(circle at 10% 10%, rgba(200, 138, 29, 0.22), transparent 28rem),
    radial-gradient(circle at 90% 4%, rgba(35, 122, 84, 0.22), transparent 26rem),
    linear-gradient(135deg, #efe5d0, #f9f4e9 46%, #e4eee5);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.shell.sidebar-collapsed {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  color: #fffaf0;
  background: linear-gradient(180deg, var(--ink), var(--ink-2));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--font-sm);
}

.brand,
.panel-title,
.status-panel,
.secret-row,
.filters {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  justify-content: space-between;
}

.sidebar-minimize-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 250, 240, 0.8);
  font-size: var(--font-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-minimize-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.95);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 12px;
  font-weight: 900;
  font-size: var(--font-lg);
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.device-card span {
  color: rgba(255, 250, 240, 0.68);
}

.sidebar.minimized {
  padding: 12px 16px;
  height: auto;
  overflow: hidden;
}

.sidebar.minimized .brand > div {
  display: none;
}

.sidebar.minimized .brand {
  justify-content: center;
}

.sidebar.minimized .nav,
.sidebar.minimized .user-card,
.sidebar.minimized .device-card {
  display: none;
}

.nav {
  display: grid;
  gap: 8px;
  margin: 32px 0;
}

.nav a {
  color: #fffaf0;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  transition: 0.2s ease;
  font-size: var(--font-sm);
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateX(4px);
}

.device-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

code {
  word-break: break-all;
  color: #ffe0a6;
}

.content {
  padding: 28px;
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 180px;
  padding: 24px;
  color: #fffaf0;
  background:
    linear-gradient(130deg, rgba(16, 37, 31, 0.94), rgba(25, 56, 47, 0.78)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 15px);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.minimize-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-xl);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  justify-self: flex-end;
  transition: all 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.minimize-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.minimize-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.25);
}

#dashboardDetails {
  transition: all 0.3s ease;
  max-height: 500px;
}

#dashboardMetrics {
  transition: all 0.3s ease;
  max-height: 200px;
}

#dashboard.minimized #dashboardDetails {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0 !important;
  padding: 0;
}

#dashboard.minimized #dashboardDetails h1 {
  margin: 0 !important;
  padding: 0;
}

#dashboard.minimized {
  min-height: auto;
  padding-top: 16px;
  padding-bottom: 16px;
}

#dashboard.minimized + #dashboardMetrics {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.hero h1 {
  max-width: 600px;
  margin: 6px 0 12px;
  font-size: clamp(20px, 4vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.account-inactive-notice {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(244, 95, 95, 0.48);
  border-radius: 999px;
  color: #fff;
  background: rgba(244, 95, 95, 0.22);
  box-shadow: 0 12px 30px rgba(244, 95, 95, 0.18);
  font-size: var(--font-sm);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.account-inactive-notice[hidden] {
  display: none;
}

body.account-inactive .metric-action,
body.account-inactive .nav a,
body.account-inactive .shop-pill,
body.account-inactive .month-option {
  cursor: not-allowed;
}

body.account-inactive .shell button:not(#btnLogout),
body.account-inactive .shell input,
body.account-inactive .shell select,
body.account-inactive .shell textarea,
body.account-inactive .shell a,
body.account-inactive .shell [role="button"]:not(#btnLogout) {
  filter: grayscale(0.18);
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: var(--font-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-panel {
  align-self: end;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.sync-float-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px;
  min-width: 100px;
  max-width: 140px;
  border: 1px solid rgba(35, 122, 84, 0.3);
  border-radius: 12px;
  background: rgba(255, 250, 240, 0.95);
  box-shadow: 0 6px 16px rgba(16, 37, 31, 0.1);
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  touch-action: none;
}

.sync-minimize-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(16, 37, 31, 0.1);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sync-minimize-btn:active {
  background: rgba(16, 37, 31, 0.2);
  transform: scale(0.95);
}

.sync-minimize-btn:hover {
  background: rgba(16, 37, 31, 0.2);
  color: var(--ink);
}

.sync-float-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.sync-float-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.sync-float-panel .badge {
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: 9px;
}

.sync-float-panel strong {
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-float-panel small {
  font-size: 8px;
  color: var(--muted);
}

.sync-float-panel .btn {
  width: 100%;
  margin-top: 2px;
  padding: 4px 8px;
  font-size: 9px;
}

.sync-icon-state {
  display: none;
  padding: 6px;
  cursor: pointer;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.sync-float-panel.minimized {
  min-width: auto;
  max-width: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
}

.sync-float-panel.minimized .sync-minimize-btn {
  display: none;
}

.sync-float-panel.minimized .sync-float-content {
  display: none;
}

.sync-float-panel.minimized .sync-icon-state {
  display: flex;
}

.sync-float-panel.minimized .badge {
  padding: 2px 4px;
  font-size: 8px;
}

@media (max-width: 768px) {
  .sync-float-panel {
    bottom: 8px;
    right: 8px;
    left: auto;
    min-width: 90px;
    max-width: 120px;
  }
  
  .sync-float-panel.minimized {
    right: 8px;
    left: auto;
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .sync-float-panel {
    padding: 6px;
    gap: 3px;
    min-width: 80px;
    max-width: 100px;
  }
  
  .sync-float-panel strong {
    font-size: 9px;
  }
  
  .sync-float-panel .btn {
    padding: 3px 6px;
    font-size: 8px;
  }
  
  .sync-float-panel.minimized {
    width: 32px;
    height: 32px;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.synced,
.badge.syncing {
  background: var(--green);
}

.badge.offline,
.badge.error,
.badge.conflict {
  background: var(--red);
}

.metrics,
.grid,
.sync-grid {
  display: grid;
  gap: 18px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 14px 44px rgba(16, 37, 31, 0.08);
  backdrop-filter: blur(14px);
}

.metric-card {
  padding: 16px;
}

.metric-action {
  position: relative;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.metric-action::after {
  content: "查看";
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(35, 122, 84, 0.1);
  font-size: var(--font-xs);
  font-weight: 800;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.metric-action:hover,
.metric-action:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(35, 122, 84, 0.28);
  box-shadow: 0 18px 48px rgba(16, 37, 31, 0.13);
  outline: none;
}

.metric-action:hover::after,
.metric-action:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.metric-action:active,
.metric-action.is-pressed {
  transform: translateY(1px) scale(0.99);
}

.detail-focus {
  animation: detailPulse 1.05s ease;
}

@keyframes detailPulse {
  0% { box-shadow: 0 0 0 0 rgba(35, 122, 84, 0.34); }
  100% { box-shadow: 0 0 0 18px rgba(35, 122, 84, 0); }
}

.metric-card span {
  color: var(--muted);
  font-size: var(--font-sm);
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: clamp(16px, 2.5vw, 24px);
}

.grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

#analysis {
  margin-top: 0;
}

.panel {
  margin-bottom: 22px;
  padding: 24px;
  transition: all 0.3s ease;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
  align-items: center;
  font-size: var(--font-md);
}

.panel-toggle {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(35, 122, 84, 0.1);
  color: var(--green);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.panel-toggle:hover {
  background: rgba(35, 122, 84, 0.2);
  transform: rotate(180deg);
}

.panel-toggle.collapsed {
  transform: rotate(0deg);
}

.panel-toggle.collapsed:hover {
  transform: rotate(180deg);
}

.panel-body {
  display: block;
  transition: all 0.3s ease;
}

.panel.collapsed .panel-body {
  display: none;
}

.panel.collapsed {
  padding-bottom: 16px;
}

.panel.collapsed .panel-title {
  margin-bottom: 0;
}

.panel h2,
.panel h3 {
  margin: 4px 0 0;
}

.analysis-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.analysis-controls select,
.analysis-controls input,
.analysis-controls button {
  width: auto;
  min-width: 150px;
}

.analysis-loading {
  margin: -6px 0 14px;
  padding: 10px 14px;
  color: var(--green);
  background: rgba(35, 122, 84, 0.1);
  border: 1px solid rgba(35, 122, 84, 0.18);
  border-radius: 14px;
  font-weight: 800;
}

.analysis-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.analysis-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.analysis-summary span,
.analysis-summary strong {
  display: block;
}

.analysis-summary span {
  color: var(--muted);
  font-size: 13px;
}

.analysis-summary strong {
  margin-top: 6px;
  font-size: 18px;
}

.month-picker {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 37, 31, 0.38);
  backdrop-filter: blur(8px);
}

.month-picker[hidden] {
  display: none;
}

.month-picker-card {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 26px;
  background: rgba(255, 252, 243, 0.96);
  box-shadow: var(--shadow);
}

.month-year-label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 800;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.month-option {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-weight: 900;
  transition: 0.2s ease;
}

.month-option:hover,
.month-option.active {
  color: #fff;
  background: var(--green);
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.shop-panel {
  overflow: hidden;
}

.shop-create,
.week-toolbar,
.week-actions,
.shop-list {
  display: flex;
  align-items: end;
  gap: 10px;
}

.shop-create {
  margin-bottom: 10px;
}

.shop-create label {
  flex: 1;
}

.shop-delete {
  white-space: nowrap;
}

.shop-list {
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.shop-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  font-weight: 800;
}

.shop-pill.active {
  color: #fff;
  background: var(--green);
}

.week-toolbar {
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 10px;
}

.week-toolbar strong,
.week-toolbar small {
  display: block;
}

.week-loading {
  margin-top: 4px;
  color: var(--gold);
  font-weight: 800;
}

.week-actions {
  position: relative;
  flex-wrap: wrap;
}

.week-actions input {
  width: 220px;
}

.shop-date-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.98);
  box-shadow: 0 18px 38px rgba(73, 43, 18, 0.16);
}

.date-mode-row,
.date-fields,
.date-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.date-mode-row {
  margin-bottom: 10px;
  font-weight: 800;
}

.date-fields {
  margin-bottom: 12px;
}

.date-fields label {
  display: grid;
  gap: 4px;
  min-width: 160px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.date-fields input[type="date"] {
  width: 100%;
}

.shop-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(68vh, 720px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
  scrollbar-gutter: stable;
}

.shop-week-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.col-weekday {
  width: 8%;
}

.col-date {
  width: 12%;
}

.col-data {
  width: 11.5%;
}

.col-total {
  width: 22.5%;
}

.shop-week-table th,
.shop-week-table td {
  padding: 5px 5px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  font-size: var(--font-xs);
}

.shop-week-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #fffaf0;
  background: linear-gradient(180deg, var(--ink), var(--ink-2));
  font-size: var(--font-xs);
  font-weight: 700;
}

.category-name-button,
.category-name-readonly {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 9px;
  color: #fffaf0;
  font-size: 12px;
  font-weight: 900;
}

.category-name-button {
  border: 1px solid rgba(255, 250, 240, 0.24);
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.category-name-button:hover,
.category-name-button:focus {
  background: rgba(255, 250, 240, 0.2);
  outline: none;
}

.category-name-readonly {
  opacity: 0.86;
}

.category-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.category-editor .category-name-input {
  width: 100%;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(255, 250, 240, 0.36);
  border-radius: 8px;
  color: var(--ink);
  background: #fffaf0;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.category-edit-save,
.category-edit-cancel {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.category-edit-save {
  color: var(--ink);
  background: #fff4d6;
}

.category-edit-cancel {
  color: #fffaf0;
  background: rgba(255, 255, 255, 0.18);
}

.shop-week-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  color: var(--ink);
  background: #fff4d6;
  font-weight: 900;
}

.data-item-cell {
  background: rgba(255, 255, 255, 0.22);
}

.data-input-box {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(16, 37, 31, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
}

.data-input-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.shop-week-table input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 9px;
  text-align: right;
}

.day-total-cell,
.week-grand-total-cell {
  background: rgba(35, 122, 84, 0.08);
}

.day-total-box {
  display: inline-grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 2px solid rgba(35, 122, 84, 0.55);
  border-radius: 13px;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 244, 214, 0.95), rgba(255, 255, 255, 0.9));
  box-shadow: 0 10px 26px rgba(16, 37, 31, 0.12);
  font-size: 15px;
  font-weight: 900;
}

.week-total-box {
  border-color: rgba(200, 138, 29, 0.72);
  background: linear-gradient(135deg, rgba(255, 226, 154, 0.98), rgba(255, 244, 214, 0.96));
}

.month-total-box {
  border-color: rgba(35, 122, 84, 0.72);
  background: linear-gradient(135deg, rgba(188, 230, 207, 0.98), rgba(228, 238, 229, 0.96));
}

.month-shop-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.month-shop-controls input {
  flex: 1;
  min-width: 120px;
}

.month-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
}

.month-toolbar strong,
.month-toolbar small {
  display: block;
}

.month-loading {
  margin-top: 4px;
  color: var(--gold);
  font-weight: 800;
}

.month-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.month-actions input {
  width: 220px;
}

.shop-month-table {
  width: 100%;
  border-collapse: collapse;
}

.shop-month-table th,
.shop-month-table td {
  padding: 5px 6px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-size: var(--font-xs);
}

.shop-month-table th {
  background: rgba(35, 122, 84, 0.06);
  font-weight: 700;
  font-size: var(--font-xs);
}

.shop-month-table td:first-child,
.shop-month-table td:nth-child(2) {
  text-align: center;
}

.shop-month-table input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 9px;
  text-align: right;
}

.month-grand-total-cell {
  background: rgba(35, 122, 84, 0.1);
}

.month-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.month-summary-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.month-summary-card span,
.month-summary-card strong {
  display: block;
}

.month-summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.month-summary-card strong {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  color: var(--green);
}

.trend-chart {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.trend-header {
  margin-bottom: 12px;
  font-weight: 800;
  color: var(--ink);
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  height: 180px;
  padding: 10px 0;
}

.trend-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.trend-bar {
  width: 100%;
  min-width: 4px;
  max-width: 24px;
  background: linear-gradient(180deg, var(--green), rgba(35, 122, 84, 0.4));
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.trend-bar-weekend {
  background: linear-gradient(180deg, var(--gold), rgba(200, 138, 29, 0.4));
}

.trend-bar-label {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.shop-week-table input.input-error {
  border-color: #d94b4b;
  color: #9d1f1f;
  background: #fff1f1;
}

.search-hit,
.search-hit-row td {
  background: rgba(200, 138, 29, 0.16);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  outline: none;
  font-size: var(--font-sm);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(35, 122, 84, 0.12);
}

.wide {
  grid-column: 1 / -1;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
  transition: 0.2s ease;
  font-size: var(--font-sm);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: var(--green);
}

.btn-danger {
  color: #fff;
  background: var(--red);
}

.btn-light {
  color: var(--ink);
  background: #fff4d6;
}

.btn-ghost {
  color: var(--green);
  background: rgba(35, 122, 84, 0.1);
}

.record-list {
  display: grid;
  gap: 12px;
}

.log-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  min-width: 96px;
  box-shadow: 0 14px 44px rgba(16, 37, 31, 0.2);
}

.log-drawer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  left: 304px;
  z-index: 70;
  max-height: min(72vh, 720px);
  margin: 0;
  overflow: hidden;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.log-drawer[hidden] {
  display: none;
}

.log-drawer.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.log-drawer .panel-title {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -24px -24px 18px;
  padding: 20px 24px;
  background: rgba(255, 252, 243, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.log-filters {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.log-filters input {
  width: min(320px, 42vw);
}

.log-filters input[type="date"] {
  width: 150px;
}

.log-filters select {
  width: 150px;
}

.log-drawer .record-list {
  max-height: calc(min(72vh, 720px) - 118px);
  overflow: auto;
  padding-right: 4px;
}

.table-result {
  margin: 18px 0 14px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.record-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px 90px 100px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  font-size: var(--font-xs);
}

.audit-row {
  grid-template-columns: 160px minmax(0, 1fr) 120px 132px;
  align-items: start;
}

.audit-state {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(35, 122, 84, 0.07);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.record-main strong,
.bar-label strong {
  display: block;
}

.record-main small,
.muted,
.bar-label span,
.conflict-list,
.sync-detail-list {
  color: var(--muted);
}

.amount {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-weight: 900;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  padding: 8px 10px;
  border-radius: 10px;
}

.sync-detail-list {
  display: grid;
  gap: 10px;
}

.sync-detail-list .record-row {
  background: rgba(255, 250, 240, 0.7);
}

.bars {
  display: grid;
  gap: 14px;
}

.bars.compact {
  margin-top: 24px;
}

.bar {
  display: grid;
  gap: 8px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 37, 31, 0.1);
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.4s ease;
}

.sync-grid {
  grid-template-columns: 1fr 1fr;
}

.secret-row {
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 14px 16px;
  color: #fffaf0;
  background: var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

@media (max-width: 1024px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 24px 0;
  }

  .log-drawer {
    left: 24px;
  }

  .hero,
  .grid,
  .sync-grid {
    grid-template-columns: 1fr;
  }

  .shop-table-wrap {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar,
  .hero,
  .panel {
    padding: 18px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-summary {
    grid-template-columns: 1fr;
  }

  .entry-form,
  .filters,
  .log-filters,
  .analysis-controls,
  .shop-create,
  .week-toolbar,
  .week-actions,
  .secret-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .week-actions input {
    width: 100%;
  }

  .shop-table-wrap {
    overflow-x: auto;
  }

  .shop-week-table {
    min-width: 760px;
  }

  .analysis-controls select,
  .analysis-controls input {
    width: 100%;
  }

  .month-picker {
    padding: 14px;
  }

  .month-picker-card {
    padding: 18px;
    border-radius: 22px;
  }

  .month-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .log-toggle {
    right: 18px;
    bottom: 18px;
  }

  .log-drawer {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-height: calc(100vh - 24px);
    padding: 18px;
    border-radius: 22px;
  }

  .log-drawer .panel-title {
    margin: -18px -18px 16px;
    padding: 18px;
  }

  .log-filters input,
  .log-filters select {
    width: 100%;
  }

  .log-drawer .record-list {
    max-height: calc(100vh - 220px);
  }

  .record-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: auto;
  }

  .minimize-btn {
    width: 52px;
    height: 52px;
    font-size: 24px;
    border-radius: 16px;
    justify-self: flex-end;
  }

  .sidebar-minimize-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
    border-radius: 12px;
  }

  .sync-minimize-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
    border-radius: 10px;
    top: 6px;
    right: 6px;
  }

  .shop-create {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .shop-create input {
    width: 100%;
  }

  .month-shop-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .month-shop-controls input {
    width: 100%;
  }

  .month-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .month-actions input {
    width: 100%;
  }

  .shop-month-table {
    min-width: 760px;
  }

  .panel-title {
    flex-wrap: wrap;
  }

  .panel-toggle {
    margin-left: auto;
  }

  .shop-pill {
    font-size: 12px;
    padding: 8px 12px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }

  input,
  select {
    padding: 10px 12px;
    font-size: 14px;
  }
}
