/*
 * IosSideBarWidget styling — iOS / iPhone visual language.
 * Loaded in Niagara via  css!nmodule/iosUi/rc/IosSideBarWidget
 */

.iosUi-root {
  --ios-radius-xl: 28px;
  --ios-radius-lg: 22px;
  --ios-radius-md: 16px;
  --ios-radius-sm: 12px;
  --ios-blue: #0a84ff;
  --ios-green: #30d158;
  --ios-orange: #ff9f0a;
  --ios-red: #ff453a;
  --ios-purple: #bf5af2;
  --ios-teal: #64d2ff;
  --ios-label: #ffffff;
  --ios-label-2: rgba(235, 235, 245, 0.62);
  --ios-label-3: rgba(235, 235, 245, 0.32);
  --ios-sep: rgba(255, 255, 255, 0.10);
  --ios-fill: rgba(120, 120, 128, 0.24);
  --ios-card: rgba(28, 28, 30, 0.72);
  --ios-sidebar: rgba(18, 18, 20, 0.82);

  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: var(--ios-radius-xl);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Inter", "Helvetica Neue", Segoe UI, Roboto, sans-serif;
  font-size: 15px;
  color: var(--ios-label);
  letter-spacing: -0.01em;
  background:
    radial-gradient(1200px 700px at 12% -10%, #2b3350 0%, transparent 60%),
    radial-gradient(900px 600px at 105% 110%, #123a4a 0%, transparent 55%),
    linear-gradient(160deg, #0d0d11 0%, #16161c 55%, #0b0b0f 100%);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- sidebar */

.iosUi-side {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  width: 78px;
  display: flex;
  flex-direction: column;
  padding: 18px 0 16px;
  background: var(--ios-sidebar);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-right: 1px solid var(--ios-sep);
  transition: width 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
.iosUi-root.is-open .iosUi-side { width: 248px; }

.iosUi-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 18px;
  min-height: 46px;
}
.iosUi-brand-mark {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--ios-blue), #5e5ce6);
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.38);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
}
.iosUi-brand-text { min-width: 0; opacity: 0; transition: opacity 200ms ease; }
.iosUi-root.is-open .iosUi-brand-text { opacity: 1; transition-delay: 90ms; }
.iosUi-brand-title { font-size: 16px; font-weight: 640; white-space: nowrap; }
.iosUi-brand-sub { font-size: 12px; color: var(--ios-label-2); white-space: nowrap; }

/* profile card — mirrors WSE "dynamic profile from UserService" */
.iosUi-profile {
  margin: 0 12px 14px;
  padding: 10px;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--ios-radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ios-sep);
}
.iosUi-avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(145deg, #ff9f0a, #ff375f);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.iosUi-profile-text { min-width: 0; opacity: 0; transition: opacity 200ms ease; }
.iosUi-root.is-open .iosUi-profile-text { opacity: 1; transition-delay: 90ms; }
.iosUi-profile-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.iosUi-profile-role { font-size: 11.5px; color: var(--ios-label-2); white-space: nowrap; }

.iosUi-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 0 12px; }
.iosUi-nav::-webkit-scrollbar { width: 0; }
/* Collapsed rail: the hover flyout has to escape both the nav's scroll box and
   the widget root. Niagara clips a WebWidget to its layout box, so on a real
   sheet the menu WebWidget must be laid out wide enough for the flyout, or the
   flyout given room — the same caveat the Works Software menu documents. */
.iosUi-root:not(.is-open) .iosUi-nav { overflow: visible; }
.iosUi-root.iosUi-shell:not(.is-open) { overflow: visible; }

.iosUi-item { position: relative; }
.iosUi-link {
  display: flex; align-items: center; gap: 14px;
  height: 46px; padding: 0 12px; margin-bottom: 4px;
  border-radius: var(--ios-radius-sm);
  color: var(--ios-label-2);
  cursor: pointer; user-select: none;
  transition: background 160ms ease, color 160ms ease;
}
.iosUi-link:hover { background: rgba(255, 255, 255, 0.07); color: var(--ios-label); }
.iosUi-item.is-active > .iosUi-link {
  background: linear-gradient(135deg, rgba(10,132,255,0.92), rgba(94,92,230,0.92));
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.32);
}
.iosUi-ic { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; }
.iosUi-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor;
                stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iosUi-label {
  flex: 1 1 auto; white-space: nowrap; font-size: 14.5px; font-weight: 500;
  opacity: 0; transition: opacity 180ms ease;
}
.iosUi-root.is-open .iosUi-label { opacity: 1; transition-delay: 80ms; }
.iosUi-badge {
  opacity: 0; transition: opacity 180ms ease;
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--ios-red); color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center;
}
.iosUi-root.is-open .iosUi-badge { opacity: 1; }
.iosUi-chev { opacity: 0; transition: opacity 180ms ease, transform 260ms cubic-bezier(0.32,0.72,0,1); }
.iosUi-root.is-open .iosUi-chev { opacity: 0.55; }
.iosUi-item.is-expanded > .iosUi-link .iosUi-chev { transform: rotate(90deg); }

