:root {
  --ios-bg: #05070c;
  --ios-surface: rgba(22, 24, 32, 0.88);
  --ios-surface-strong: rgba(28, 30, 40, 0.94);
  --ios-border: rgba(255, 255, 255, 0.08);
  --ios-text: #f5f5f8;
  --ios-muted: rgba(245, 245, 248, 0.7);
  --ios-accent: #4d7dff;
  --ios-accent-strong: #3c63f0;
  --ios-success: #2ecc71;
  --ios-warning: #ff9f43;
  --ios-danger: #ff5c77;
  --ios-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

html,
body {
  height: 100%;
}

body.app {
  background: radial-gradient(120% 120% at 50% 0%, rgba(64, 90, 255, 0.18), transparent 60%)
      fixed,
    radial-gradient(140% 140% at 0% 120%, rgba(255, 85, 142, 0.22), transparent 70%) fixed,
    var(--ios-bg);
  color: var(--ios-text);
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100dvh;
  margin: 0;
}

.ios-app {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: calc(18px + env(safe-area-inset-top, 0px))
    clamp(16px, 2.5vw, 44px)
    env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}

.ios-shell {
  position: relative;
  width: min(960px, 100%);
  background: rgba(10, 12, 20, 0.55);
  backdrop-filter: blur(22px);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: var(--ios-shadow);
  min-height: calc(100dvh - 2 * clamp(16px, 2.5vw, 44px));
}

.ios-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px clamp(24px, 4vw, 48px) 12px;
  background: linear-gradient(150deg, rgba(109, 136, 255, 0.32), rgba(20, 24, 36, 0.15));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ios-header-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ios-header-brand {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ios-header-sub {
  font-size: clamp(12px, 1.8vw, 14px);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--ios-muted);
}

.ios-header-user {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ios-header-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ios-text);
}

.ios-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ios-text);
  text-decoration: none;
}

.ios-content {
  padding: 24px clamp(16px, 4vw, 48px)
    calc(140px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ios-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--ios-surface);
  padding: 24px clamp(16px, 4vw, 36px);
  border-radius: 28px;
  border: 1px solid var(--ios-border);
}

.ios-section--reports {
  background: transparent;
  border: none;
  padding: 0;
  gap: 0;
}

.ios-section--reports .ios-section-header {
  padding: 24px clamp(16px, 4vw, 36px) 0;
}

.ios-section--reports .ios-section-title {
  margin-bottom: 0;
}

.ios-section--reports .ios-error {
  margin: 16px clamp(16px, 4vw, 36px) 0;
}

.ios-section--reports .ios-section-body {
  margin-top: 24px;
  padding: 0 clamp(16px, 4vw, 36px) 32px;
  gap: 24px;
}

.ios-section--reports .ios-card.scrollable {
  margin: 0;
}

.ios-section--reports .ios-button.full {
  align-self: stretch;
}

.ios-section-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ios-section--actions {
  background: linear-gradient(135deg, rgba(77, 125, 255, 0.3), rgba(10, 12, 20, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.ios-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ios-section-title {
  font-size: clamp(20px, 2.4vw, 26px);
  margin: 0;
}

.ios-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.ios-summary {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ios-summary.accent {
  background: rgba(81, 255, 203, 0.18);
  border: 1px solid rgba(81, 255, 203, 0.25);
}

.ios-summary-label {
  font-size: 13px;
  color: var(--ios-muted);
}

.ios-summary-value {
  font-size: 18px;
  font-weight: 600;
}

.ios-button {
  border: none;
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  color: var(--ios-text);
  background: rgba(255, 255, 255, 0.08);
}

.ios-button:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.ios-button.primary {
  background: linear-gradient(120deg, var(--ios-accent), var(--ios-accent-strong));
  box-shadow: 0 12px 24px rgba(77, 125, 255, 0.32);
}

.ios-button.primary:active {
  transform: translateY(1px);
}

.ios-button.text {
  background: transparent;
  padding: 6px 10px;
}

.ios-button.text.strong {
  color: var(--ios-accent);
}

.ios-button.muted {
  background: rgba(255, 255, 255, 0.06);
}

.ios-button.subtle {
  background: rgba(255, 255, 255, 0.04);
}

.ios-button.subtle.warning {
  color: var(--ios-warning);
}

.ios-button.warning {
  background: rgba(255, 92, 119, 0.18);
  color: var(--ios-danger);
}

.ios-button.full {
  width: 100%;
}

.ios-state-note {
  color: var(--ios-muted);
  text-align: center;
  padding: 12px 0;
}

.ios-error {
  background: rgba(255, 92, 119, 0.18);
  color: #ffb8c6;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 92, 119, 0.35);
}

.ios-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ios-card {
  background: var(--ios-surface-strong);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ios-card--active {
  border-color: rgba(77, 125, 255, 0.55);
  box-shadow: 0 18px 40px rgba(77, 125, 255, 0.2);
}

.ios-card-summary {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
}

.ios-card-primary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ios-card-title {
  font-size: 18px;
  font-weight: 600;
}

.ios-card-sub {
  font-size: 14px;
  color: var(--ios-muted);
}

.ios-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 14px;
}

.ios-card-meta-value {
  font-weight: 600;
}

.ios-card-details {
  padding: 18px 20px 22px;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--ios-border);
}

.ios-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.ios-detail-label {
  color: var(--ios-muted);
}

.ios-detail-value {
  text-align: right;
}

.ios-card-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}

.ios-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.ios-pill.success {
  background: rgba(81, 255, 203, 0.18);
  color: #7fffd4;
}

.ios-pill.muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ios-muted);
}

