/* Flexfinity — calm, simple, mobile-first */

:root {
  --bg: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-tile: #ffffff;
  --bg-tile-hover: #f9fafb;
  --surface: #f9fafb;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --accent: #374151;
  --accent-strong: #111827;
  --accent-dim: #f3f4f6;
  --accent-text: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --ok-bg: #f0fdf4;
  --ok-text: #166534;
  --warn-bg: #fffbeb;
  --warn-text: #92400e;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: none;
  --shadow-sm: none;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --header-h: 56px;
  --tabbar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-weight: 400;
  letter-spacing: 0;
  overscroll-behavior-y: contain;
}

html.is-standalone body {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html.is-standalone input,
html.is-standalone textarea,
html.is-standalone select {
  user-select: text;
  -webkit-user-select: text;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.icon {
  display: block;
  flex-shrink: 0;
}

/* Header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding: 0.65rem 1rem;
  padding-top: max(0.65rem, var(--safe-top));
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.sidebar {
  display: none;
}

.shell {
  min-height: 100dvh;
}

.mobile-only {
  display: inline-flex;
}

.page-head {
  margin-bottom: 1rem;
}

.page-head__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.page-head__sub {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.page-head__row {
  margin-bottom: 0.35rem;
}

.brand-mark {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand-mark__name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--text);
}

.brand-mark__tag {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}

.app-main {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem calc(1.25rem + var(--safe-bottom));
}

body.has-tabbar .app-main {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 0.75rem);
}

/* Mobile bottom tab bar — app shell */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: var(--tabbar-h);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

.tabbar__item.is-active {
  color: var(--accent-strong);
}

.tabbar__icon {
  display: grid;
  place-items: center;
}

.tabbar__icon .icon {
  width: 22px;
  height: 22px;
}

.tabbar__label {
  line-height: 1;
}

/* Login */

.page-login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem 1rem calc(2rem + var(--safe-bottom));
  background: var(--bg);
}

@media (min-width: 960px) {
  .page-login {
    background: #eef0f3;
  }

  .page-login .login-shell {
    max-width: 400px;
  }

  .page-login .login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
  }
}

.login-shell {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.login-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-hero__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
}

.login-hero__logo .icon {
  width: 22px;
  height: 22px;
}

.login-hero h1 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.login-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-card,
.form-card,
.filter-card {
  padding: 1.1rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

/* Forms */

.form-group {
  margin-bottom: 0.9rem;
}

.form-group label,
.fieldset-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0;
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 2px #e5e7eb;
}

