body {
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

.excel-action-grid,
.excel-import-summary {
  grid-template-columns: 1fr;
}

.excel-action-grid > button,
.excel-action-grid > label {
  min-height: 58px;
}

.excel-undo-card,
.excel-conflict-row,
.excel-issue-row {
  grid-template-columns: 1fr;
}

.excel-undo-card {
  align-items: stretch;
}

.app-shell {
  display: block;
}

.sidebar {
  display: none;
}

.main {
  padding: 18px 14px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 8px;
  margin-bottom: 16px;
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  margin-bottom: 1px;
  font-size: 1.4rem;
}

.desktop-view-title {
  display: none;
}

.mobile-app-title {
  display: inline;
}

.page-heading p {
  display: none;
}

.mobile-app-version {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.07em;
}

.topbar > .primary-button {
  grid-column: 2;
  grid-row: 1;
  width: 42px;
  min-height: 42px;
  overflow: hidden;
  padding: 0;
  white-space: nowrap;
}

.topbar > .primary-button .button-label {
  display: none;
}

.topbar > .primary-button .button-icon {
  margin: 0;
  font-size: 1.2rem;
}

.mobile-sync-panel {
  grid-column: 1 / -1;
  grid-row: 2;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.mobile-sync-panel .sync-overview {
  padding: 9px 10px;
  box-shadow: 0 4px 16px rgba(31, 49, 44, 0.04);
}

.mobile-sync-panel .sync-overview-heading strong {
  font-size: 0.7rem;
}

.search-wrap {
  grid-column: 1 / -1;
  grid-row: 3;
  max-width: none;
  margin: 0;
}

.banner {
  align-items: flex-start;
  padding: 13px;
}

.banner > .secondary-button {
  padding: 0 10px;
  font-size: 0.7rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.stat-card {
  padding: 12px 10px;
}

.stat-value strong {
  font-size: 1.35rem;
}

.content-panel {
  border-radius: 17px;
}

.panel-toolbar {
  min-height: 58px;
  padding: 10px 12px;
}

.tool-filter-bar {
  gap: 6px;
  padding: 11px 12px 0;
}

.tool-filter-label {
  width: 100%;
}

.tool-filter-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.68rem;
}

.result-summary span {
  display: none;
}

.select-control {
  max-width: 122px;
}

.sort-controls {
  gap: 5px;
}

.sort-direction-control {
  min-width: 72px;
  max-width: 76px;
  padding-left: 8px;
}

.data-table-wrap {
  display: none;
}

.mobile-cards {
  display: grid;
}

.work-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  border-top: 1px solid #e8e5dc;
  padding: 14px 13px;
  background: var(--tool-row-bg, #fffdf8);
  transition: background-color 120ms ease;
}

.work-card:active {
  background: var(--tool-row-hover, #f7f4ec);
}

.work-card:first-child {
  border-top: 0;
}

.work-card .cover-placeholder {
  width: 34px;
  height: 45px;
}

.work-card-main {
  min-width: 0;
}

.work-card-title {
  width: 100%;
  overflow: hidden;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
}

.work-card-meta .progress-text {
  color: var(--brand);
}

.work-card-tool {
  display: inline-block;
  max-width: 112px;
  overflow: hidden;
  border: 1px solid rgba(31, 75, 67, 0.16);
  border-radius: 999px;
  padding: 2px 7px;
  color: #405c56;
  background: rgba(255, 255, 255, 0.62);
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-card .badge,
.work-card .favorite-badge {
  margin-top: 7px;
  padding: 4px 8px;
}

.work-card-badges .badge,
.work-card-badges .favorite-badge {
  margin-top: 7px;
}

.work-card > .quick-button,
.work-card-actions .quick-button,
.work-card-actions .more-actions-button {
  align-self: center;
  min-height: 36px;
  padding: 0 8px;
  font-size: 0.68rem;
}

.work-card-actions .more-actions-button {
  width: auto;
  padding-bottom: 4px;
  font-size: 1.15rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(20, 60, 54, 0.12);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 -10px 30px rgba(23, 43, 38, 0.09);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  padding: 5px 2px;
  color: #76807c;
  background: transparent;
  font-size: 0.61rem;
}

.bottom-nav button.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 800;
}

.bottom-nav .bottom-icon {
  font-size: 1.1rem;
}

.modal-backdrop {
  align-items: end;
  padding: 0;
}

.modal,
.modal.compact {
  width: 100%;
  max-height: 92vh;
  border-radius: 22px 22px 0 0;
}

.modal-header {
  padding: 17px 16px 13px;
}

.modal-body {
  padding: 17px 16px;
}

.modal-footer {
  padding: 12px 16px calc(13px + env(safe-area-inset-bottom));
}

.conflict-row {
  grid-template-columns: 86px repeat(2, minmax(0, 1fr));
}

.conflict-row > span,
.conflict-row > strong {
  padding: 9px 8px;
  font-size: 0.67rem;
}

.conflict-heading > strong {
  font-size: 0.66rem;
}

.modal-footer [data-action="resolve-conflict"] {
  flex: 1 1 150px;
}

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

.form-field.full {
  grid-column: auto;
}

.viewing-tool-add {
  grid-template-columns: 1fr;
}

.viewing-tool-add .secondary-button {
  justify-self: start;
}

.viewing-tool-setting {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.viewing-tool-usage {
  grid-column: 2 / -1;
  grid-row: 2;
  text-align: left;
}

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

.history-item {
  grid-template-columns: 1fr auto;
}

.history-item .quick-button {
  grid-column: 1 / -1;
  justify-self: start;
}

.toast-region {
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
}