.ios-form-card {
  gap: 14px;
  padding: 22px 24px;
}

.ios-label {
  font-size: 13px;
  color: var(--ios-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.ios-input {
  width: 100%;
  margin-top: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ios-text);
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border 0.2s ease;
  box-sizing: border-box;
}

.ios-input:focus {
  border-color: rgba(77, 125, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(77, 125, 255, 0.15);
}

textarea.ios-input {
  resize: vertical;
}

.ios-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  background: var(--ios-surface-strong);
  border-radius: 24px;
  padding: 20px 24px;
  border: 1px solid var(--ios-border);
  align-items: flex-start;
  row-gap: 20px;
}

.ios-filter-grid--flush {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  row-gap: 16px;
  gap: 16px;
  width: 100%;
}

.ios-filter-grid--flush .ios-filter-actions {
  padding-top: 4px;
}

.ios-filter-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ios-filter-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ios-muted);
}

.ios-filter-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ios-filter-actions .ios-button.full {
  width: 100%;
}

.ios-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ios-table th,
.ios-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
}

.ios-table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ios-muted);
}

.ios-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.ios-card.scrollable {
  overflow: auto;
  max-height: 420px;
}


.ios-tabbar {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  gap: 12px;
  align-items: center;
  background: rgba(10, 12, 20, 0.92);
  padding: 14px clamp(18px, 4vw, 36px) calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(22px);
  width: min(960px, 100%);
  z-index: 10;
}

.ios-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--ios-muted);
  cursor: pointer;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.ios-tab.is-active {
  color: var(--ios-text);
}

.ios-tab svg {
  pointer-events: none;
}

.ios-tab-label {
  font-weight: 600;
}

.ios-tab-indicator {
  position: absolute;
  bottom: 10px;
  left: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--ios-accent), #78a3ff);
  transition: transform 0.28s ease, width 0.28s ease;
  pointer-events: none;
}

.ios-sheet {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  z-index: 40;
}

.ios-sheet.is-open {
  pointer-events: auto;
}

.ios-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.7);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ios-sheet.is-open .ios-sheet-backdrop {
  opacity: 1;
}

.ios-sheet-panel {
  position: relative;
  width: min(680px, 100%);
  background: rgba(12, 14, 22, 0.95);
  border-radius: 28px 28px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  padding-bottom: 32px;
  transform: translateY(30px);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 760px);
}

.ios-sheet.is-open .ios-sheet-panel {
  transform: translateY(0);
  opacity: 1;
}

.ios-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ios-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ios-sheet-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.ios-sheet-section {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ios-sheet-subtitle {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ios-sheet-card {
  gap: 12px;
}

.sheet-error {
  margin: 16px 28px 0;
}

.ios-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ios-chip {
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ios-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ios-chip.is-active {
  background: linear-gradient(120deg, var(--ios-accent), var(--ios-accent-strong));
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(77, 125, 255, 0.25);
}

.ios-tile-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.ios-tile-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ios-text);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border 0.18s ease;
}

.ios-tile-option:hover {
  transform: translateY(-2px);
}

.ios-tile-option.is-active {
  border-color: transparent;
  background: linear-gradient(140deg, rgba(77, 125, 255, 0.6), rgba(51, 84, 220, 0.85));
  box-shadow: 0 12px 26px rgba(77, 125, 255, 0.35);
}

.ios-tile-name {
  font-weight: 600;
  font-size: 16px;
}

.ios-tile-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ios-muted);
}

.ios-tile-meta {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .ios-app {
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px
      calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .ios-shell {
    width: 100%;
    border-radius: 24px;
    min-height: calc(100dvh - 36px);
  }

  .ios-content {
    padding: 20px 20px calc(140px + env(safe-area-inset-bottom, 0px));
  }

  .ios-tabbar {
    position: fixed;
    left: 50%;
    inset-inline-start: auto;
    bottom: env(safe-area-inset-bottom, 0px);
    transform: translateX(-50%);
    width: calc(100% - 24px);
    border-radius: 28px 28px 0 0;
    max-width: min(960px, 100%);
  }
}

@media (min-width: 901px) {
  .ios-filter-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .ios-filter-actions .ios-button.full {
    width: auto;
    min-width: 180px;
  }
}

@media (max-width: 640px) {
  .ios-app {
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  }

  .ios-shell {
    border-radius: 0;
    width: 100%;
    min-height: 100dvh;
  }

  .ios-content {
    padding: 20px 18px calc(140px + env(safe-area-inset-bottom, 0px));
  }

  .ios-section,
  .ios-section--actions,
  .ios-filter-grid,
  .ios-sheet-panel {
    border-radius: 0;
  }

  .ios-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .ios-header-user {
    align-self: stretch;
    justify-content: space-between;
  }

  .ios-tabbar {
    width: 100%;
    left: 0;
    inset-inline-start: 0;
    transform: none;
    border-radius: 24px 24px 0 0;
  }
}

@media (max-width: 540px) {
  .ios-filter-grid {
    grid-template-columns: 1fr;
  }

  .ios-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
