/**
 * APPLE IPHONE NATIVE DESIGN SYSTEM — components.css
 * iOS 18 / iOS 26 components matching HIG exactly
 * Requires: tokens.css
 */

/* ═══════════════════════════════════════════════════════════
   NAVIGATION BAR — 44pt + Large Title 96pt
   ═══════════════════════════════════════════════════════════ */
.ios-navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 0.5px solid var(--separator);
  transition: background var(--duration-fast) var(--spring-gentle);
  padding-top: env(safe-area-inset-top, 0px);
}

.ios-navbar-inner {
  display: flex;
  align-items: center;
  height: var(--navbar-height);
  padding: 0 var(--space-4);
  gap: var(--space-2);
}

.ios-navbar-back {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--tint);
  font-size: var(--text-size-body);
  font-weight: var(--text-w-regular);
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--space-2) var(--space-1);
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  white-space: nowrap;
}

.ios-navbar-back-chevron {
  width: 9px;
  height: 16px;
  fill: none;
  stroke: var(--tint);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ios-navbar-title {
  flex: 1;
  text-align: center;
  font-size: var(--text-size-headline);
  font-weight: var(--text-w-semibold);
  color: var(--label-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-display);
}

.ios-navbar-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 44px;
  min-height: 44px;
  color: var(--tint);
  font-size: var(--text-size-body);
  font-weight: var(--text-w-regular);
  cursor: pointer;
  border: none;
  background: none;
  flex-shrink: 0;
  gap: var(--space-1);
}

/* Large Title Bar (scrolls away to reveal regular nav bar) */
.ios-large-title-bar {
  padding: 4px var(--space-4) var(--space-3);
  background: var(--navbar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.ios-large-title {
  font-family: var(--font-display);
  font-size: var(--text-size-large-title);
  font-weight: var(--text-w-bold);
  line-height: var(--text-lh-large-title);
  color: var(--label-primary);
  letter-spacing: -0.5px;
}

/* Inline title — visible when large title scrolls away */
.ios-navbar--scrolled .ios-navbar-title { opacity: 1; }
.ios-navbar--top .ios-navbar-title { opacity: 0; }

/* ═══════════════════════════════════════════════════════════
   TAB BAR — 49pt + safe area, Liquid Glass
   ═══════════════════════════════════════════════════════════ */
.ios-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--tabbar-safe);
  background: var(--tabbar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 0.5px solid var(--separator);
  display: flex;
  align-items: flex-start;
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ios-tabbar-items {
  display: flex;
  flex: 1;
  height: var(--tabbar-height);
}

.ios-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--space-1) 0;
  min-height: var(--tabbar-height);
  position: relative;
  transition: opacity var(--duration-fast) var(--spring-gentle);
}

.ios-tabbar-item:active { opacity: 0.6; }

.ios-tabbar-icon {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ios-gray2);
  transition: color var(--duration-fast) var(--spring-gentle),
              transform var(--duration-fast) var(--spring-default);
  font-size: 22px;
}

.ios-tabbar-label {
  font-size: 10px;
  font-weight: var(--text-w-medium);
  color: var(--ios-gray2);
  transition: color var(--duration-fast) var(--spring-gentle);
  letter-spacing: -0.1px;
}

.ios-tabbar-item.active .ios-tabbar-icon,
.ios-tabbar-item.active .ios-tabbar-label {
  color: var(--tint);
}

.ios-tabbar-item.active .ios-tabbar-icon {
  transform: scale(1.05);
}

.ios-tabbar-badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 6px);
  background: var(--ios-red);
  color: #fff;
  font-size: 10px;
  font-weight: var(--text-w-bold);
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid var(--background-primary);
}

/* ═══════════════════════════════════════════════════════════
   GROUPED LIST — UITableView inset grouped style
   ═══════════════════════════════════════════════════════════ */
.ios-section {
  margin: var(--space-5) 0 0;
}

