:root {
  color-scheme: light;
  --green: #1d8f6f;
  --teal: #0a84ff;
  --mint: #eef8f4;
  --paper: #ffffff;
  --canvas: #f5f5f7;
  --line: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --danger: #ff3b30;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.08);
  --soft-shadow: 0 8px 26px rgba(0, 0, 0, 0.06);
  --button-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.08em;
  height: 1.08em;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

#app {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(92px + env(safe-area-inset-bottom));
}

.hero {
  padding: 22px;
  border-radius: 28px;
  background: #1d1d1f;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero__eyebrow {
  font-size: 12px;
  opacity: 0.82;
  letter-spacing: 0;
  font-weight: 700;
}

.hero h1 {
  margin: 8px 0 0;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: 0;
  font-weight: 760;
}

.hero p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
  font-size: 14px;
}

.public-hero {
  min-height: auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 32px 0 22px;
  text-align: center;
}

.brand-mark {
  width: clamp(82px, 22vw, 118px);
  aspect-ratio: 1;
  object-fit: contain;
  height: auto;
  display: block;
  border-radius: 26px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.08);
}

.brand-wordmark {
  width: min(70vw, 270px);
  height: auto;
  display: block;
  border-radius: 12px;
}

.public-hero h1 {
  width: min(100%, 500px);
  margin: 0;
  color: var(--text);
  font-size: clamp(27px, 7vw, 40px);
  font-weight: 760;
  line-height: 1.14;
  letter-spacing: 0;
}

.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 700;
}

.admin-status {
  display: inline-flex;
  margin-top: 12px;
  min-height: 26px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 760;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 6px;
  margin: 14px -4px 0;
  padding: 10px 4px;
  background: rgba(244, 247, 245, 0.92);
  backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  height: 42px;
  min-width: 76px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 760;
  font-size: 14px;
}

.tab .icon {
  width: 15px;
  height: 15px;
}

.tab.is-active {
  background: #1d1d1f;
  color: #fff;
  border-color: #1d1d1f;
}

main {
  margin-top: 10px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.panel {
  margin-top: 16px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: 0;
  font-weight: 760;
}

.panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.public-shell,
.admin-login-shell,
.admin-shell {
  display: block;
}

[hidden] {
  display: none !important;
}

.entry-panel {
  margin-top: 0;
}

.identity-label {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

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

.choice-card {
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 15px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  text-align: left;
  box-shadow: var(--button-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.choice-card:active {
  transform: scale(0.985);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

.login-panel {
  width: min(100%, 460px);
  margin: 0 auto;
}

.success-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.success-panel h2,
.success-panel p {
  margin: 0;
}

.success-panel .primary {
  width: 100%;
  margin-top: 8px;
}

.success-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #34c759;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.success-icon .icon {
  width: 30px;
  height: 30px;
  stroke-width: 2.5;
}

.choice-card--business {
  border-color: var(--line);
  background: #ffffff;
}

.choice-card__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, #2a2a2d, #121214);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.choice-card__icon .icon {
  width: 23px;
  height: 23px;
}

.choice-card--business .choice-card__icon {
  background: linear-gradient(180deg, #2f9bff, #0a72e8);
}

.choice-card__body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.choice-card__body strong {
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 760;
}

.choice-card__body em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.45;
}

.choice-card__arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  padding: 7px 9px 7px 11px;
  border-radius: 999px;
  background: #f2f2f7;
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.choice-card__arrow .icon {
  width: 13px;
  height: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.035);
}

.stat__value {
  color: #1d1d1f;
  font-size: 30px;
  font-weight: 780;
  line-height: 1;
}

.stat__label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.actions-grid,
.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
  max-width: 100%;
  overflow: hidden;
}

.list-tools input[type="search"] {
  flex: 1 1 220px;
  max-width: 360px;
}

.list-tools button {
  flex: 0 1 140px;
  max-width: 160px;
}

.list-tools select,
.list-tools input {
  flex: 1 1 148px;
  max-width: 220px;
  min-width: 0;
}

.primary,
.secondary,
.danger,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 760;
  line-height: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary:active,
.secondary:active,
.danger:active,
.ghost:active,
.admin-logout:active,
.tab:active {
  transform: scale(0.985);
}

.primary .icon,
.secondary .icon,
.danger .icon,
.ghost .icon,
.admin-logout .icon,
.pagination .icon {
  width: 16px;
  height: 16px;
}

.primary {
  background: #1d1d1f;
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.13);
}

