/*
 * Agenteer web — default stylesheet: each Morph rendered like its iOS (17/18)
 * UIKit default, so a web-rendered Agenteer interface is indistinguishable from
 * the same interface built natively. System colours (light + dark), Dynamic Type
 * sizes (Large), inset-grouped lists, controls and bars follow Apple's defaults.
 * Paired with the iOS-shaped markup in render-node.mjs.
 */

:root {
  --ag-blue: #007aff;
  --ag-green: #34c759;
  --ag-red: #ff3b30;
  --ag-gray: #8e8e93;
  --ag-label: #000;
  --ag-secondaryLabel: rgba(60, 60, 67, .6);
  --ag-tertiaryLabel: rgba(60, 60, 67, .3);
  --ag-placeholder: rgba(60, 60, 67, .3);
  --ag-separator: rgba(60, 60, 67, .29);
  --ag-groupedBg: #f2f2f7;
  --ag-cellBg: #fff;
  --ag-fill: rgba(120, 120, 128, .2);
  --ag-tertiaryFill: rgba(118, 118, 128, .12);
  --ag-switchOff: #e9e9ea;
  --ag-segmentSelected: #fff;
  --ag-bar: rgba(249, 249, 249, .94);
  --ag-material: rgba(242, 242, 242, .8);
  --ag-menu: rgba(237, 237, 237, .8);
  --ag-margin: 20px;
  color-scheme: light dark;
}
@media (max-width: 400px) { :root { --ag-margin: 16px; } }
@media (prefers-color-scheme: dark) {
  :root {
    --ag-blue: #0a84ff;
    --ag-green: #30d158;
    --ag-red: #ff453a;
    --ag-label: #fff;
    --ag-secondaryLabel: rgba(235, 235, 245, .6);
    --ag-tertiaryLabel: rgba(235, 235, 245, .3);
    --ag-placeholder: rgba(235, 235, 245, .3);
    --ag-separator: rgba(84, 84, 88, .65);
    --ag-groupedBg: #000;
    --ag-cellBg: #1c1c1e;
    --ag-fill: rgba(120, 120, 128, .36);
    --ag-tertiaryFill: rgba(118, 118, 128, .24);
    --ag-switchOff: #39393d;
    --ag-segmentSelected: #636366;
    --ag-bar: rgba(29, 29, 29, .94);
    --ag-material: rgba(44, 44, 46, .82);
    --ag-menu: rgba(37, 37, 37, .82);
  }
}

/* ---- page + screen (an iPhone-width view controller) ------------------------ */
html, body { margin: 0; background: var(--ag-groupedBg); }
body {
  color: var(--ag-label);
  font: 17px/22px -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  letter-spacing: -.41px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; }
button:focus, input:focus, select:focus, textarea:focus { outline: none; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--ag-blue); outline-offset: 2px; }
.ag-screen {
  max-width: 430px; margin: 0 auto; min-height: 100vh;
  background: var(--ag-groupedBg); position: relative; padding-bottom: 8px;
}
/* Free-standing content on the screen gets the system layout margins. */
.ag-screen > :not(.ag-list):not(.ag-navigationBar):not(.ag-toolbar):not(.ag-tabBar):not(.ag-alertBackdrop):not(.ag-scrollView) {
  margin-left: var(--ag-margin); margin-right: var(--ag-margin);
}
.ag-screen > .ag-label, .ag-screen > .ag-stackView, .ag-screen > .ag-button { margin-top: 8px; margin-bottom: 8px; }