.ios-section-header {
  font-family: var(--font-text);
  font-size: var(--text-size-footnote);
  font-weight: var(--text-w-regular);
  color: var(--label-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 var(--space-5) var(--space-2) var(--space-5);
}

.ios-section-footer {
  font-size: var(--text-size-footnote);
  color: var(--label-secondary);
  padding: var(--space-2) var(--space-5) 0;
  line-height: 1.5;
}

.ios-list {
  background: var(--grouped-background-secondary);
  border-radius: var(--radius-lg);
  margin: 0 var(--space-4);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

/* Inset list (full-width) */
.ios-list--inset {
  margin: 0;
  border-radius: 0;
}

.ios-list-item {
  display: flex;
  align-items: center;
  min-height: var(--list-item-height);
  padding: var(--space-2) var(--space-4);
  background: var(--grouped-background-secondary);
  position: relative;
  cursor: pointer;
  gap: var(--space-3);
  transition: background var(--duration-instant) var(--spring-gentle);
  -webkit-user-select: none;
  user-select: none;
}

.ios-list-item:active {
  background: var(--fill-secondary);
}

/* Hairline separator — not full width, iOS-style offset */
.ios-list-item + .ios-list-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-4);
  right: 0;
  height: 0.5px;
  background: var(--separator);
}

.ios-list-item--no-sep + .ios-list-item--no-sep::before {
  display: none;
}