.secondary {
  background: #ffffff;
  color: #1d1d1f;
  border: 1px solid var(--line);
  box-shadow: var(--button-shadow);
}

.danger {
  background: #fff1f2;
  color: var(--danger);
  border: 1px solid rgba(255, 59, 48, 0.12);
}

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

.compact-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 13px;
  white-space: nowrap;
}

.category-list,
.cards {
  display: grid;
  gap: 12px;
}

.category-row,
.record {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.035);
}

.category-row__top,
.record__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.record h3,
.category-row h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.42;
  font-weight: 760;
}

.record-title {
  display: inline;
  padding: 0;
  background: transparent;
  color: #0a72e8;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
}

.record-title:active {
  opacity: 0.72;
}

.record p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f2f7;
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.record__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.record__actions button {
  min-height: 38px;
  border-radius: 11px;
  font-size: 13px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  min-width: 74px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1d1d1f;
  font-weight: 760;
}

.pagination button:disabled {
  opacity: 0.38;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #52616b;
  font-size: 13px;
  font-weight: 760;
}

.required-mark {
  display: inline;
  margin-left: 3px;
  color: var(--danger);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  font-size: 15px;
  font-weight: 500;
}

input,
select {
  height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(10, 132, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.empty {
  padding: 28px 16px;
  border: 1px dashed rgba(0, 0, 0, 0.16);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120px);
  z-index: 30;
  max-width: calc(100vw - 40px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(31, 41, 51, 0.94);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.has-modal {
  overflow: hidden;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 18px;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
}

.detail-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  max-height: min(82vh, 760px);
  margin: 0 auto;
  overflow: auto;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}

.detail-panel__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.detail-panel__head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.detail-panel__head h2 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.3;
}

.detail-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1d1d1f;
  color: #fff;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 4px 18px 18px;
}

.detail-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.detail-row dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.58;
  word-break: break-word;
}

.detail-empty {
  color: #a1a1a6;
}

@media (min-width: 680px) {
  #app {
    padding-top: 28px;
  }

  .hero h1 {
    font-size: 32px;
  }

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

@media (max-width: 390px) {
  #app {
    padding-left: 12px;
    padding-right: 12px;
  }

  .tabs {
    gap: 5px;
  }

  .tab {
    height: 40px;
    font-size: 13px;
    min-width: 64px;
  }

  .public-hero {
    padding-top: 24px;
    gap: 16px;
  }

  .brand-mark {
    width: 86px;
    border-radius: 23px;
  }

  .brand-wordmark {
    width: min(78vw, 250px);
  }

  .admin-hero {
    display: grid;
  }

  .admin-logout {
    justify-self: start;
  }

  .public-hero h1 {
    font-size: 30px;
    line-height: 1.12;
  }

  .field-grid,
  .actions-grid,
  .form-actions,
  .list-tools {
    grid-template-columns: 1fr;
  }

  .list-tools {
    display: grid;
  }

  .detail-modal {
    align-items: center;
    padding: 14px;
  }

  .detail-panel {
    border-radius: 20px;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .list-tools input[type="search"],
  .list-tools select,
  .list-tools button {
    width: 100%;
    max-width: none;
  }

  .choice-card {
    grid-template-columns: 42px 1fr auto;
    gap: 12px;
    min-height: 88px;
    padding: 14px;
  }

  .choice-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .choice-card__body strong {
    font-size: 16px;
  }

  .choice-card__body em {
    font-size: 12px;
  }

  .choice-card__arrow {
    grid-column: auto;
    justify-self: end;
    padding: 6px 8px;
  }

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