/* ---- UILabel: Dynamic Type text styles (Large) ------------------------------ */
.ag-label { margin: 0; }
.ag-largeTitle { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; }
.ag-title1 { font-size: 28px; line-height: 34px; font-weight: 400; letter-spacing: .36px; }
.ag-title2 { font-size: 22px; line-height: 28px; font-weight: 400; letter-spacing: .35px; }
.ag-title3 { font-size: 20px; line-height: 25px; font-weight: 400; letter-spacing: .38px; }
.ag-headline { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.41px; }
.ag-body { font-size: 17px; line-height: 22px; letter-spacing: -.41px; }
.ag-callout { font-size: 16px; line-height: 21px; letter-spacing: -.32px; }
.ag-subheadline { font-size: 15px; line-height: 20px; letter-spacing: -.24px; }
.ag-footnote { font-size: 13px; line-height: 18px; letter-spacing: -.08px; }
.ag-caption1 { font-size: 12px; line-height: 16px; letter-spacing: 0; }
.ag-caption2 { font-size: 11px; line-height: 13px; letter-spacing: .07px; }

/* ---- SF Symbol lookalikes --------------------------------------------------- */
.ag-symbol { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.ag-symbol svg { width: 1.15em; height: 1.15em; display: block; fill: currentColor; }
.ag-symbol.ag-unmapped { width: .9em; height: .9em; border: 1.5px solid currentColor; border-radius: 4px; opacity: .5; }
.ag-screen > .ag-symbol, .ag-row > .ag-symbol { color: var(--ag-blue); font-size: 22px; }
.ag-image { max-width: 100%; display: block; }

/* ---- UINavigationBar -------------------------------------------------------- */
.ag-navigationBar { position: sticky; top: 0; z-index: 3; background: var(--ag-groupedBg); }
.ag-navRow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 44px; padding: 0 8px; }
.ag-navigationBar:not(.ag-large) { background: var(--ag-bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 .5px 0 var(--ag-separator); }
.ag-navTitle { font-weight: 600; text-align: center; white-space: nowrap; }
.ag-leading { justify-self: start; display: flex; } .ag-trailing { justify-self: end; display: flex; }
.ag-navLargeTitle { margin: 0; padding: 3px var(--ag-margin) 8px; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; }
.ag-navigationBar.ag-large:not(:has(.ag-navRow)) { padding-top: 44px; }

/* ---- UIBarButtonItem / UIToolbar / UITabBar --------------------------------- */
.ag-barButtonItem { background: none; border: none; color: var(--ag-blue); padding: 0 8px; height: 44px; display: inline-flex; align-items: center; }
.ag-barButtonItem .ag-symbol { font-size: 20px; }
.ag-barButtonItem.ag-prominent { font-weight: 600; }
.ag-barButtonItem:active, .ag-button.ag-plain:active, .ag-tab:active { opacity: .3; }
.ag-toolbar {
  position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center;
  height: 44px; padding: 0 8px; background: var(--ag-bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 -.5px 0 var(--ag-separator);
}
.ag-toolbar:has(+ .ag-tabBar) { bottom: 49px; }
.ag-tabBar {
  position: sticky; bottom: 0; z-index: 3; display: flex; height: 49px; padding-bottom: env(safe-area-inset-bottom);
  background: var(--ag-bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--ag-separator);
}
.ag-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: none; color: var(--ag-gray); padding: 0; }
.ag-tab[aria-selected="true"] { color: var(--ag-blue); }
.ag-tabIcon { position: relative; display: block; }
.ag-tabIcon .ag-symbol { font-size: 24px; }
.ag-tabLabel { font-size: 10px; line-height: 12px; font-weight: 500; letter-spacing: .1px; }
.ag-badge {
  background: var(--ag-red); color: #fff; border-radius: 9px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  font-size: 13px; line-height: 18px; font-weight: 400; letter-spacing: 0; text-align: center; display: inline-block;
}
.ag-tabIcon .ag-badge { position: absolute; top: -3px; left: 15px; }

/* ---- Inset-grouped / grouped / plain lists (UICollectionView list, UITableView) ---- */
.ag-list { margin: 0 0 20px; }
.ag-screen > .ag-list:not(:has(> .ag-list-header)) { margin-top: 15px; }
.ag-list-header {
  margin: 0; padding: 16px calc(var(--ag-margin) + 16px) 6px; font-size: 13px; line-height: 18px; font-weight: 400;
  letter-spacing: -.08px; text-transform: uppercase; color: var(--ag-secondaryLabel);
}
.ag-list ul, ul.ag-list { list-style: none; margin: 0; padding: 0; background: var(--ag-cellBg); }
.ag-list-insetGrouped ul { margin: 0 var(--ag-margin); border-radius: 10px; overflow: hidden; }
.ag-list-insetGrouped .ag-list-header { padding-left: calc(var(--ag-margin) + 16px); }
.ag-list-grouped .ag-list-header { padding-left: var(--ag-margin); }
.ag-list-grouped ul { box-shadow: 0 -.5px 0 var(--ag-separator), 0 .5px 0 var(--ag-separator); }
.ag-row { position: relative; min-height: 44px; box-sizing: border-box; padding: 11px 16px; display: flex; align-items: center; }
.ag-list-grouped .ag-row { padding-left: var(--ag-margin); padding-right: var(--ag-margin); }
.ag-row + .ag-row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--ag-separator); }
.ag-list-grouped .ag-row + .ag-row::before { left: var(--ag-margin); }
.ag-row > * { flex: 1; min-width: 0; }
.ag-row > .ag-button, .ag-row > .ag-symbol, .ag-row > .ag-pasteControl, .ag-row > .ag-refreshControl,
.ag-row > .ag-activityIndicator, .ag-row > .ag-pullDownButton { flex: none; }
/* A list nested in a row (rare): drop its own card chrome. */
.ag-row .ag-list { margin: -11px -16px; background: none; }