/* submenu — slide/reveal, the WSE "slide effect on sub menu items" */
.iosUi-sub {
  overflow: hidden; max-height: 0;
  transition: max-height 300ms cubic-bezier(0.32, 0.72, 0, 1);
  margin-left: 22px;
  border-left: 1px solid var(--ios-sep);
}
.iosUi-item.is-expanded > .iosUi-sub { max-height: 320px; }
.iosUi-root:not(.is-open) .iosUi-sub { max-height: 0 !important; }
.iosUi-sublink {
  display: block; padding: 8px 12px; margin: 2px 0 2px 8px;
  border-radius: 10px; font-size: 13.5px; color: var(--ios-label-2);
  white-space: nowrap; cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.iosUi-sublink:hover { background: rgba(255,255,255,0.06); color: var(--ios-label); }
.iosUi-sublink.is-active { color: var(--ios-blue); font-weight: 600; }
.iosUi-divider { height: 1px; margin: 8px 14px; background: var(--ios-sep); }

/* collapsed hover flyout */
.iosUi-root:not(.is-open) .iosUi-item:hover > .iosUi-flyout { opacity: 1; transform: translateX(0) scale(1); pointer-events: auto; }
.iosUi-flyout {
  position: absolute; left: calc(100% + 10px); top: 0; z-index: 50;
  min-width: 190px; padding: 8px;
  border-radius: var(--ios-radius-md);
  background: rgba(38, 38, 42, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 44px rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none;
  transform: translateX(-8px) scale(0.97); transform-origin: left center;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.32,0.72,0,1);
}
.iosUi-flyout-title { padding: 4px 10px 8px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ios-label-3); }

.iosUi-side-foot { padding: 10px 12px 0; border-top: 1px solid var(--ios-sep); margin-top: 8px; }

/* ------------------------------------------------------------------ stage */

.iosUi-stage { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  container-type: inline-size; }

.iosUi-topbar {
  flex: 0 0 auto; height: 62px; padding: 0 22px;
  display: flex; align-items: center; gap: 14px; flex-wrap: nowrap;
  border-bottom: 1px solid var(--ios-sep);
  background: rgba(20, 20, 24, 0.55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.iosUi-hamburger {
  width: 36px; height: 36px; border-radius: 11px; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08); border: 1px solid var(--ios-sep);
  transition: background 150ms ease;
}
.iosUi-hamburger:hover { background: rgba(255,255,255,0.14); }
.iosUi-hamburger svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2; stroke-linecap: round; fill: none; }
.iosUi-crumb { font-size: 20px; font-weight: 680; letter-spacing: -0.02em; }
.iosUi-crumb small { display: block; font-size: 12px; font-weight: 500; color: var(--ios-label-2); letter-spacing: 0; }
.iosUi-spacer { flex: 1 1 auto; }

/* iOS segmented control */
.iosUi-seg {
  display: flex; padding: 2px; gap: 2px; border-radius: 10px;
  background: var(--ios-fill);
}
.iosUi-seg-opt {
  padding: 5px 14px; border-radius: 8px; font-size: 13px; font-weight: 550;
  color: var(--ios-label-2); cursor: pointer;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.iosUi-seg-opt.is-on {
  background: rgba(99, 99, 104, 0.9); color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

.iosUi-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(48, 209, 88, 0.16); color: var(--ios-green);
  border: 1px solid rgba(48, 209, 88, 0.3);
}
.iosUi-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 currentColor; animation: iosUi-pulse 2.2s infinite; }
@keyframes iosUi-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(48,209,88,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(48,209,88,0); }
  100% { box-shadow: 0 0 0 0 rgba(48,209,88,0); }
}

/* ------------------------------------------------------------------ cards */

.iosUi-body { flex: 1 1 auto; overflow: auto; padding: 20px 22px 24px; }
.iosUi-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }

/*
 * Container queries, not media queries: a PX WebWidget is sized by its
 * layout="x,y,w,h", not by the viewport, so the breakpoint has to key off the
 * widget's own box. The same widget therefore reflows correctly whether it is
 * 1192px wide on a wall display or 318px wide on a phone.
 */
