:root {
  --bg: #0b0e14;
  --bg-elev: #121826;
  --bg-soft: #182033;
  --accent: #ff8a3d;
  --accent-2: #3dd9ff;
  --text: #f5f7ff;
  --muted: #9aa3b2;
  --success: #3dff9a;
  --danger: #ff4d5e;
  --card: #141b2d;
  --border: #24304a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

@font-face {
  font-family: "Inter";
  src: url("assets/inter.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Inter";
  background: radial-gradient(circle at top right, #1c2440 0%, #0b0e14 45%, #0a0d12 100%);
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.05px;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font-family: inherit;
}

.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  display: none;
  flex-direction: column;
  width: 240px;
  background: linear-gradient(180deg, #101728 0%, #0c111b 100%);
  border-right: 1px solid var(--border);
  padding: 24px;
  gap: 24px;
}

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

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #ffcc3d);
  color: #0b0e14;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.brand-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.nav-link:hover,
.nav-link.active {
  border-color: var(--accent);
  background: rgba(255, 138, 61, 0.1);
}

.offline-card {
  margin-top: auto;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.offline {
  background: var(--danger);
}

.main-content {
  flex: 1;
  width: 100%;
  padding: 20px 18px 120px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.xp-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}

.level-badge {
  background: var(--accent);
  color: #0b0e14;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.xp-track {
  flex: 1;
  height: 8px;
  background: #1a2237;
  border-radius: 999px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.xp-text {
  font-size: 12px;
  color: var(--muted);
}

.workout-timer {
  background: var(--card);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

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

.primary,
.secondary,
.ghost,
.danger-btn,
.chip {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #ffbb55);
  color: #0b0e14;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.secondary {
  background: var(--bg-soft);
  color: var(--text);
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.danger-btn {
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 600;
}

.chip {
  background: rgba(61, 217, 255, 0.12);
  color: var(--text);
  border: 1px solid rgba(61, 217, 255, 0.25);
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger-btn:hover,
.chip:hover {
  transform: translateY(-1px);
}

.view {
  display: none;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: flex;
}

.hero {
  background: linear-gradient(135deg, #18233c, #0b0e14);
  border-radius: 20px;
  padding: 22px;
  display: grid;
  gap: 18px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

h2,
h3 {
  font-weight: 600;
  letter-spacing: 0.2px;
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: 1fr;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  animation: riseIn 0.35s ease both;
}

.card.danger {
  border-color: rgba(255, 77, 94, 0.4);
}

.muted {
  color: var(--muted);
}

.split-label {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.split-row {
  display: grid;
  gap: 16px;
}

.split-controls {
  display: grid;
  gap: 12px;
}

.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-tab {
  border-radius: 12px;
  padding: 6px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}

.day-tab.active {
  background: rgba(255, 138, 61, 0.15);
  border-color: var(--accent);
}

.lift-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.finish-bar {
  margin-top: 16px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.08), rgba(61, 217, 255, 0.06));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  position: sticky;
  bottom: 96px;
  z-index: 2;
  box-shadow: none;
}

.finish-bar .primary {
  width: 100%;
  padding: 12px 14px;
}

.finish-celebrate {
  font-size: 12px;
  color: var(--success);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
  text-align: center;
}

.finish-celebrate.show {
  animation: celebratePop 1.1s ease both;
}

.exercise-list {
  display: grid;
  gap: 16px;
}

.exercise-card {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  animation: riseIn 0.35s ease both;
}

.exercise-card.pr {
  border: 1px solid rgba(61, 255, 154, 0.6);
}

.last-stats {
  font-size: 12px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.meta-left {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.set-controls-inline {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.set-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  padding: 0;
  line-height: 28px;
  font-weight: 700;
}

.set-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.exercise-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exercise-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.exercise-actions .remove-exercise {
  background: rgba(255, 77, 94, 0.16);
  border-color: rgba(255, 77, 94, 0.4);
  color: #ff4d5e;
}

.edit-mode-label {
  display: none;
  font-size: 12px;
  color: var(--muted);
}

.edit-mode-label.active {
  display: inline-block;
}

.set-grid {
  display: grid;
  gap: 8px;
}

.set-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 48px;
  gap: 8px;
  align-items: center;
}

.set-row input {
  width: 100%;
}

.field {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px;
  background: #0e1321;
  color: var(--text);
}

.field.improve {
  border-color: rgba(61, 255, 154, 0.7);
  box-shadow: 0 0 0 1px rgba(61, 255, 154, 0.2);
}

.field.invalid {
  border-color: rgba(255, 77, 94, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 77, 94, 0.25);
}

.set-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1424;
  color: var(--text);
  cursor: pointer;
}

.set-toggle.done {
  background: var(--success);
  color: #06110a;
  border-color: transparent;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.result {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-period {
  display: grid;
  gap: 8px;
  min-width: 240px;
}

.history-period-tabs .seg-tab {
  padding: 6px 10px;
  font-size: 12px;
}

.history-period-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.history-period-nav .chip {
  padding: 4px 8px;
  font-size: 12px;
}

.history-calories {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.history-calories .label {
  color: var(--muted);
}

.history-item {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  animation: riseIn 0.35s ease both;
}

.history-group {
  display: grid;
  gap: 10px;
}

.history-group-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 6px;
}

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

.history-row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  width: 100%;
}

.history-row-main {
  display: grid;
  gap: 2px;
}

.history-row-metrics {
  display: inline-flex;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.history-delete-icon-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 4px;
  cursor: pointer;
}

.history-delete-icon-btn:hover {
  color: var(--text);
}

.history-inline-details {
  display: none;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
}

.history-item.expanded .history-inline-details {
  display: grid;
}

.history-inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.history-inline-exercises {
  font-size: 12px;
  color: var(--muted);
}

.history-inline-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.history-inline-details-list {
  display: grid;
  gap: 8px;
}

.history-detail-exercise {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.set-table {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.set-table-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.set-table-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(228, 232, 240, 0.7);
}

.set-controls {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.set-controls .set-control-btn {
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1;
  border-radius: 999px;
}

.set-controls .chip[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.history-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-load-more {
  justify-self: start;
}

.insight-list + .secondary {
  margin-top: 8px;
}

.weekly-progress {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-entry-actions {
  display: inline-flex;
  gap: 8px;
}

.history-entry-actions .chip {
  padding: 6px 10px;
  font-size: 12px;
}


.history-delete-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.history-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.history-detail-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  color: var(--muted);
}

.edit-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #e4e8f0;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}

.history-edit-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.history-edit-row .field {
  max-width: none;
  flex: 1 1 180px;
}

.compact-number-input {
  height: 42px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

.history-detail-meta .field {
  height: 40px;
  padding: 8px 10px;
  box-sizing: border-box;
}

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

.history-exercise {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.history-sets {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.history-set-edit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-edit-notes {
  resize: vertical;
}

.history-notes {
  font-size: 12px;
  color: var(--muted);
}

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

.timeline-item {
  display: grid;
  gap: 8px;
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 12px;
  animation: riseIn 0.35s ease both;
}

.timeline-item img {
  width: 100%;
  border-radius: 12px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 10px 16px;
  background: rgba(11, 14, 20, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav-icon {
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
  transition: transform 0.15s ease, color 0.2s ease;
  min-height: 52px;
  border-radius: 12px;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.nav-icon.active {
  color: var(--accent);
  background: rgba(255, 138, 61, 0.12);
}

.nav-icon:active {
  transform: translateY(-2px);
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-btn:active {
  transform: translateY(-2px);
}

.seg-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: #0f1424;
  border: 1px solid var(--border);
}

.seg-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  font-weight: 600;
  cursor: pointer;
}

.seg-tab.active {
  background: var(--accent);
  color: #0b0e14;
}

.rest-timer {
  position: fixed;
  right: 20px;
  bottom: 110px;
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.rest-timer.active {
  display: flex;
}

.rest-time {
  font-size: 22px;
  text-align: center;
}

.rest-actions {
  display: flex;
  gap: 6px;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.toast.show {
  opacity: 1;
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background-image: radial-gradient(circle, rgba(255, 138, 61, 0.7) 2px, transparent 2px),
    radial-gradient(circle, rgba(61, 217, 255, 0.7) 2px, transparent 2px);
  background-size: 12px 12px;
  animation: confetti 1s ease forwards;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 16, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  display: grid;
  gap: 12px;
  max-height: 90vh;
  overflow-y: auto;
}

.finish-summary {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.finish-summary strong {
  color: var(--text);
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mobile-summary {
  display: none;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.12), rgba(61, 217, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 12px 14px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.mobile-summary .label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.mobile-summary strong {
  font-size: 16px;
}

.mobile-timer {
  text-align: right;
}

.exercise-options {
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.exercise-option {
  padding: 8px 10px;
  border-radius: 10px;
  background: #0f1424;
  border: 1px solid var(--border);
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes confetti {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes celebratePop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  35% {
    opacity: 1;
    transform: translateY(0) scale(1.02);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.grid .card:nth-child(1) {
  animation-delay: 0.04s;
}

.grid .card:nth-child(2) {
  animation-delay: 0.08s;
}

.grid .card:nth-child(3) {
  animation-delay: 0.12s;
}

.exercise-list .exercise-card:nth-child(1),
.history-list .history-item:nth-child(1),
.timeline-grid .timeline-item:nth-child(1) {
  animation-delay: 0.04s;
}

.exercise-list .exercise-card:nth-child(2),
.history-list .history-item:nth-child(2),
.timeline-grid .timeline-item:nth-child(2) {
  animation-delay: 0.08s;
}

.exercise-list .exercise-card:nth-child(3),
.history-list .history-item:nth-child(3),
.timeline-grid .timeline-item:nth-child(3) {
  animation-delay: 0.12s;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .exercise-card,
  .history-item,
  .timeline-item {
    animation: none;
  }
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
  }

  .main-content {
    padding: 30px 40px 40px;
  }

  .bottom-nav {
    display: none;
  }

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

  .split-row {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .finish-bar {
    position: static;
  }
}

@media (hover: none) and (pointer: coarse) {
  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .split-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .top-bar {
    gap: 10px;
    justify-content: flex-start;
  }

  .xp-box {
    flex: 1 1 100%;
  }

  .workout-timer {
    flex: 1 1 auto;
  }

  .primary.ghost {
    width: 100%;
    justify-content: center;
  }

  .mobile-summary {
    display: flex;
  }

  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }

  .history-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-detail-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .history-edit-row {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .history-edit-row .field {
    width: 100%;
    max-width: 100%;
  }

  .history-set-edit {
    grid-template-columns: 1fr;
  }

  .history-detail-meta .field {
    height: 38px;
    padding: 6px 10px;
    line-height: 1.2;
  }

  .edit-metrics-row {
    grid-template-columns: 1fr;
  }
}

/* Force mobile layout on touch devices (phones/tablets) */
@media (pointer: coarse) {
  .sidebar {
    display: none !important;
  }

  .bottom-nav {
    display: grid !important;
    gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
  }

  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px 14px 120px !important;
  }

  .nav-icon {
    padding: 10px 6px;
    white-space: nowrap;
    min-height: 52px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .card,
  .hero,
  .grid,
  .view {
    max-width: 100% !important;
  }

  .history-entry-actions .history-view,
  .history-entry-actions .history-edit {
    display: none;
  }

  .history-entry-actions {
    gap: 6px;
  }

  .history-entry-actions .history-delete {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .history-delete-text {
    display: none;
  }
}

/* Show desktop sidebar only on devices that behave like desktop */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .sidebar {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .main-content {
    padding: 30px 40px 40px;
  }
}