.ios-list-icon {
  width: 29px;
  height: 29px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ios-list-icon--blue   { background: var(--ios-blue);   color: #fff; }
.ios-list-icon--green  { background: var(--ios-green);  color: #fff; }
.ios-list-icon--orange { background: var(--ios-orange); color: #fff; }
.ios-list-icon--red    { background: var(--ios-red);    color: #fff; }
.ios-list-icon--purple { background: var(--ios-purple); color: #fff; }
.ios-list-icon--indigo { background: var(--ios-indigo); color: #fff; }
.ios-list-icon--pink   { background: var(--ios-pink);   color: #fff; }
.ios-list-icon--teal   { background: var(--ios-teal);   color: #fff; }
.ios-list-icon--gray   { background: var(--ios-gray);   color: #fff; }

.ios-list-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ios-list-title {
  font-size: var(--text-size-body);
  font-weight: var(--text-w-regular);
  color: var(--label-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ios-list-subtitle {
  font-size: var(--text-size-footnote);
  color: var(--label-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ios-list-value {
  font-size: var(--text-size-body);
  color: var(--label-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

.ios-list-chevron {
  width: 8px;
  height: 13px;
  fill: none;
  stroke: var(--ios-gray3);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  margin-left: var(--space-1);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS — 5 styles per Apple HIG
   ═══════════════════════════════════════════════════════════ */
.ios-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-text);
  font-size: var(--text-size-body);
  font-weight: var(--text-w-semibold);
  border: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  padding: 0 var(--space-5);
  height: 50px;
  transition: opacity var(--duration-fast) var(--spring-gentle),
              transform var(--duration-fast) var(--spring-default),
              background var(--duration-fast) var(--spring-gentle);
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.ios-btn:active {
  opacity: 0.75;
  transform: scale(0.97);
}

/* Filled — primary action */
.ios-btn--filled {
  background: var(--tint);
  color: #fff;
}

.ios-btn--filled:hover { background: color-mix(in srgb, var(--tint) 90%, #000); }

/* Tinted — secondary */
.ios-btn--tinted {
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  color: var(--tint);
}

/* Gray — neutral */
.ios-btn--gray {
  background: var(--fill-secondary);
  color: var(--label-primary);
}

/* Bordered / plain outline */
.ios-btn--bordered {
  background: transparent;
  color: var(--tint);
  border: 1px solid var(--tint);
  padding: 0 calc(var(--space-5) - 1px);
}

/* Plain — link-style */
.ios-btn--plain {
  background: transparent;
  color: var(--tint);
  font-weight: var(--text-w-regular);
  padding: 0 var(--space-3);
  height: auto;
  border-radius: var(--radius-sm);
}

/* Sizes */
.ios-btn--sm {
  height: 34px;
  font-size: var(--text-size-subheadline);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
}

.ios-btn--lg {
  height: 60px;
  font-size: var(--text-size-callout);
  padding: 0 var(--space-8);
}

/* Full width */
.ios-btn--full { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   SEGMENTED CONTROL
   ═══════════════════════════════════════════════════════════ */
.ios-segment {
  display: inline-flex;
  background: var(--fill-tertiary);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 0;
  position: relative;
}

.ios-segment-track {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: var(--background-primary);
  border-radius: calc(var(--radius-md) - 2px);
  box-shadow: var(--shadow-2);
  transition: transform var(--duration-fast) var(--spring-default),
              width var(--duration-fast) var(--spring-default);
  pointer-events: none;
}

.ios-segment-item {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-size-subheadline);
  font-weight: var(--text-w-medium);
  color: var(--label-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  padding: 0 var(--space-4);
  position: relative;
  z-index: 1;
  transition: color var(--duration-fast) var(--spring-gentle);
  white-space: nowrap;
}

.ios-segment-item.active {
  color: var(--label-primary);
  font-weight: var(--text-w-semibold);
}

/* ═══════════════════════════════════════════════════════════
   SWITCH / TOGGLE
   ═══════════════════════════════════════════════════════════ */
.ios-switch {
  position: relative;
  display: inline-flex;
  width: 51px;
  height: 31px;
  cursor: pointer;
  flex-shrink: 0;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ios-switch-track {
  width: 51px;
  height: 31px;
  background: var(--ios-gray4);
  border-radius: 16px;
  transition: background var(--duration-fast) var(--spring-gentle);
  position: relative;
}

.ios-switch input:checked ~ .ios-switch-track {
  background: var(--ios-green);
}

.ios-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
  transition: transform var(--duration-fast) var(--spring-default);
}

.ios-switch input:checked ~ .ios-switch-track .ios-switch-knob {
  transform: translateX(20px);
}

/* ═══════════════════════════════════════════════════════════
   TEXT FIELD
   ═══════════════════════════════════════════════════════════ */
.ios-textfield {
  width: 100%;
  height: 44px;
  background: var(--fill-tertiary);
  border: none;
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  font-family: var(--font-text);
  font-size: var(--text-size-body);
  color: var(--label-primary);
  outline: none;
  transition: background var(--duration-fast) var(--spring-gentle);
  -webkit-appearance: none;
  appearance: none;
}

.ios-textfield::placeholder {
  color: var(--label-tertiary);
}

.ios-textfield:focus {
  background: var(--fill-secondary);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--tint) 30%, transparent);
}

.ios-textfield-wrap {
  position: relative;
}

.ios-textfield-wrap .ios-textfield {
  padding-left: var(--space-10);
}

.ios-textfield-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--label-tertiary);
  font-size: 17px;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════════════════════ */
.ios-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--navbar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.ios-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--fill-tertiary);
  border-radius: var(--radius-md);
  height: 36px;
}

.ios-search-icon {
  position: absolute;
  left: var(--space-2);
  color: var(--label-tertiary);
  font-size: 15px;
}

.ios-search-input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  padding: 0 var(--space-2) 0 var(--space-6);
  font-size: var(--text-size-body);
  color: var(--label-primary);
  outline: none;
  font-family: var(--font-text);
}

.ios-search-input::placeholder { color: var(--label-tertiary); }

.ios-search-cancel {
  color: var(--tint);
  font-size: var(--text-size-body);
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
  transform: translateX(8px);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--spring-gentle),
              transform var(--duration-fast) var(--spring-default);
  pointer-events: none;
}

.ios-search-bar.focused .ios-search-cancel {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════
   ALERT DIALOG
   ═══════════════════════════════════════════════════════════ */
.ios-alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  animation: iosAlertOverlayIn var(--duration-fast) var(--spring-gentle);
}

@keyframes iosAlertOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ios-alert {
  width: 270px;
  background: var(--glass-thick-bg);
  backdrop-filter: var(--glass-thick-blur);
  -webkit-backdrop-filter: var(--glass-thick-blur);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-modal);
  animation: iosAlertIn var(--duration-normal) var(--spring-default);
}

@keyframes iosAlertIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.ios-alert-body {
  padding: 20px 16px 16px;
  text-align: center;
}

.ios-alert-title {
  font-size: var(--text-size-headline);
  font-weight: var(--text-w-semibold);
  color: var(--label-primary);
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
}

.ios-alert-message {
  font-size: var(--text-size-subheadline);
  color: var(--label-secondary);
  line-height: 1.45;
}

.ios-alert-actions {
  border-top: 0.5px solid var(--separator);
}

.ios-alert-btn {
  display: block;
  width: 100%;
  height: 44px;
  background: transparent;
  border: none;
  font-size: var(--text-size-body);
  color: var(--tint);
  cursor: pointer;
  font-family: var(--font-text);
  transition: background var(--duration-instant) var(--spring-gentle);
}

.ios-alert-btn + .ios-alert-btn {
  border-top: 0.5px solid var(--separator);
}

.ios-alert-btn:active { background: var(--fill-secondary); }
.ios-alert-btn--bold  { font-weight: var(--text-w-semibold); }
.ios-alert-btn--destructive { color: var(--ios-red); }

/* Horizontal layout (2 buttons) */
.ios-alert-actions--row {
  display: flex;
}

.ios-alert-actions--row .ios-alert-btn + .ios-alert-btn {
  border-top: none;
  border-left: 0.5px solid var(--separator);
}

/* ═══════════════════════════════════════════════════════════
   ACTION SHEET — slides up from bottom
   ═══════════════════════════════════════════════════════════ */
.ios-action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  animation: iosSheetOverlayIn var(--duration-fast) var(--spring-gentle);
}

@keyframes iosSheetOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ios-action-sheet {
  position: fixed;
  left: var(--space-2);
  right: var(--space-2);
  bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  animation: iosActionSheetIn var(--duration-normal) var(--spring-default);
}

@keyframes iosActionSheetIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.ios-action-sheet-group {
  background: var(--glass-thick-bg);
  backdrop-filter: var(--glass-thick-blur);
  -webkit-backdrop-filter: var(--glass-thick-blur);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.ios-action-sheet-title {
  padding: var(--space-3) var(--space-4) var(--space-2);
  text-align: center;
  font-size: var(--text-size-subheadline);
  color: var(--label-secondary);
  border-bottom: 0.5px solid var(--separator);
}

.ios-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 57px;
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--tint);
  cursor: pointer;
  font-family: var(--font-text);
  font-weight: var(--text-w-regular);
  gap: var(--space-3);
  transition: background var(--duration-instant) var(--spring-gentle);
}

.ios-action-btn + .ios-action-btn {
  border-top: 0.5px solid var(--separator);
}

.ios-action-btn:active { background: var(--fill-secondary); }
.ios-action-btn--bold  { font-weight: var(--text-w-semibold); }
.ios-action-btn--destructive { color: var(--ios-red); }

/* ═══════════════════════════════════════════════════════════
   MODAL SHEET — slides up from bottom (partial or full)
   ═══════════════════════════════════════════════════════════ */
.ios-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  animation: iosSheetOverlayIn var(--duration-fast) var(--spring-gentle);
}

.ios-modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 501;
  background: var(--grouped-background-primary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: var(--shadow-modal);
  max-height: 92dvh;
  overflow-y: auto;
  animation: iosModalIn var(--duration-normal) var(--spring-default);
}

@keyframes iosModalIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.ios-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--ios-gray3);
  border-radius: 2px;
  margin: var(--space-2) auto;
  cursor: grab;
}

.ios-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 0.5px solid var(--separator);
}

.ios-modal-title {
  font-size: var(--text-size-headline);
  font-weight: var(--text-w-semibold);
  color: var(--label-primary);
  font-family: var(--font-display);
}

.ios-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill-secondary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--label-secondary);
  font-size: 14px;
  transition: background var(--duration-fast) var(--spring-gentle);
}

.ios-modal-close:active { background: var(--fill-primary); }

.ios-modal-content {
  padding: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════
   CARD
   ═══════════════════════════════════════════════════════════ */
.ios-card {
  background: var(--grouped-background-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-2);
  position: relative;
  overflow: hidden;
}

.ios-card--inset {
  margin: 0 var(--space-4);
}

.ios-card--tinted {
  background: color-mix(in srgb, var(--tint) 12%, var(--background-primary));
}

.ios-card-title {
  font-size: var(--text-size-headline);
  font-weight: var(--text-w-semibold);
  color: var(--label-primary);
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
}

.ios-card-subtitle {
  font-size: var(--text-size-subheadline);
  color: var(--label-secondary);
}

.ios-card-value {
  font-size: var(--text-size-large-title);
  font-weight: var(--text-w-bold);
  color: var(--label-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  line-height: 1.1;
  font-family: var(--font-display);
}

.ios-card-delta {
  font-size: var(--text-size-subheadline);
  font-weight: var(--text-w-semibold);
}

.ios-card-delta--pos { color: var(--ios-green); }
.ios-card-delta--neg { color: var(--ios-red); }

/* ═══════════════════════════════════════════════════════════
   BADGE
   ═══════════════════════════════════════════════════════════ */
.ios-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: var(--ios-red);
  color: #fff;
  font-size: 12px;
  font-weight: var(--text-w-bold);
  border-radius: 10px;
  padding: 0 5px;
}

.ios-badge--dot {
  width: 8px;
  height: 8px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════
   PROGRESS BAR — 4pt iOS style
   ═══════════════════════════════════════════════════════════ */
.ios-progress {
  width: 100%;
  height: 4px;
  background: var(--fill-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.ios-progress-fill {
  height: 100%;
  background: var(--tint);
  border-radius: 2px;
  transition: width var(--duration-slow) var(--spring-gentle);
}

.ios-progress-fill--green { background: var(--ios-green); }
.ios-progress-fill--orange { background: var(--ios-orange); }
.ios-progress-fill--red { background: var(--ios-red); }

/* ═══════════════════════════════════════════════════════════
   SPINNER — 12-segment iOS activity indicator
   ═══════════════════════════════════════════════════════════ */
.ios-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  position: relative;
}

.ios-spinner::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: var(--tint);
  border-right-color: var(--tint);
  border-radius: 50%;
  animation: iosSpinnerRotate 0.65s linear infinite;
}

@keyframes iosSpinnerRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* SVG-based 12-segment spinner (more iOS-accurate) */
.ios-spinner-segments {
  display: inline-block;
  width: 20px;
  height: 20px;
  animation: iosSpinnerRotate 1s steps(12) infinite;
}

/* ═══════════════════════════════════════════════════════════
   CONTEXT MENU (Long-press menu)
   ═══════════════════════════════════════════════════════════ */
.ios-context-menu {
  position: absolute;
  background: var(--glass-thick-bg);
  backdrop-filter: var(--glass-thick-blur);
  -webkit-backdrop-filter: var(--glass-thick-blur);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-modal);
  min-width: 250px;
  z-index: 999;
  animation: iosContextIn var(--duration-fast) var(--spring-default);
}

@keyframes iosContextIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.ios-context-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-size-body);
  color: var(--label-primary);
  cursor: pointer;
  transition: background var(--duration-instant);
}

.ios-context-item + .ios-context-item {
  border-top: 0.5px solid var(--separator);
}

.ios-context-item:active { background: var(--fill-secondary); }
.ios-context-item--destructive { color: var(--ios-red); }

/* ═══════════════════════════════════════════════════════════
   SCROLL CONTAINER — iOS-style scroll
   ═══════════════════════════════════════════════════════════ */
.ios-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ios-scroll::-webkit-scrollbar {
  width: 3px;
}
.ios-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.ios-scroll::-webkit-scrollbar-thumb {
  background: var(--ios-gray3);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════
   PAGE LAYOUT — body with navbar + tabbar
   ═══════════════════════════════════════════════════════════ */
.ios-page {
  min-height: 100dvh;
  background: var(--grouped-background-primary);
}

.ios-page-content {
  padding-top: var(--navbar-height);
  padding-bottom: var(--tabbar-safe);
}

.ios-page-content--large-title {
  padding-top: 0;
}

/* ═══════════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════════ */
.ios-divider {
  height: 0.5px;
  background: var(--separator);
  margin: 0;
}

.ios-divider--opaque {
  background: var(--opaque-separator);
}

/* ═══════════════════════════════════════════════════════════
   CHIP / TAG
   ═══════════════════════════════════════════════════════════ */
.ios-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-size-footnote);
  font-weight: var(--text-w-medium);
  background: var(--fill-secondary);
  color: var(--label-primary);
}

.ios-chip--blue   { background: color-mix(in srgb, var(--ios-blue)   20%, transparent); color: var(--ios-blue); }
.ios-chip--green  { background: color-mix(in srgb, var(--ios-green)  20%, transparent); color: var(--ios-green); }
.ios-chip--orange { background: color-mix(in srgb, var(--ios-orange) 20%, transparent); color: var(--ios-orange); }
.ios-chip--red    { background: color-mix(in srgb, var(--ios-red)    20%, transparent); color: var(--ios-red); }
.ios-chip--purple { background: color-mix(in srgb, var(--ios-purple) 20%, transparent); color: var(--ios-purple); }

/* ═══════════════════════════════════════════════════════════
   STATS ROW — quick stats display (iOS widget style)
   ═══════════════════════════════════════════════════════════ */
.ios-stats-row {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ios-stats-row::-webkit-scrollbar { display: none; }

.ios-stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--grouped-background-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-1);
}

.ios-stat-label {
  font-size: var(--text-size-caption-1);
  font-weight: var(--text-w-medium);
  color: var(--label-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.ios-stat-value {
  font-size: var(--text-size-title-2);
  font-weight: var(--text-w-bold);
  color: var(--label-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  font-family: var(--font-display);
}

.ios-stat-delta {
  font-size: var(--text-size-caption-1);
  font-weight: var(--text-w-medium);
  margin-top: 2px;
}

.ios-stat-delta--pos { color: var(--ios-green); }
.ios-stat-delta--neg { color: var(--ios-red); }