/* ---- form rows: caption left, control right ---------------------------------- */
.ag-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; }
.ag-caption { flex: none; white-space: nowrap; }
.ag-control { flex: 1; min-width: 0; display: flex; justify-content: flex-end; align-items: center; }
.ag-field:has(.ag-textView) { align-items: flex-start; }
.ag-field:has(.ag-picker) { flex-direction: column; align-items: stretch; gap: 4px; }

/* ---- UIButton (configurations) --------------------------------------------- */
.ag-button { border: none; border-radius: 8px; padding: 7px 14px; font-size: 17px; line-height: 22px; }
.ag-button.ag-filled { background: var(--ag-blue); color: #fff; }
.ag-button.ag-filled:active { filter: brightness(.85); }
.ag-button.ag-tinted { background: color-mix(in srgb, var(--ag-blue) 15%, transparent); color: var(--ag-blue); }
.ag-button.ag-gray { background: var(--ag-tertiaryFill); color: var(--ag-blue); }
.ag-button.ag-plain { background: none; color: var(--ag-blue); padding: 0; }
.ag-row > .ag-button.ag-plain { flex: 1; text-align: left; }

/* ---- UITextField / UITextView ------------------------------------------------ */
.ag-textField, .ag-textView { border: none; background: none; padding: 0; width: 100%; color: var(--ag-label); }
.ag-textField::placeholder, .ag-textView::placeholder { color: var(--ag-placeholder); opacity: 1; }
.ag-field .ag-textField { text-align: right; }
.ag-textView { resize: none; min-height: 66px; }
.ag-screen > .ag-textField, .ag-stackView > .ag-textField {   /* UITextField .roundedRect outside lists */
  height: 34px; box-sizing: border-box; padding: 0 7px; border-radius: 5px; background: var(--ag-cellBg);
  border: 1px solid rgba(60, 60, 67, .18); width: auto;
}

/* ---- UISwitch --------------------------------------------------------------- */
.ag-switch {
  position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px; border: none; padding: 0;
  background: var(--ag-switchOff); transition: background .25s;
}
.ag-switch[aria-checked="true"] { background: var(--ag-green); }
.ag-knob {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .25s;
}
.ag-switch[aria-checked="true"] .ag-knob { transform: translateX(20px); }
.ag-switch:disabled { opacity: .45; cursor: default; }

/* ---- UISlider --------------------------------------------------------------- */
.ag-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: none; }
.ag-control:has(.ag-slider) { flex: 1; }
.ag-slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--ag-blue) var(--ag-value), var(--ag-fill) var(--ag-value));
}
.ag-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: #fff;
  box-shadow: 0 .5px 4px rgba(0, 0, 0, .12), 0 6px 13px rgba(0, 0, 0, .12);
}
.ag-slider::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(120, 120, 128, .2); }
.ag-slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ag-blue); }
.ag-slider::-moz-range-thumb { width: 28px; height: 28px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 .5px 4px rgba(0, 0, 0, .12), 0 6px 13px rgba(0, 0, 0, .12); }