.form-control::placeholder {
  color: #9ca3af;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}

.field-hint {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.autocomplete {
  position: relative;
}

.autocomplete__list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.autocomplete__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.autocomplete__item:hover,
.autocomplete__item.is-active {
  background: var(--surface);
}

.autocomplete__name {
  font-weight: 500;
  color: var(--text);
}

.autocomplete__phone {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.alert {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 400;
}

.alert--error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.alert--success {
  background: var(--ok-bg);
  border: 1px solid #bbf7d0;
  color: var(--ok-text);
}

.alert--info {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn--primary:hover {
  background: var(--accent-strong);
}

.btn--danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn--danger:hover {
  background: var(--danger-bg);
}

.btn--ghost {
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--surface);
}

.btn--sm {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn--back {
  margin-bottom: 0.5rem;
}

.hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Dashboard */

.dash-welcome {
  margin-bottom: 1.1rem;
}

.dash-welcome h1 {
  margin: 0 0 0.15rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.dash-welcome p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.tile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 72px;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius);
  background: var(--bg-tile);
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}

.tile:active {
  background: var(--bg-tile-hover);
}

.tile__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tile__icon .icon {
  width: 20px;
  height: 20px;
}

.tile__body {
  flex: 1;
  min-width: 0;
}

.tile__title {
  margin: 0 0 0.1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.tile__desc {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tile__chevron {
  flex-shrink: 0;
  color: #d1d5db;
  display: grid;
  place-items: center;
}

.tile__chevron .icon {
  width: 18px;
  height: 18px;
}

.page-card {
  padding: 1.25rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  text-align: center;
}

.page-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.page-card p {
  margin: 0;
  color: var(--text-muted);
}

/* Module chrome */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.toolbar .btn {
  width: auto;
}

.notice-panel {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}

.notice-panel--warn {
  border-color: #f5c2c2;
  background: #fff8f8;
}

.notice-panel__title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.notice-panel__list {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: 0.88rem;
}

.notice-panel__list li {
  margin-bottom: 0.25rem;
}

.pt-preview {
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.pt-preview .profile-card__stats {
  margin-top: 0.55rem;
}

.list-card__right--actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.split-card {
  padding: 1rem 1.05rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}

.split-card__pct {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.split-card__label {
  margin: 0.15rem 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.split-card__value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.split-card__note {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (min-width: 600px) {
  .split-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Standalone reports module */
.period-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.period-tabs__link {
  flex: 1;
  text-align: center;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.period-tabs__link.is-active {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

.report-filter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 1rem;
}

.report-filter__label {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: -0.15rem;
}

.report-hero {
  padding: 1.15rem 1.2rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius);
  background: #111827;
  color: #fff;
}

.report-hero__label {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  opacity: 0.75;
}

.report-hero__value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.report-source-grid {
  margin-bottom: 0.5rem;
}

.amount--pos {
  color: var(--ok-text);
}

.amount--neg {
  color: var(--danger);
}

.report-hero__value.amount--pos,
.report-hero__value.amount--neg {
  color: inherit;
}

.report-hero__value.amount--pos {
  color: var(--ok-text);
}

.report-hero__value.amount--neg {
  color: var(--danger);
}

@media (min-width: 900px) {
  .report-source-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .report-source-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

.salary-breakdown {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-soft, #f7f8fa);
  border: 1px solid var(--border);
}

.salary-breakdown .pt-kv {
  margin: 0;
}

.pending-pt {
  margin-bottom: 1.1rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
}

.pending-pt__label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pending-pt__value {
  margin: 0.15rem 0 0;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.pending-pt__sub {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.salary-schedule {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.salary-schedule__title {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.salary-schedule__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.salary-schedule__list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}

.salary-schedule__list li:last-child {
  border-bottom: 0;
}

.salary-schedule__list .is-muted {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.report-download-bar {
  margin-top: -0.25rem;
}

/* Compact PT detail sheet */
.pt-sheet {
  width: 100%;
  max-width: none;
  padding: 1rem 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
}

.pt-sheet__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.pt-sheet__header {
  margin-bottom: 0.85rem;
}

.pt-sheet__title {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.pt-sheet__meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pt-sheet__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.pt-sheet__total strong {
  font-size: 1.25rem;
}

.pt-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  margin-bottom: 0.35rem;
}

.pt-bar__gym {
  background: #111827;
}

.pt-bar__emp {
  background: #9ca3af;
}

.pt-bar__legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.pt-sheet__split {
  margin-bottom: 0.85rem;
}

.pt-kv {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  overflow: hidden;
}

.pt-kv__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.pt-kv__row:last-child {
  border-bottom: none;
}

.pt-kv__row span {
  color: var(--text-muted);
}

.pt-sheet .btn--danger {
  margin-top: 0.25rem;
}

@media (min-width: 960px) {
  .report-filter {
    max-width: 480px;
  }

  .report-hero,
  .period-tabs,
  .report-source-grid,
  .pt-sheet {
    max-width: none;
    width: 100%;
  }

  .pt-sheet {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem 1.75rem;
    align-items: start;
    padding: 1.5rem 1.75rem;
  }

  .pt-sheet__top,
  .pt-sheet__header,
  .pt-sheet__total,
  .pt-bar,
  .pt-bar__legend {
    grid-column: 1 / -1;
  }

  .pt-sheet__split {
    margin-bottom: 0;
  }

  .pt-kv {
    margin-bottom: 0;
  }

  .pt-sheet form {
    grid-column: 1 / -1;
    max-width: 280px;
  }

  .pt-sheet .btn--block {
    max-width: none;
  }
}

.subnav {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.subnav::-webkit-scrollbar {
  display: none;
}

.subnav__link {
  flex: 0 0 auto;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  background: transparent;
  border-radius: 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
}

.subnav__link.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: transparent;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.stat-card {
  padding: 0.8rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}

.stat-card--accent,
.stat-card--wide {
  background: #fff;
}

.stat-card--wide {
  grid-column: 1 / -1;
}

.stat-card__label {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-card__value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.section-block {
  margin-top: 1.15rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.section-head h2,
.section-title {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.section-head h2 {
  margin-bottom: 0;
}

.text-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: underline;
}

.list-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.list-card {
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}

.list-card__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  min-height: 56px;
}

.list-card__title {
  margin: 0 0 0.1rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.list-card__meta {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.list-card__right {
  text-align: right;
  flex-shrink: 0;
}

.list-card__amount {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.list-card__actions {
  display: flex;
  gap: 1rem;
  padding: 0.45rem 0.9rem 0.7rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.list-card__actions a,
.list-card__actions .link-btn {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.list-card__actions a:hover,
.list-card__actions .link-btn:hover {
  color: var(--text);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.action-row .btn {
  width: 100%;
}

.danger-block {
  margin-bottom: 0.5rem;
}

.empty-state {
  padding: 1.1rem;
  text-align: center;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-state .btn {
  margin-top: 0.75rem;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}

.badge--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge--warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.profile-card {
  padding: 1rem;
  margin-bottom: 0.9rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
}

.profile-card__name {
  margin: 0 0 0.15rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.profile-card__meta {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.profile-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.profile-card__stats strong {
  display: block;
  margin-top: 0.1rem;
  font-weight: 600;
}

.report-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 280px;
}

.report-table th,
.report-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.report-table th {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
}

.report-table tr:last-child td {
  border-bottom: none;
}

.report-table__total td {
  font-weight: 600;
  background: var(--surface);
}

.muted-count {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

@media (min-width: 420px) {
  .tile-grid {
    grid-template-columns: 1fr 1fr;
  }

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

/* Desktop admin layout */
@media (min-width: 960px) {
  :root {
    --sidebar-w: 240px;
  }

  body.has-shell {
    background: #eef0f3;
  }

  .tabbar,
  .app-header--mobile,
  .mobile-only {
    display: none !important;
  }

  body.has-tabbar .app-main {
    padding-bottom: 2rem;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    z-index: 60;
    overflow: hidden;
  }

  .sidebar__brand {
    padding: 1.1rem 1rem;
    border-bottom: 1px solid var(--border);
  }

  .sidebar__logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
  }

  .sidebar__mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
  }

  .sidebar__text {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
  }

  .sidebar__text strong {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.15;
  }

  .sidebar__text small {
    font-size: 0.7rem;
    color: var(--text-muted);
  }

  .sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 0.65rem;
  }

  .sidebar__label {
    margin: 0.75rem 0.55rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9ca3af;
  }

  .sidebar__label:first-child {
    margin-top: 0.15rem;
  }

  .sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.1rem;
  }

  .sidebar__link:hover {
    background: #f3f4f6;
    color: var(--text);
  }

  .sidebar__link.is-active {
    background: #111827;
    color: #fff;
  }

  .sidebar__link.is-active .sidebar__icon {
    color: #fff;
  }

  .sidebar__icon {
    display: grid;
    place-items: center;
    color: #6b7280;
  }

  .sidebar__icon .icon {
    width: 18px;
    height: 18px;
  }

  .sidebar__footer {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--border);
  }

  .sidebar__user {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    margin-bottom: 0.55rem;
  }

  .sidebar__user-name {
    font-size: 0.88rem;
    font-weight: 600;
  }

  .sidebar__user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .sidebar__logout {
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: underline;
  }

  .sidebar__logout:hover {
    color: var(--text);
  }

  .shell {
    margin-left: var(--sidebar-w);
    min-height: 100dvh;
  }

  .app-main {
    max-width: none;
    width: 100%;
    padding: 1.75rem 2rem 2.5rem;
  }

  .page-head {
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
  }

  .page-head__title {
    font-size: 1.45rem;
  }

  .page-head__sub {
    font-size: 0.92rem;
  }

  .page-head .subnav {
    margin-bottom: 0;
    margin-top: 0.75rem;
    border-bottom: none;
  }

  .subnav__link {
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    border-bottom: none;
    margin-bottom: 0;
    background: transparent;
  }

  .subnav__link.is-active {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .tile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .tile {
    min-height: 96px;
    padding: 1.1rem 1.15rem;
    background: #fff;
    transition: border-color 0.12s ease, background 0.12s ease;
  }

  .tile:hover {
    border-color: #c5cad3;
    background: #fafafa;
  }

  .tile--wide {
    grid-column: auto;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    background: #fff;
    padding: 1rem 1.1rem;
  }

  .stat-card__value {
    font-size: 1.35rem;
  }

  .stat-card--wide {
    grid-column: auto;
  }

  .section-block {
    margin-top: 1.5rem;
  }

  .section-head h2,
  .section-title {
    font-size: 1rem;
  }

  /* Single-column dense list — easier to scan on desktop */
  .list-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }

  .list-card {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    box-shadow: none;
  }

  .list-card:last-child {
    border-bottom: none;
  }

  .list-card__main {
    padding: 0.85rem 1.1rem;
    min-height: 58px;
  }

  .list-card__main:hover {
    background: #f9fafb;
  }

  .list-card__actions {
    background: #fafafa;
    padding: 0.4rem 1.1rem 0.55rem;
  }

  .list-card__actions a {
    color: #374151;
    text-decoration: underline;
  }

  .panel,
  .form-card,
  .filter-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.35rem;
  }

  .form-card,
  .filter-card {
    max-width: 520px;
  }

  .profile-card {
    max-width: 720px;
    background: #fff;
  }

  .action-row,
  .danger-block {
    max-width: 520px;
  }

  .btn--block {
    max-width: 520px;
  }

  .search-bar {
    max-width: 520px;
    margin-bottom: 1rem;
  }

  .report-table-wrap {
    background: #fff;
  }

  .report-table {
    min-width: 0;
    width: 100%;
    font-size: 0.9rem;
  }

  .report-table th,
  .report-table td {
    padding: 0.8rem 1rem;
  }

  .empty-state {
    background: #fff;
  }

  .content-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 1.25rem;
    align-items: start;
  }
}

@media (min-width: 1280px) {
  :root {
    --sidebar-w: 260px;
  }

  .app-main {
    padding: 2rem 2.5rem 2.75rem;
  }

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