@container (max-width: 760px) {
  .iosUi-grid > .iosUi-card { grid-column: span 12 !important; }
  .iosUi-body { padding: 14px 12px 18px; }
  .iosUi-grid { gap: 12px; }
  .iosUi-value { font-size: 28px; }
  .iosUi-ring svg { width: 84px; height: 84px; }
  .iosUi-topbar { height: 56px; padding: 0 14px; gap: 10px; }
  .iosUi-crumb { font-size: 17px; }
  .iosUi-crumb small { font-size: 11px; max-width: 190px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .iosUi-seg, .iosUi-pill { display: none; }
  .iosUi-card { padding: 14px 15px; }
}

.iosUi-card {
  border-radius: var(--ios-radius-lg);
  background: var(--ios-card);
  border: 1px solid var(--ios-sep);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 260ms cubic-bezier(0.32,0.72,0,1), box-shadow 260ms ease;
}
.iosUi-card:hover { transform: translateY(-2px); box-shadow: 0 18px 44px rgba(0,0,0,0.46); }
.iosUi-c3 { grid-column: span 3; } .iosUi-c4 { grid-column: span 4; }
.iosUi-c5 { grid-column: span 5; } .iosUi-c6 { grid-column: span 6; }
.iosUi-c7 { grid-column: span 7; } .iosUi-c8 { grid-column: span 8; }
.iosUi-c12 { grid-column: span 12; }

.iosUi-card-head { display: flex; align-items: center; gap: 10px; }
.iosUi-card-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ios-label-2); }
.iosUi-tile-ic {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(10,132,255,0.18); color: var(--ios-blue);
}
.iosUi-tile-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.iosUi-tile-ic.g { background: rgba(48,209,88,0.18); color: var(--ios-green); }
.iosUi-tile-ic.o { background: rgba(255,159,10,0.18); color: var(--ios-orange); }
.iosUi-tile-ic.p { background: rgba(191,90,242,0.18); color: var(--ios-purple); }

.iosUi-value { font-size: 34px; font-weight: 660; letter-spacing: -0.03em; line-height: 1.05; }
.iosUi-value small { font-size: 16px; font-weight: 500; color: var(--ios-label-2); margin-left: 3px; }
.iosUi-sub2 { font-size: 12.5px; color: var(--ios-label-2); }
.iosUi-trend { font-weight: 650; }
.iosUi-trend.up { color: var(--ios-green); } .iosUi-trend.down { color: var(--ios-red); }

/* iOS activity ring */
.iosUi-ring { display: flex; align-items: center; gap: 16px; }
.iosUi-ring svg { width: 108px; height: 108px; transform: rotate(-90deg); }
.iosUi-ring .trk { fill: none; stroke: rgba(255,255,255,0.09); stroke-width: 11; }
.iosUi-ring .val { fill: none; stroke-width: 11; stroke-linecap: round;
  transition: stroke-dashoffset 900ms cubic-bezier(0.32,0.72,0,1); }

/* iOS toggle */
.iosUi-row { display: flex; align-items: center; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--ios-sep); }
.iosUi-row:last-child { border-bottom: 0; }
.iosUi-row-name { flex: 1 1 auto; font-size: 14px; }
.iosUi-row-sub { font-size: 11.5px; color: var(--ios-label-3); }
.iosUi-switch {
  flex: 0 0 auto; width: 51px; height: 31px; border-radius: 999px;
  background: var(--ios-fill); position: relative; cursor: pointer;
  transition: background 260ms cubic-bezier(0.32,0.72,0,1);
}
.iosUi-switch.is-on { background: var(--ios-green); }
.iosUi-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.34);
  transition: transform 260ms cubic-bezier(0.32,0.72,0,1);
}
.iosUi-switch.is-on::after { transform: translateX(20px); }

/* setpoint slider */
.iosUi-slider { height: 30px; border-radius: 999px; background: var(--ios-fill);
  position: relative; overflow: hidden; }
.iosUi-slider-fill { position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--ios-teal), var(--ios-blue)); }
.iosUi-slider-lbl { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px; font-size: 12.5px; font-weight: 600; }

/* sparkline / bars */
.iosUi-bars { display: flex; align-items: flex-end; gap: 6px; height: 96px; }
.iosUi-bar { flex: 1 1 0; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--ios-blue), rgba(10,132,255,0.25)); }
.iosUi-bar.hi { background: linear-gradient(180deg, var(--ios-orange), rgba(255,159,10,0.25)); }
.iosUi-axis { display: flex; gap: 6px; font-size: 10.5px; color: var(--ios-label-3); }
.iosUi-axis span { flex: 1 1 0; text-align: center; }

/* alarm list */
.iosUi-alarm { display: flex; align-items: center; gap: 11px; padding: 9px 0;
  border-bottom: 1px solid var(--ios-sep); }
.iosUi-alarm:last-child { border-bottom: 0; }
.iosUi-alarm-ic { width: 30px; height: 30px; border-radius: 9px; display: grid;
  place-items: center; font-size: 14px; }
.iosUi-alarm-ic.crit { background: rgba(255,69,58,0.18); color: var(--ios-red); }
.iosUi-alarm-ic.warn { background: rgba(255,159,10,0.18); color: var(--ios-orange); }
.iosUi-alarm-ic.ok   { background: rgba(48,209,88,0.18); color: var(--ios-green); }
.iosUi-alarm-txt { flex: 1 1 auto; min-width: 0; }
.iosUi-alarm-t { font-size: 13.5px; font-weight: 550; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.iosUi-alarm-s { font-size: 11.5px; color: var(--ios-label-3); }
.iosUi-ack { padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.09); border: 1px solid var(--ios-sep); cursor: pointer; }
.iosUi-ack:hover { background: rgba(255,255,255,0.16); }

/* ORD provenance footer — proves the binding model */
.iosUi-ord { font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px; color: var(--ios-label-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