/* ---- UIStepper -------------------------------------------------------------- */
.ag-stepperWrap { display: inline-flex; align-items: center; gap: 12px; }
.ag-stepperValue { color: var(--ag-secondaryLabel); font-variant-numeric: tabular-nums; }
.ag-stepper { display: inline-flex; align-items: center; width: 94px; height: 32px; border-radius: 8px; background: var(--ag-tertiaryFill); }
.ag-stepper button { flex: 1; height: 100%; border: none; background: none; font-size: 24px; line-height: 1; font-weight: 300; color: var(--ag-label); }
.ag-stepper button:disabled { color: var(--ag-tertiaryLabel); cursor: default; }
.ag-stepper button:active:not(:disabled) { background: var(--ag-fill); border-radius: 8px; }
.ag-stepperSep { width: 1px; height: 18px; background: var(--ag-separator); }

/* ---- UISegmentedControl ----------------------------------------------------- */
.ag-segmentedControl { display: inline-flex; height: 32px; box-sizing: border-box; padding: 2px; border-radius: 9px; background: var(--ag-tertiaryFill); }
.ag-control:has(.ag-segmentedControl) .ag-segmentedControl, .ag-row > .ag-segmentedControl { flex: 1; max-width: 260px; }
.ag-segmentedControl button {
  position: relative; flex: 1; min-width: 56px; border: none; background: none; border-radius: 7px; padding: 0 10px;
  font-size: 13px; line-height: 18px; font-weight: 400; letter-spacing: -.08px; color: var(--ag-label);
}
.ag-segmentedControl button[aria-checked="true"] {
  background: var(--ag-segmentSelected); font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
}
.ag-segmentedControl button + button:not([aria-checked="true"])::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 1px; background: rgba(142, 142, 147, .3);
}
.ag-segmentedControl button[aria-checked="true"] + button::before { display: none; }

/* ---- pop-up / pull-down buttons and their iOS menu ---------------------- */
.ag-popUp, .ag-pullDownButton { display: inline-flex; }
.ag-popUpButton, .ag-pullDownTitle {
  display: inline-flex; align-items: center; gap: 4px; border: none; background: none; padding: 0;
  color: var(--ag-blue); font: inherit; letter-spacing: inherit;
}
.ag-field .ag-popUpButton { color: var(--ag-secondaryLabel); }
.ag-popUpButton[aria-expanded="true"], .ag-pullDownTitle[aria-expanded="true"] { opacity: .5; }
.ag-popUpChevron { font-size: 12px; }
.ag-pullDownChevron { font-size: 13px; }
.ag-menu {
  position: fixed; z-index: 30; min-width: 250px; max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 13px;
  background: var(--ag-menu); -webkit-backdrop-filter: saturate(180%) blur(40px); backdrop-filter: saturate(180%) blur(40px);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 10px 40px rgba(0, 0, 0, .2);
  transform-origin: var(--ag-origin, top right); animation: ag-menu-in .28s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes ag-menu-in { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: scale(1); } }
.ag-menu button {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 16px; box-sizing: border-box;
  border: none; background: none; text-align: left; color: var(--ag-label); font-size: 17px; line-height: 22px;
}
.ag-menu button + button { border-top: .5px solid var(--ag-separator); }
.ag-menu button:focus { outline: none; }
.ag-menu button:active, .ag-menu.is-keyboard button:focus { background: var(--ag-fill); }
.ag-menuCheck { flex: none; display: inline-flex; width: 18px; margin-right: 10px; font-size: 15px; color: var(--ag-label); }
.ag-menuCheck svg { width: 1em; height: 1em; }
.ag-menuCheck .ag-symbol svg { stroke-width: 2px; }
.ag-menuText { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- UIPickerView (wheel) --------------------------------------------------- */
.ag-picker { position: relative; display: flex; height: 160px; width: 100%; overflow: hidden; }
.ag-pickerBand { position: absolute; left: 8px; right: 8px; top: 64px; height: 32px; border-radius: 8px; background: var(--ag-tertiaryFill); }
.ag-pickerColumn { position: relative; flex: 1; height: 160px; overflow: hidden; cursor: ns-resize; }
.ag-pickerRow {
  height: 32px; line-height: 32px; text-align: center; font-size: 21px; letter-spacing: .35px;
  transform: translateY(calc((2 - var(--ag-index)) * 32px)) scale(calc(1 - var(--ag-d) * .06));
  opacity: calc(1 - var(--ag-d) * .32); cursor: pointer; transition: transform .2s, opacity .2s;
}

/* ---- UIDatePicker (compact) + UIColorWell ----------------------------------- */
.ag-datePicker { position: relative; display: inline-flex; gap: 6px; }
.ag-datePill { background: var(--ag-tertiaryFill); border-radius: 6px; padding: 6px 11px; line-height: 22px; color: var(--ag-label); }
.ag-datePicker:focus-within .ag-datePill { color: var(--ag-blue); }
.ag-nativeOverlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.ag-colorWell {
  position: relative; display: inline-block; width: 28px; height: 28px; border-radius: 50%;
  background:
    radial-gradient(circle, var(--ag-color) 0 9px, var(--ag-cellBg) 9.5px 11px, transparent 11.5px),
    conic-gradient(#ff3b30, #ffcc00, #34c759, #5ac8fa, #007aff, #af52de, #ff2d55, #ff3b30);
}

/* ---- UIPageControl ---------------------------------------------------------- */
.ag-pageControl { display: inline-flex; gap: 9px; align-items: center; padding: 8px 0; }
.ag-dot { width: 7px; height: 7px; padding: 0; border: none; border-radius: 50%; background: var(--ag-tertiaryLabel); }
.ag-dot[aria-current="page"] { background: var(--ag-label); }

/* ---- UIPasteControl / UIRefreshControl -------------------------------------- */
.ag-pasteControl {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: none; border-radius: 17px;
  background: var(--ag-blue); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -.24px;
}
.ag-refreshControl { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 0; color: var(--ag-blue); }
.ag-refreshControl.ag-refreshing { color: var(--ag-secondaryLabel); }

/* ---- UIProgressView / UIActivityIndicatorView ------------------------------- */
.ag-progressView { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border: none; border-radius: 2px; background: var(--ag-fill); overflow: hidden; }
.ag-progressView::-webkit-progress-bar { background: var(--ag-fill); border-radius: 2px; }
.ag-progressView::-webkit-progress-value { background: var(--ag-blue); border-radius: 2px; }
.ag-progressView::-moz-progress-bar { background: var(--ag-blue); border-radius: 2px; }
.ag-activityIndicator { position: relative; display: inline-block; width: 20px; height: 20px; flex: none; }
.ag-activityIndicator i {
  position: absolute; left: 9px; top: 1px; width: 2px; height: 5.5px; border-radius: 1px; background: var(--ag-gray);
  transform-origin: 1px 9px; transform: rotate(calc(var(--ag-i) * 45deg));
  animation: ag-spoke .8s linear infinite; animation-delay: calc(var(--ag-i) * .1s - .8s);
}
.ag-activityIndicator.ag-small { transform: scale(.8); }
@keyframes ag-spoke { from { opacity: 1; } to { opacity: .25; } }

/* ---- UISearchBar / UISearchTextField ---------------------------------------- */
.ag-searchBar { display: flex; align-items: center; gap: 8px; }
.ag-searchField, .ag-searchTextField {
  flex: 1; display: flex; align-items: center; gap: 6px; height: 36px; box-sizing: border-box; padding: 0 8px;
  border-radius: 10px; background: var(--ag-tertiaryFill);
}
.ag-searchIcon { color: var(--ag-secondaryLabel); font-size: 15px; }
.ag-searchField input, .ag-searchTextField input { flex: 1; min-width: 0; border: none; background: none; padding: 0; -webkit-appearance: none; appearance: none; }
.ag-searchField input::placeholder, .ag-searchTextField input::placeholder { color: var(--ag-secondaryLabel); opacity: 1; }
.ag-searchBar input::-webkit-search-cancel-button, .ag-searchTextField input::-webkit-search-cancel-button { -webkit-appearance: none; }
.ag-searchCancel { display: none; border: none; background: none; padding: 0; color: var(--ag-blue); }
.ag-searchBar:focus-within .ag-searchCancel { display: block; }
.ag-token {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 6px; font-size: 15px; line-height: 20px;
  background: color-mix(in srgb, var(--ag-blue) 16%, transparent); color: var(--ag-blue); white-space: nowrap;
}
.ag-token button { border: none; background: none; padding: 0; color: inherit; font-size: 14px; opacity: .6; }

/* ---- UIScrollView / UICollectionView ---------------------------------------- */
.ag-scrollView { scrollbar-width: none; }
.ag-scrollView::-webkit-scrollbar { display: none; }
.ag-scrollView.ag-vertical { max-height: 60vh; overflow-y: auto; }
.ag-scrollView.ag-horizontal { display: flex; overflow-x: auto; }
.ag-scrollView.ag-horizontal > * { flex: none; min-width: 100%; }
.ag-scrollView.ag-paging { scroll-snap-type: x mandatory; } .ag-scrollView.ag-paging > * { scroll-snap-align: start; }
.ag-collectionView { display: grid; gap: 10px; }
.ag-cell { padding: 12px; border-radius: 10px; background: var(--ag-tertiaryFill); cursor: pointer; }
.ag-cell:active { background: var(--ag-fill); }

/* ---- UICalendarView --------------------------------------------------------- */
.ag-calendarView { width: 100%; }
.ag-calHeader { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 12px; }
.ag-calTitle { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.ag-calTitle .ag-symbol { color: var(--ag-blue); font-size: 14px; }
.ag-calNav { display: flex; gap: 20px; }
.ag-calNav button { border: none; background: none; padding: 0; color: var(--ag-blue); font-size: 20px; }
.ag-calWeekdays, .ag-calGrid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.ag-calWeekdays span { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ag-tertiaryLabel); padding-bottom: 6px; }
.ag-calDay {
  justify-self: center; width: 40px; height: 40px; margin: 2px 0; border: none; border-radius: 50%; background: none;
  font-size: 20px; letter-spacing: .38px; color: var(--ag-label); font-variant-numeric: tabular-nums;
}
.ag-calDay[aria-selected="true"] { background: color-mix(in srgb, var(--ag-blue) 15%, transparent); color: var(--ag-blue); font-weight: 600; }
.ag-calDay:disabled { color: var(--ag-tertiaryLabel); cursor: default; }

/* ---- UIContentUnavailableView ----------------------------------------------- */
.ag-contentUnavailableView { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 16px; color: var(--ag-secondaryLabel); }
.ag-contentUnavailableView .ag-hero { font-size: 48px; color: var(--ag-secondaryLabel); margin-bottom: 8px; }
.ag-contentUnavailableView h2 { margin: 0 0 4px; color: var(--ag-label); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: .35px; }
.ag-contentUnavailableView p { margin: 0 0 12px; font-size: 15px; line-height: 20px; letter-spacing: -.24px; }

/* ---- UIAlertController (alert / action sheet) ------------------------------- */
.ag-alertBackdrop { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .2); }
.ag-alert {
  width: 270px; border-radius: 14px; overflow: hidden; text-align: center; background: var(--ag-material);
  -webkit-backdrop-filter: saturate(180%) blur(40px); backdrop-filter: saturate(180%) blur(40px);
}
.ag-alertText { padding: 19px 16px 18px; }
.ag-alert h2 { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.41px; }
.ag-alert p { margin: 2px 0 0; font-size: 13px; line-height: 16px; letter-spacing: -.08px; }
.ag-actions { display: flex; flex-direction: column; }
.ag-actions.ag-pair { flex-direction: row; }
.ag-action { height: 44px; border: none; background: none; border-top: .5px solid var(--ag-separator); color: var(--ag-blue); font-size: 17px; }
.ag-actions.ag-pair .ag-action { flex: 1; }
.ag-actions.ag-pair .ag-action + .ag-action { border-left: .5px solid var(--ag-separator); }
.ag-action:active { background: var(--ag-fill); }
.ag-action.ag-cancel { font-weight: 600; }
.ag-action.ag-destructive { color: var(--ag-red); }
.ag-alertStyle-actionSheet { align-items: flex-end; }
.ag-alertStyle-actionSheet .ag-alert { width: calc(100% - 16px); max-width: 414px; margin: 8px; border-radius: 13px; overflow: visible; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ag-alertStyle-actionSheet .ag-alertText, .ag-alertStyle-actionSheet .ag-action { background: var(--ag-material); -webkit-backdrop-filter: saturate(180%) blur(40px); backdrop-filter: saturate(180%) blur(40px); }
.ag-alertStyle-actionSheet .ag-alertText { border-radius: 13px 13px 0 0; padding: 14px 16px; color: var(--ag-secondaryLabel); }
.ag-alertStyle-actionSheet .ag-alert h2, .ag-alertStyle-actionSheet .ag-alert p { font-size: 13px; }
.ag-alertStyle-actionSheet .ag-action { height: 57px; font-size: 20px; }
.ag-alertStyle-actionSheet .ag-action:not(.ag-cancel):last-of-type, .ag-alertStyle-actionSheet .ag-action:nth-last-child(2):has(+ .ag-cancel) { border-radius: 0 0 13px 13px; }
.ag-alertStyle-actionSheet .ag-action.ag-cancel { order: 99; margin-top: 8px; border-radius: 13px; border-top: none; background: var(--ag-cellBg); }

/* ---- UIVisualEffectView, large content viewer, event attribution ------------ */
.ag-visualEffectView { border-radius: 10px; padding: 8px 10px; -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); background: rgba(255, 255, 255, .7); }
.ag-visualEffectView.ag-systemThinMaterial { background: rgba(255, 255, 255, .5); }
.ag-visualEffectView.ag-systemThickMaterial { background: rgba(255, 255, 255, .85); }
@media (prefers-color-scheme: dark) {
  .ag-visualEffectView { background: rgba(37, 37, 37, .7); }
  .ag-visualEffectView.ag-systemThinMaterial { background: rgba(37, 37, 37, .5); }
  .ag-visualEffectView.ag-systemThickMaterial { background: rgba(37, 37, 37, .85); }
}
.ag-largeContentViewer { display: contents; }
.ag-eventAttributionView { color: inherit; text-decoration: none; display: block; }

/* ---- stack views ------------------------------------------------------------ */
.ag-stackView { display: flex; gap: 8px; }
.ag-stackView.ag-vertical { flex-direction: column; align-items: stretch; }
.ag-stackView.ag-horizontal { flex-direction: row; align-items: center; }
.ag-screen > .ag-stackView:empty { display: none; }

/* the demo page's reply log (was an inline style — the CSP allows no inline styles) */
.ag-log { max-width: 430px; margin: 0 auto; padding: 0 20px; color: var(--ag-blue); white-space: pre-wrap; }

/* the published landing page */
.ag-landing-note { margin: 0 20px 16px; color: var(--ag-secondaryLabel); }
.ag-landing-link { color: var(--ag-blue); text-decoration: none; }
