/* Mobile tuning for iPhone 15-class screens (393 × 852 CSS pixels). */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button { touch-action: manipulation; }

.focus-card,
.discussion-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.focus-card::after {
  content: '!';
  position: absolute;
  z-index: 0;
  right: 16px;
  bottom: -22px;
  color: rgba(255, 255, 255, .055);
  font-size:calc(138px * var(--ui-font-scale, 1));
  line-height: 1;
  font-weight: 900;
  transform: rotate(7deg);
  pointer-events: none;
}

.discussion-card::after {
  content: '';
  position: absolute;
  z-index: 0;
  right: -12px;
  bottom: -27px;
  width: 102px;
  height: 116px;
  border: 2px solid rgba(255, 255, 255, .055);
  border-radius: 13px 13px 3px 13px;
  background: rgba(255, 255, 255, .018);
  transform: rotate(-7deg);
  pointer-events: none;
}

.discussion-card::before {
  content: '';
  position: absolute;
  z-index: 1;
  right: 4px;
  bottom: 13px;
  width: 64px;
  height: 55px;
  background:
    linear-gradient(rgba(255,255,255,.07),rgba(255,255,255,.07)) 0 0/50px 3px no-repeat,
    linear-gradient(rgba(255,255,255,.055),rgba(255,255,255,.055)) 0 14px/62px 3px no-repeat,
    linear-gradient(rgba(255,255,255,.065),rgba(255,255,255,.065)) 0 28px/42px 3px no-repeat,
    linear-gradient(rgba(255,255,255,.045),rgba(255,255,255,.045)) 0 42px/56px 3px no-repeat;
  border-radius: 3px;
  transform: rotate(-7deg);
  pointer-events: none;
}

.tab .nav-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: currentColor;
  font-size:0;
}

.nav-icon::before,
.nav-icon::after {
  content: '';
  position: absolute;
  box-sizing: border-box;
}

.nav-home::before {
  left: 5px;
  bottom: 2px;
  width: 14px;
  height: 12px;
  border: 1.8px solid currentColor;
  border-top: 0;
  border-radius: 0 0 3px 3px;
}

.nav-home::after {
  left: 5px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-left: 1.8px solid currentColor;
  border-top: 1.8px solid currentColor;
  border-radius: 2px 0 0;
  transform: rotate(45deg);
}

.nav-briefcase::before {
  left: 2px;
  bottom: 2px;
  width: 20px;
  height: 14px;
  border: 1.8px solid currentColor;
  border-radius: 4px;
}

.nav-briefcase::after {
  left: 8px;
  top: 2px;
  width: 8px;
  height: 6px;
  border: 1.8px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.nav-calendar::before,
.nav-calendar::after { content: none; }

.nav-calendar i {
  position: absolute;
  display: block;
  box-sizing: border-box;
  pointer-events: none;
}

.calendar-page-back {
  left: 3px;
  top: 5px;
  width: 15px;
  height: 17px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
  opacity: .52;
}

.calendar-page-front {
  left: 6px;
  top: 2px;
  width: 15px;
  height: 17px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
  background: #081425;
}

.nav-person::before {
  left: 8px;
  top: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.nav-person::after {
  left: 3px;
  bottom: 2px;
  width: 18px;
  height: 11px;
  border: 1.8px solid currentColor;
  border-radius: 10px 10px 4px 4px;
}

/* Exact navigation artwork supplied by the user. */

.tab .nav-icon::before,
.tab .nav-icon::after { content: none; }

.nav-home {
  -webkit-mask-image: url('assets/navigation/home.png');
  mask-image: url('assets/navigation/home.png');
}

.nav-briefcase {
  -webkit-mask-image: url('assets/navigation/cases.png');
  mask-image: url('assets/navigation/cases.png');
}

.nav-calendar {
  -webkit-mask-image: url('assets/navigation/calendar.png');
  mask-image: url('assets/navigation/calendar.png');
}

.nav-person {
  -webkit-mask-image: url('assets/navigation/profile.png');
  mask-image: url('assets/navigation/profile.png');
}

.sheet-action-icon {
  display: block;
  width: 22px;
  height: 22px;
  background-color: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.sheet-document-icon {
  -webkit-mask-image: url('assets/actions/document.png?v=2');
  mask-image: url('assets/actions/document.png?v=2');
}

.sheet-audio-icon {
  -webkit-mask-image: url('assets/actions/audio.png');
  mask-image: url('assets/actions/audio.png');
}

.sheet-note-icon {
  -webkit-mask-image: url('assets/actions/note.png');
  mask-image: url('assets/actions/note.png');
}

.sheet-camera-icon {
  -webkit-mask-image: url('assets/actions/camera.png');
  mask-image: url('assets/actions/camera.png');
}

.sheet-gallery-icon {
  -webkit-mask-image: url('assets/actions/gallery.png');
  mask-image: url('assets/actions/gallery.png');
}

.filter-token {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  overflow: visible;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.chips:has(.filter-token) {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.filter-remove {
  position: absolute;
  z-index: 8;
  top: -9px;
  right: -9px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(8,17,31,.96);
  box-shadow: 0 5px 14px rgba(0,0,0,.34);
  color: #fff;
  font-size:calc(19px * var(--ui-font-scale, 1));
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: scale(.55);
  transition: opacity .16s ease,transform .2s cubic-bezier(.2,.8,.2,1);
}

.filter-edit-mode .filter-remove {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.filter-edit-mode .chips {
  padding-top: 12px;
}

.filter-edit-mode .filter-token:not(.dragging) {
  animation: filter-token-jiggle .25s ease-in-out infinite alternate;
}

@keyframes filter-token-jiggle {
  from { transform: rotate(-.3deg); }
  to { transform: rotate(.3deg); }
}

html[data-theme="light"] .filter-remove {
  border-color: rgba(28,35,49,.14);
  background: rgba(255,255,255,.98);
  color: #222a39;
  box-shadow: 0 5px 14px rgba(32,39,56,.17);
}

.filter-token .chip {
  min-height: 38px;
  padding: 9px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-x pan-y;
}

.filter-token.holding {
  transform: scale(.96);
  border-color: rgba(143,125,255,.55);
  background: rgba(116,88,255,.14);
}

.filter-token.dragging {
  z-index: 120;
  transform: translate3d(var(--drag-x,0),var(--drag-y,0),0) scale(1.07) rotate(-1deg);
  border-color: #a895ff;
  background: #25335a;
  box-shadow: 0 16px 34px rgba(0,0,0,.48),0 0 0 3px rgba(168,149,255,.13);
  cursor: grabbing;
  transition: none;
  will-change: transform;
  pointer-events: none;
}

.filter-token.dragging .chip { color: white; }

.filter-placeholder {
  flex: 0 0 auto;
  display: inline-block;
  border: 1px dashed rgba(168,149,255,.38);
  border-radius: 20px;
  background: rgba(116,88,255,.08);
}

.filter-sheet { gap: 12px; }
.filter-sheet > p { margin-bottom: 2px; }

.filter-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.filter-confirm-actions button {
  min-height: 46px;
  border-radius: 14px;
  font-size:calc(12px * var(--ui-font-scale, 1));
  font-weight: 750;
}

.filter-confirm-actions .danger {
  border: 1px solid rgba(255,92,108,.35);
  background: rgba(255,92,108,.16);
  color: #ff929d;
}

@media (max-width: 430px) {
  .app-shell {
    width: 100%;
    min-height: 100dvh;
    box-shadow: none;
  }

  .screen {
    min-height: 100dvh;
    padding: max(20px, calc(env(safe-area-inset-top) + 10px)) 18px 0;
  }

  .home-route .screen {
    padding-bottom: 0;
  }

  .detail .screen {
    padding-bottom: 0;
  }

  .header {
    margin-top: 2px;
    margin-bottom: 22px;
  }

  .eyebrow { font-size:calc(13px * var(--ui-font-scale, 1)); line-height: 1.35; }
  .card { border-radius: 20px; }
  .muted { font-size:calc(13px * var(--ui-font-scale, 1)); }

  .bell,
  .icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .section-title { margin-top: 24px; }
  .section-title button { min-height: 40px; padding: 0 4px; font-size:calc(12px * var(--ui-font-scale, 1)); }

  .focus-card h2 { font-size:calc(20px * var(--ui-font-scale, 1)); }
  .focus-card p { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .focus-card-top strong,
  .focus-footer { font-size:calc(10px * var(--ui-font-scale, 1)); }

  .ai-card h2 { font-size:calc(21px * var(--ui-font-scale, 1)); }
  .discussion-card > p { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .discussion-meta { font-size:calc(10px * var(--ui-font-scale, 1)); }

  .home-route .home-ai-search {
    width: calc(100% - 24px);
    min-height: 54px;
    border-radius: 18px;
  }

  .home-ai-search input,
  .search input,
  .chat-box input,
  .form input,
  .form select,
  .task-sheet input {
    font-size:calc(16px * var(--ui-font-scale, 1));
  }

  .nav-items-row {
    grid-template-columns: 1fr 1fr 70px 1fr 1fr;
  }

  .tab span { font-size:calc(23px * var(--ui-font-scale, 1)); line-height: 1; }
  .tab small { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .case-card .card-label { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .case-card .date-pill { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .risk { font-size:calc(13px * var(--ui-font-scale, 1)); line-height: 1.4; }
  .month-switch strong { font-size:calc(16px * var(--ui-font-scale, 1)); }
  .calendar .days button { height: 38px; min-height: 38px; font-size:calc(15px * var(--ui-font-scale, 1)); }
  .calendar-event { min-height: 72px; grid-template-columns: 45px 3px 1fr 10px; }
  .calendar-event time { font-size:calc(13px * var(--ui-font-scale, 1)); }
  .calendar-event strong { font-size:calc(14px * var(--ui-font-scale, 1)); line-height: 1.35; }
  .calendar-event small { font-size:calc(12px * var(--ui-font-scale, 1)); line-height: 1.4; }
  .menu-row { min-height: 58px; }
  .case-tabs button { min-height: 42px; font-size:calc(12px * var(--ui-font-scale, 1)); }
  .mini-deadline { min-height: 62px; }
  .mini-deadline strong { font-size:calc(13px * var(--ui-font-scale, 1)); }
  .mini-deadline small { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .document-row { min-height: 68px; }
  .document-row strong { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .rec-card h4 { font-size:calc(14px * var(--ui-font-scale, 1)); }
  .rec-card p,
  .body-copy { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .notice p { font-size:calc(11px * var(--ui-font-scale, 1)); }

  .form { gap: 15px; }
  .form-pair > label { min-width: 0; }
  .form label,
  .task-sheet label { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .form input,
  .form select,
  .task-sheet input { min-height: 50px; }

  .chat-intro p { font-size:calc(11px * var(--ui-font-scale, 1)); line-height: 1.45; }
  .quick-prompts button { min-height: 40px; font-size:calc(11px * var(--ui-font-scale, 1)); }
  .chat-box {
    bottom: calc(10px + env(safe-area-inset-bottom));
    min-height: 54px;
  }

  .assistant-fab { bottom: calc(16px + env(safe-area-inset-bottom)); min-height: 48px; }
  .sheet > p { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .sheet > button strong { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); font-size:calc(12px * var(--ui-font-scale, 1)); }

  .urgent-summary strong { font-size:calc(13px * var(--ui-font-scale, 1)); }
  .urgent-summary small { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .urgent-date small { font-size:calc(9px * var(--ui-font-scale, 1)); }
  .urgent-toggle > div strong { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .urgent-toggle > div small,
  .urgent-days { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .urgent-panel > p { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .urgent-panel > div span { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .urgent-panel button { min-height: 40px; font-size:calc(11px * var(--ui-font-scale, 1)); }

  .camera-preview p,
  .upload-zone p { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .camera-ready,
  .privacy-line { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .processing h2 { font-size:calc(20px * var(--ui-font-scale, 1)); }
  .steps span { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .timeline-date { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .finding-hero p { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .time-compare small { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .time-compare > span { font-size:calc(9px * var(--ui-font-scale, 1)); }
  .check-list li { font-size:calc(12px * var(--ui-font-scale, 1)); line-height: 1.45; }
  .task-summary small { font-size:calc(10px * var(--ui-font-scale, 1)); }

  .audio-hero strong { font-size:calc(12px * var(--ui-font-scale, 1)); }
  .people span { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .notification strong { font-size:calc(13px * var(--ui-font-scale, 1)); }
  .notification p { font-size:calc(11px * var(--ui-font-scale, 1)); }
  .notification small { font-size:calc(10px * var(--ui-font-scale, 1)); }
  .empty p { font-size:calc(11px * var(--ui-font-scale, 1)); }
}

@media (max-width: 360px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  .header h1,
  .head-copy h1 { font-size:calc(25px * var(--ui-font-scale, 1)); }
  .tab small { font-size:calc(9px * var(--ui-font-scale, 1)); }
}

/* Calendar typography stays readable in both the iPhone viewport and local desktop preview. */
.calendar .month-switch strong {
  font-size:calc(17px * var(--ui-font-scale, 1));
}

.calendar .week small {
  font-size:calc(12px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.calendar .days button {
  min-height: 38px;
  height: 38px;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.calendar .legend span {
  font-size:calc(12px * var(--ui-font-scale, 1));
}

.calendar-event {
  min-height: 76px;
  grid-template-columns: 48px 3px 1fr 10px;
  padding: 15px;
}

.calendar-event time {
  font-size:calc(14px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.calendar-event strong {
  font-size:calc(16px * var(--ui-font-scale, 1));
  line-height: 1.35;
}

.calendar-event small {
  display: block;
  margin-top: 4px;
  font-size:calc(13px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.calendar-voice-fab {
  position: fixed;
  z-index: 18;
  right: max(18px, calc((100vw - 480px) / 2 + 18px));
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border: 1px solid rgba(118,255,205,.32);
  border-radius: 21px;
  background: linear-gradient(145deg,#39dda5,#16a978);
  color: #062d22;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 32px rgba(24,190,134,.38),inset 0 1px 0 rgba(255,255,255,.28);
  touch-action: pan-y;
  -webkit-touch-callout: none;
  user-select: none;
}

.calendar-voice-fab.user-positioned {
  right: auto !important;
  bottom: auto !important;
}

.calendar-voice-fab.dragging {
  z-index: 90;
  cursor: grabbing;
  transform: scale(1.08);
  box-shadow: 0 18px 42px rgba(24,190,134,.52),inset 0 1px 0 rgba(255,255,255,.34);
}

body.calendar-voice-holding,
body.calendar-voice-holding * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

.calendar-voice-fab .mic-icon::before { border-width: 2px; }

.calendar-voice-fab::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 2px;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: currentColor;
}

.calendar-voice-fab.listening {
  color: white;
  animation: calendarVoicePulse .9s ease-in-out infinite;
}

@keyframes calendarVoicePulse {
  50% {
    transform: scale(.92);
    box-shadow: 0 0 0 10px rgba(51,214,159,.12),0 12px 28px rgba(24,190,134,.32);
  }
}

.calendar-voice-sheet { text-align: center; }
.calendar-voice-command.swiping-down { animation: none; transition: none; will-change: transform; }

.voice-recognized-mark {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: rgba(51,214,159,.14);
  color: var(--green);
  display: grid;
  place-items: center;
}

.voice-recognized-mark::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 2px;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: currentColor;
}

.calendar-voice-sheet .voice-transcript {
  margin: 9px 0 15px;
  color: #b8c5d4;
  font-size:calc(13px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

.voice-event-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  text-align: left;
}

.voice-event-details > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.voice-event-details > div:last-child { grid-column: 1 / -1; }
.voice-event-details small { display: block; margin-bottom: 4px; color: var(--muted); font-size:calc(10px * var(--ui-font-scale, 1)); }
.voice-event-details strong { font-size:calc(13px * var(--ui-font-scale, 1)); }

.calendar-voice-confirm {
  border: 1px solid rgba(51,214,159,.3);
  border-radius: 14px;
  background: rgba(51,214,159,.16);
  color: #72e6bd;
  font-size:calc(12px * var(--ui-font-scale, 1));
  font-weight: 750;
}

.voice-created {
  border: 1px solid rgba(51,214,159,.18);
  background: linear-gradient(145deg,rgba(51,214,159,.09),var(--panel));
}

.voice-created > b { color: var(--green); }

.calendar-view-trigger {
  position: relative;
}

.calendar-dropdown-icon {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: inherit;
  font-size:calc(27px * var(--ui-font-scale, 1));
  font-weight: 400;
  line-height: 1;
  transition: transform .2s ease;
}

.calendar-view-trigger.open .calendar-dropdown-icon {
  transform: rotate(180deg);
}

.calendar-view-popover {
  position: absolute;
  z-index: 35;
  top: max(74px, calc(env(safe-area-inset-top) + 64px));
  right: max(18px, calc((100vw - 480px) / 2 + 18px));
  width: 172px;
  overflow: hidden;
  padding: 6px;
  border: 1px solid rgba(143,125,255,.24);
  border-radius: 17px;
  background: rgba(17,31,51,.97);
  box-shadow: 0 18px 44px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
  animation: calendarMenuIn .18s ease-out;
}

.calendar-view-popover button {
  width: 100%;
  min-height: 43px;
  padding: 0 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #aebccd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size:calc(13px * var(--ui-font-scale, 1));
  text-align: left;
}

.calendar-view-popover button.active {
  background: rgba(116,88,255,.16);
  color: #c6bcff;
  font-weight: 700;
}

.calendar-view-popover [data-calendar-mode="year"] {
  display: none;
}

.calendar-view-popover button b {
  color: var(--green);
  font-size:calc(13px * var(--ui-font-scale, 1));
}

@keyframes calendarMenuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
}

.calendar-week-view {
  padding: 16px;
}

.calendar-week-strip {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 5px;
}

.calendar-week-strip button {
  position: relative;
  min-width: 0;
  min-height: 68px;
  padding: 8px 2px;
  border: 0;
  border-radius: 13px;
  background: rgba(255,255,255,.025);
  color: #c6d1df;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
}

.calendar-week-strip button small {
  color: #70839d;
  font-size:calc(10px * var(--ui-font-scale, 1));
}

.calendar-week-strip button strong {
  font-size:calc(16px * var(--ui-font-scale, 1));
}

.calendar-week-strip button.today {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 20px rgba(116,88,255,.28);
}

.calendar-week-strip button.today small { color: rgba(255,255,255,.72); }

.calendar-week-strip button.has-event::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--yellow);
}

.calendar-year-view {
  padding: 15px;
}

.calendar-year-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
}

.calendar-year-grid button {
  min-height: 76px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.018);
  color: #aebccd;
  display: grid;
  gap: 8px;
  text-align: left;
}

.calendar-year-grid button strong {
  font-size:calc(11px * var(--ui-font-scale, 1));
}

.calendar-year-grid button span {
  width: 100%;
  height: 35px;
  opacity: .48;
  background-image: radial-gradient(circle,#71839b 1.25px,transparent 1.5px);
  background-size: 9px 9px;
}

.calendar-year-grid button.active {
  border-color: rgba(143,125,255,.55);
  background: rgba(116,88,255,.13);
  color: #c8beff;
}

.calendar-year-grid button.active span {
  opacity: .8;
  background-image: radial-gradient(circle,#a998ff 1.25px,transparent 1.5px);
}

/* Profile typography matches the readable scale used in Cases and Calendar. */
.profile-card {
  width: 100%;
  min-height: 92px;
  padding: 16px;
  grid-template-columns: 58px 1fr 18px;
  gap: 14px;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}

.profile-avatar {
  width: 58px;
  height: 58px;
  font-size:calc(17px * var(--ui-font-scale, 1));
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-card small {
  display: block;
  margin-top: 5px;
  font-size:calc(13px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.profile-card > b {
  justify-self: end;
  color: #61728a;
  font-size:calc(20px * var(--ui-font-scale, 1));
}

.menu-row,
.toggle-row {
  min-height: 68px;
  padding: 14px 15px;
}

.menu-row {
  grid-template-columns: 38px 1fr 14px;
  gap: 12px;
}

.menu-row > span {
  font-size:calc(20px * var(--ui-font-scale, 1));
}

.profile-menu-icon {
  display: block;
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.profile-templates-icon {
  -webkit-mask-image: url('assets/actions/profile-templates.png');
  mask-image: url('assets/actions/profile-templates.png');
}

.profile-settings-icon {
  -webkit-mask-image: url('assets/actions/profile-settings.png');
  mask-image: url('assets/actions/profile-settings.png');
}

.profile-storage-icon {
  -webkit-mask-image: url('assets/actions/profile-storage.png');
  mask-image: url('assets/actions/profile-storage.png');
}

.profile-delete-icon {
  -webkit-mask-image: url('assets/actions/profile-delete.png');
  mask-image: url('assets/actions/profile-delete.png');
}

.profile-tool-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(116, 88, 255, .2);
  border-radius: 10px;
  background: rgba(116, 88, 255, .12);
  color: #a895ff;
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-style: normal;
  font-weight: 800;
}

.profile-tool-icon.percent {
  border-color: rgba(51, 214, 159, .2);
  background: rgba(51, 214, 159, .1);
  color: var(--green);
  font-size:calc(13px * var(--ui-font-scale, 1));
}

.profile-tools .menu-row:last-child strong {
  font-size:calc(14px * var(--ui-font-scale, 1));
}

.menu-row small,
.toggle-row small {
  display: block;
  margin-top: 4px;
  font-size:calc(12px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.security-note strong {
  font-size:calc(14px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.security-note small {
  margin-top: 5px;
  font-size:calc(12px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

.setting-group-title {
  margin: 24px 3px 11px;
}

.setting-group-title:first-of-type {
  margin-top: 2px;
}

.setting-group-title h3 {
  margin: 0;
  font-size:calc(18px * var(--ui-font-scale, 1));
}

.setting-group-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size:calc(12px * var(--ui-font-scale, 1));
  line-height: 1.45;
}

.preference-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.preference-row {
  width: 100%;
  min-height: 68px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 42px 1fr 20px;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

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

.preference-row > span {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: rgba(116, 88, 255, .13);
  color: #9e8aff;
  font-size:calc(12px * var(--ui-font-scale, 1));
  font-weight: 800;
}

.preference-row strong {
  display: block;
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.preference-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size:calc(12px * var(--ui-font-scale, 1));
}

.preference-row b {
  color: var(--green);
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.preference-row.active {
  background: rgba(116, 88, 255, .055);
}

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

.theme-option {
  position: relative;
  min-width: 0;
  padding: 12px;
  border: 2px solid transparent;
  border-radius: 19px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(116, 88, 255, .16);
}

.theme-option > strong {
  display: block;
  margin-top: 10px;
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.theme-option > small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.theme-option > b {
  position: absolute;
  right: 10px;
  top: 10px;
  color: var(--green);
}

.theme-preview {
  height: 92px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: hidden;
  border-radius: 13px;
}

.dark-preview .theme-preview {
  background: #081425;
}

.light-preview .theme-preview {
  border: 1px solid #dfe4ed;
  background: #f4f6fa;
}

.theme-preview i {
  display: block;
  height: 12px;
  border-radius: 5px;
  background: #1a2b46;
}

.theme-preview i:first-child {
  width: 58%;
}

.theme-preview i:nth-child(2) {
  height: 34px;
  background: #162741;
}

.theme-preview i:nth-child(3) {
  width: 76%;
}

.light-preview .theme-preview i {
  background: #cfd6e2;
}

.light-preview .theme-preview i:nth-child(2) {
  background: #fff;
  box-shadow: 0 2px 8px #bec7d5;
}

html[data-theme="light"] {
  --bg: #f3f5f9;
  --panel: #fff;
  --panel2: #f8fafc;
  --text: #162033;
  --muted: #68758a;
  --accent: #6750e8;
  --red: #e64e61;
  --yellow: #c98b13;
  --green: #15966d;
  --line: rgba(31, 48, 75, .11);
  color-scheme: light;
  background: #e7ebf2;
}

html[data-theme="light"] body {
  background: radial-gradient(circle at 50% -10%, #fff 0, #eef2f7 44%, #e6eaf1 100%);
}

html[data-theme="light"] .menu-row,
html[data-theme="light"] .toggle-row,
html[data-theme="light"] .preference-list,
html[data-theme="light"] .calendar-event,
html[data-theme="light"] .urgent-row,
html[data-theme="light"] .urgent-accordion {
  background: #fff;
}

html[data-theme="light"] .bell-symbol {
  filter: none;
}

html[data-theme="light"] .focus-card {
  border-color: rgba(230, 78, 97, .18);
  background: linear-gradient(145deg, rgba(230, 78, 97, .15), #fff 72%);
}

html[data-theme="light"] .focus-card::after {
  color: rgba(207, 55, 77, .13);
}

html[data-theme="light"] .sheet-backdrop {
  background: rgba(43, 54, 72, .35);
}

html[data-theme="light"] .form input,
html[data-theme="light"] .form select,
html[data-theme="light"] .task-sheet input {
  background: #fff;
}

html[data-theme="light"] .date-pill {
  background: rgba(31, 48, 75, .06);
  color: #56657a;
}

html[data-theme="light"] .risk {
  color: #45556d;
}

html[data-theme="light"] .calendar-view-popover {
  background: rgba(255, 255, 255, .98);
}

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

.storage-summary > div {
  min-width: 0;
  padding: 18px 15px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: linear-gradient(145deg, var(--panel2), var(--panel));
}

.storage-summary span,
.storage-summary small {
  display: block;
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
}

.storage-summary strong {
  display: block;
  margin: 9px 0 6px;
  font-size:calc(31px * var(--ui-font-scale, 1));
  line-height: 1;
}

.storage-summary strong em {
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-style: normal;
}

.storage-breakdown {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.storage-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

.storage-type {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(116, 88, 255, .14);
  position: relative;
}

.storage-type::after {
  content: '';
  position: absolute;
  inset: 11px;
  border: 2px solid #9e8aff;
  border-radius: 3px;
}

.storage-type.photo {
  background: rgba(51, 214, 159, .12);
}

.storage-type.photo::after {
  border-color: var(--green);
  border-radius: 4px 4px 7px 7px;
}

.storage-type.audio {
  background: rgba(245, 185, 66, .12);
}

.storage-type.audio::after {
  left: 15px;
  right: 15px;
  border-color: var(--yellow);
  border-radius: 7px;
}

.storage-row strong {
  display: block;
  font-size:calc(14px * var(--ui-font-scale, 1));
}

.storage-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
}

.storage-row div > i {
  display: block;
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(116, 88, 255, .1);
}

.storage-row div > i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.storage-row > em {
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-style: normal;
  white-space: nowrap;
}

.storage-note {
  display: flex;
  justify-content: center;
  gap: 11px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid rgba(51, 214, 159, .18);
  border-radius: 16px;
  background: rgba(51, 214, 159, .07);
  color: var(--green);
  text-align: center;
}

.storage-note > div {
  width: 100%;
}

.storage-note strong {
  display: block;
  font-size:calc(13px * var(--ui-font-scale, 1));
}

.storage-note small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size:calc(10px * var(--ui-font-scale, 1));
  line-height: 1.45;
}

html[data-theme="light"] .storage-summary > div {
  background: linear-gradient(145deg, #fff, #f7f9fc);
  box-shadow: 0 10px 24px rgba(31, 48, 75, .06);
}

html[data-theme="light"] .storage-breakdown {
  background: #fff;
}

.calendar .days button.has-event::after,
.calendar-week-strip button.has-event::after {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 2px rgba(245, 185, 66, .14);
}

.calendar .days button.has-event::after {
  bottom: 1px;
}

.calendar-week-strip button.has-event::after {
  bottom: 5px;
}

html[data-theme="light"] .calendar .days button.has-event::after,
html[data-theme="light"] .calendar-week-strip button.has-event::after {
  box-shadow: 0 0 0 2px rgba(201, 139, 19, .16);
}

.note-form textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 16px;
  padding: 14px;
  background: var(--panel);
  color: var(--text);
  font:inherit;
  font-size:calc(14px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

.note-text-wrap {
  position: relative;
}

.note-text-wrap textarea {
  padding-right: 62px;
  padding-bottom: 58px;
}

.note-voice-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: rgba(51, 214, 159, .14);
  color: var(--green);
  box-shadow: 0 7px 18px rgba(21, 150, 109, .12);
}

.note-voice-button::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 2px;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: currentColor;
}

.note-voice-button.listening {
  color: white;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(255, 92, 108, .11);
  animation: voicePulse 1s infinite;
}

.note-voice-status {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: -6px;
  color: var(--muted);
  font-size:calc(10px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.note-voice-status i {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.note-voice-status.active i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 92, 108, .09);
}

.note-form textarea::placeholder {
  color: var(--muted);
}

.note-case-hint {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgba(116, 88, 255, .17);
  border-radius: 15px;
  background: rgba(116, 88, 255, .08);
  color: #a895ff;
}

.note-case-hint p {
  margin: 0;
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

html[data-theme="light"] .note-form textarea {
  background: #fff;
}

.note-case-picker {
  position: relative;
}

.note-case-label {
  display: block;
  margin-bottom: 7px;
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 600;
}

.note-case-search {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: center;
  margin-top: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.note-case-search > span {
  color: var(--muted);
  font-size:calc(19px * var(--ui-font-scale, 1));
}

.note-case-search input {
  width: 100%;
  min-height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
}

.note-case-search button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--text);
  font-size:calc(21px * var(--ui-font-scale, 1));
  font-weight: 400;
  line-height: 1;
  transition: transform .16s ease;
}

.note-case-search button[aria-expanded="true"] {
  transform: rotate(180deg);
}

.note-selected-case {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 11px 13px;
  border: 1px solid rgba(116, 88, 255, .2);
  border-radius: 14px;
  background: rgba(116, 88, 255, .08);
}

.note-selected-case small {
  grid-column: 1 / -1;
  color: #a895ff;
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
}

.note-selected-case strong {
  font-size:calc(12px * var(--ui-font-scale, 1));
}

.note-selected-case span {
  color: var(--muted);
  font-size:calc(10px * var(--ui-font-scale, 1));
}

.note-case-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: none;
  gap: 7px;
  max-height: 238px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 18px 38px rgba(0, 0, 0, .28);
}

.note-case-results.open {
  display: grid;
}

.note-case-result {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 14px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.note-case-result > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(116, 88, 255, .13);
  color: #a895ff;
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 800;
}

.note-case-result strong,
.note-case-result small {
  display: block;
}

.note-case-result strong {
  font-size:calc(12px * var(--ui-font-scale, 1));
}

.note-case-result small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-case-result > b {
  color: var(--muted);
  font-size:calc(14px * var(--ui-font-scale, 1));
}

.note-case-result.selected {
  border-color: rgba(116, 88, 255, .35);
}

.note-case-result.selected > b {
  color: var(--green);
}

html[data-theme="light"] .note-case-search,
html[data-theme="light"] .note-case-result,
html[data-theme="light"] .note-case-results {
  background: #fff;
}

.profile-edit-form {
  padding-bottom: 18px;
}

.profile-edit-form > button.primary.full[type="submit"] {
  width: auto;
  max-width: 100%;
  justify-self: center;
  min-height: 44px;
  padding-inline: 24px;
}

body.profile-route #app > .profile-logout {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding-inline: 24px;
}

.profile-photo-editor {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 15px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--panel);
}

.profile-avatar-edit {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  font-size:calc(20px * var(--ui-font-scale, 1));
}

.profile-photo-editor strong {
  display: block;
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.profile-photo-editor small {
  display: block;
  margin: 5px 0 10px;
  color: var(--muted);
  font-size:calc(10px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.profile-photo-pick {
  display: inline-flex !important;
  width: fit-content;
  padding: 8px 11px;
  border-radius: 11px;
  background: rgba(116, 88, 255, .13);
  color: #a895ff !important;
  font-size: var(--text-xs) !important; /* было 10 px — дизайн-основа, 24.09.2026 */
  font-weight: 700;
  cursor: pointer;
}

html[data-theme="light"] .profile-photo-editor {
  background: #fff;
}

.case-type-intro {
  margin: -5px 2px 16px;
  color: var(--muted);
  font-size:calc(12px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

.case-type-list {
  display: grid;
  gap: 10px;
}

.case-type-option {
  width: 100%;
  min-height: 82px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 14px;
  gap: 13px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  transition: transform .16s ease, border-color .16s ease;
}

.case-type-option:active {
  transform: scale(.98);
}

.case-type-option > span,
.case-type-current > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(116, 88, 255, .14);
  color: #a895ff;
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 800;
  letter-spacing: .03em;
}

.case-type-option.civil > span { background: rgba(48, 195, 124, .13); color: var(--green); }
.case-type-option.arbitration > span { background: rgba(77, 143, 255, .13); color: #6da0ff; }
.case-type-option.administrative > span { background: rgba(255, 179, 71, .13); color: #f1a73e; }

.case-type-option strong,
.case-type-current strong {
  display: block;
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.case-type-option small,
.case-type-current small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size:calc(10px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.case-type-option > b {
  color: #61728a;
  font-size:calc(19px * var(--ui-font-scale, 1));
  font-weight: 500;
}

.case-type-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
}

.case-type-current button {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(116, 88, 255, .12);
  color: #a895ff;
  font-size:calc(10px * var(--ui-font-scale, 1));
  font-weight: 700;
}

.case-create-submit {
  display:flex;
  align-items:center;
  justify-content:center;
  justify-self:center;
  width:fit-content;
  max-width:100%;
  min-height:44px;
  margin-inline:auto;
  padding:10px 20px;
  line-height:1.2;
  text-align:center;
}

.case-icon-picker-options {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  padding-top:14px;
}
.case-icon-picker-option {
  display:flex;
  min-width:0;
  min-height:88px;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--panel);
  color:var(--text);
  font-size:calc(11px * var(--ui-font-scale, 1));
  text-align:center;
}
.case-icon-picker-option img { width:48px; height:48px; object-fit:contain; }
.case-icon-picker-option.selected {
  border-color:color-mix(in srgb,var(--accent) 62%,transparent);
  background:color-mix(in srgb,var(--accent) 12%,var(--panel));
}
.case-icon-picker-sheet > header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.case-icon-picker-sheet > header h2 { margin:0; }
.case-icon-picker-sheet > header button { flex:0 0 auto; }

html[data-theme="light"] .case-type-option,
html[data-theme="light"] .case-type-current {
  background: #fff;
}

.document-case-option > span {
  background: rgba(116, 88, 255, .14);
  color: #a895ff;
}

.upload-case-current {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
}

.upload-case-current > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(116, 88, 255, .14);
  color: #a895ff;
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 800;
  text-transform: uppercase;
}

.upload-case-current small,
.upload-case-current strong,
.upload-case-current em {
  display: block;
}

.upload-case-current small,
.upload-case-current em {
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-style: normal;
}

.upload-case-current strong {
  margin: 3px 0;
  font-size:calc(13px * var(--ui-font-scale, 1));
}

.upload-case-current > button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  font-size:0;
  display: grid;
  place-items: center;
}

.upload-case-current > button::after {
  content: '⌄';
  font-size:calc(26px * var(--ui-font-scale, 1));
  font-weight: 400;
  line-height: 1;
  transform: translateY(-2px);
}

.upload-case-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 45;
  max-height: min(300px, 52vh);
  padding: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #0d1a2d;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .46);
  -webkit-overflow-scrolling: touch;
}

.upload-case-dropdown button {
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.upload-case-dropdown button + button {
  border-top: 1px solid var(--line);
}

.upload-case-dropdown button.active {
  background: rgba(116, 88, 255, .12);
}

.upload-case-dropdown button > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(116, 88, 255, .14);
  color: #a895ff;
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 800;
}

.upload-case-dropdown strong,
.upload-case-dropdown small {
  display: block;
}

.upload-case-dropdown strong {
  margin: 0 0 4px;
  font-size:calc(12px * var(--ui-font-scale, 1));
}

.upload-case-dropdown small {
  overflow: hidden;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-case-dropdown b {
  color: var(--green);
  text-align: center;
}

html[data-theme="light"] .upload-case-current {
  background: #fff;
}

html[data-theme="light"] .upload-case-dropdown {
  background: #fff;
  box-shadow: 0 20px 42px rgba(33, 45, 67, .18);
}

.case-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 5px;
}

.case-card-labels .card-label {
  margin: 0;
}

.case-kind-badge {
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(116, 88, 255, .12);
  color: #a895ff;
  font-size:calc(8px * var(--ui-font-scale, 1));
  font-weight: 750;
  letter-spacing: .02em;
  white-space: nowrap;
}

.case-kind-badge.civil {
  background: rgba(51, 214, 159, .1);
  color: var(--green);
}

.case-stage-preview {
  display: block;
  margin: 0 0 13px;
  color: #9aabc0;
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.case-section-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -6px 0 13px;
}

.case-section-badges span {
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(116, 88, 255, .09);
  color: #a895ff;
  font-size:calc(8px * var(--ui-font-scale, 1));
  font-weight: 700;
}

.case-section-badges span.urgent {
  background: rgba(255, 92, 108, .1);
  color: var(--red);
}

.case-sections-editor {
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
}

.case-sections-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.case-sections-head small,
.case-sections-head strong {
  display: block;
}

.case-sections-head small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
}

.case-sections-head strong {
  font-size:calc(13px * var(--ui-font-scale, 1));
}

.case-sections-head > span {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(116, 88, 255, .12);
  color: #a895ff;
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 800;
}

.case-sections-editor > p {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  line-height: 1.45;
}

.case-section-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.case-section-option {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 5px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 700;
  cursor: pointer;
}

.case-section-option input {
  display: none;
}

.case-section-option b {
  display: none;
  color: var(--green);
}

.case-section-option.active {
  border-color: rgba(116, 88, 255, .34);
  background: rgba(116, 88, 255, .11);
  color: #b7aaff;
}

.case-section-option.active b {
  display: inline;
}

html[data-theme="light"] .case-sections-editor {
  background: #fff;
}

.summary-lead > div strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-edit {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 8px 10px;
  border: 1px solid rgba(116, 88, 255, .24);
  border-radius: 10px;
  background: rgba(116, 88, 255, .1);
  color: #aa9cff;
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 750;
}

.summary-grid {
  gap: 9px;
  padding-top: 12px;
}

.summary-field {
  min-width: 0;
  min-height: 61px;
  padding: 10px 11px;
  border: 1px solid rgba(143, 125, 255, .2);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(23, 41, 66, .88), rgba(16, 30, 51, .88));
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

.summary-field small {
  margin-bottom: 7px;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
}

.summary-field span {
  display: block;
  overflow: hidden;
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-field.empty span {
  color: #7f91aa;
  font-weight: 500;
}

.summary-field:active {
  transform: scale(.98);
}

.case-edit-form {
  padding-bottom: 20px;
}

.criminal-stage-fields {
  display: contents;
}

.case-edit-form input[type="date"] {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  min-height: 50px;
  height: 50px;
  padding: 14px;
  border-width: 1px;
  border-radius: 14px;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 400;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
}

.case-edit-form input[type="date"]::-webkit-date-and-time-value {
  min-height: 20px;
  text-align: left;
}

.case-edit-form input[type="date"]::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

.doc-icon::before,
.search-result-icon.doc::before {
  content: '';
  display: block;
  width: 25px;
  height: 25px;
  background: #a895ff;
  -webkit-mask: url('assets/actions/document.png?v=2') center / contain no-repeat;
  mask: url('assets/actions/document.png?v=2') center / contain no-repeat;
}

.search-result-icon.doc::before {
  width: 21px;
  height: 21px;
}

.case-tabs {
  gap: 8px;
  scroll-behavior: auto;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: none;
  user-select: none;
}

.case-tabs button {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(143, 125, 255, .22);
  border-radius: 14px;
  background: rgba(20, 35, 58, .82);
  color: var(--muted);
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-weight: 650;
  cursor: grab;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}

.case-tabs button.case-tab-pressing {
  transform: scale(.97);
  opacity: .82;
}

.case-tab-placeholder {
  flex: 0 0 auto;
  min-height: 46px;
  border-radius: 12px;
  background: rgba(116, 88, 255, .09);
}

.case-tabs button.case-tab-dragging {
  border: 1px solid rgba(143, 125, 255, .34);
  border-radius: 13px;
  background: var(--panel);
  color: #b7a9ff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .36);
  cursor: grabbing;
  transition: transform 45ms linear, box-shadow .16s ease;
}

.case-tabs-reorder-mode {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

html[data-theme="light"] .case-tabs button {
  background: #fff;
}

html[data-theme="light"] .summary-field {
  border-color: rgba(116, 88, 255, .15);
  background: #f7f8fb;
  box-shadow: none;
}

.client-avatar,
.case-client-avatar {
  overflow: hidden;
}

.client-avatar img,
.case-client-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.case-client-photo-editor {
  margin-bottom: 2px;
}

.document-upload-settings {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
}

.document-upload-settings label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size:calc(10px * var(--ui-font-scale, 1));
}

.document-upload-settings input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(143, 125, 255, .22);
  border-radius: 14px;
  outline: 0;
  background: rgba(8, 20, 37, .7);
  color: var(--text);
  font-size:calc(13px * var(--ui-font-scale, 1));
}

.document-upload-settings > div {
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(116, 88, 255, .08);
}

.document-upload-settings strong {
  display: block;
  font-size:calc(11px * var(--ui-font-scale, 1));
}

.document-upload-settings p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  line-height: 1.5;
}

.volume-upload-zone {
  padding: 28px 17px;
}

.upload-file-picker,
.upload-start {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  margin: 0 3px;
  cursor: pointer;
}

.document-file-info {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  gap: 9px;
  align-items: center;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid rgba(51, 214, 159, .18);
  border-radius: 13px;
  background: rgba(51, 214, 159, .07);
  text-align: left;
}

.document-file-info > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 92, 108, .12);
  color: var(--red);
  font-size:calc(9px * var(--ui-font-scale, 1));
  font-weight: 800;
}

.document-file-info strong,
.document-file-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-file-info strong {
  font-size:calc(10px * var(--ui-font-scale, 1));
}

.document-file-info small {
  margin-top: 4px;
  color: var(--muted);
  font-size:calc(8px * var(--ui-font-scale, 1));
}

.document-file-info > b {
  color: var(--green);
}

.upload-start {
  margin-top: 11px;
}

.upload-cancel {
  min-height: 40px;
  margin: 11px 3px 0;
  padding: 0 16px;
  border: 1px solid rgba(255, 92, 108, .42);
  border-radius: 12px;
  background: rgba(255, 92, 108, .12);
  color: var(--red);
  font-weight: 800;
}

.upload-cancel:disabled { opacity: .68; }

.document-viewer-open { overflow:hidden; }
.document-viewer-layer {
  position:fixed;
  z-index:1000;
  inset:0;
  width:100%;
  height:100dvh;
  background:var(--bg, #081425);
  overflow:hidden;
}
.document-viewer-frame {
  display:block;
  width:100%;
  height:100%;
  border:0;
  background:#fff;
}
.document-viewer-close {
  position:absolute;
  z-index:2;
  top:max(10px, calc(env(safe-area-inset-top) + 8px));
  left:max(10px, calc(env(safe-area-inset-left) + 10px));
  min-width:48px;
  height:48px;
  padding:0;
  border:0;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:transparent;
  color:inherit;
  box-shadow:none;
  touch-action:manipulation;
}
.document-viewer-close span { font-size:calc(26px * var(--ui-font-scale, 1)); line-height:1; }
.document-viewer-layer.pdf-page-focus .document-viewer-close {
  width:48px;
  min-width:48px;
  padding:0;
  justify-content:center;
  border-radius:14px;
}
.document-viewer-layer.pdf-page-focus .document-viewer-close span {
  font-size:calc(26px * var(--ui-font-scale, 1));
  transform:none;
}

.upload-start[hidden] {
  display: none;
}

.upload-zone > span {
  display: none;
}

.processing-material-type {
  display: inline-block;
  margin-bottom: 5px;
  padding: 5px 8px;
  border-radius: 9px;
  background: rgba(116, 88, 255, .1);
  color: #aa9cff;
  font-size:calc(8px * var(--ui-font-scale, 1));
  font-weight: 700;
}

html[data-theme="light"] .document-upload-settings {
  background: #fff;
}

html[data-theme="light"] .document-upload-settings input {
  background: #f7f8fb;
}

/* User-supplied electronic-brain mark for assistant features. */
.ai-card::after {
  content: '';
  right: 6px;
  bottom: -19px;
  width: 94px;
  height: 94px;
  background: rgba(255, 255, 255, .06);
  -webkit-mask: url('assets/actions/ai-brain.png') center/contain no-repeat;
  mask: url('assets/actions/ai-brain.png') center/contain no-repeat;
}

.ai-brain-mark::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 22px;
  background: currentColor;
  vertical-align: middle;
  -webkit-mask: url('assets/actions/ai-brain.png') center/contain no-repeat;
  mask: url('assets/actions/ai-brain.png') center/contain no-repeat;
}

.ai-orb.ai-brain-mark::before,
.chat-intro > .ai-brain-mark::before {
  width: 27px;
  height: 27px;
}

.ai-card .ai-orb {
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-weight: 800;
  letter-spacing: -.02em;
}

.calendar .days button.selected,
.calendar-week-strip button.selected {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 7px 18px rgba(116, 88, 255, .3);
}

.calendar .days button.selected.has-event::after,
.calendar-week-strip button.selected.has-event::after {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .22);
}

.calendar-empty {
  display: grid;
  gap: 6px;
  padding: 22px 18px;
  text-align: center;
  border-radius: 18px;
  background: var(--panel);
  color: var(--muted);
}

.calendar-empty strong {
  color: var(--text);
  font-size:calc(15px * var(--ui-font-scale, 1));
}

/* Keep the mobile prototype geometry even in a wide browser window. */
@media (min-width: 700px) {
  :root {
    --mobile-nav-height: 86px;
  }

  body {
    width: 100%;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    overflow: hidden;
  }

  .screen {
    height: calc(100dvh - var(--mobile-nav-height));
    min-height: 0;
    padding-bottom: 28px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
  }

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

  .home-route .screen {
    padding-bottom: 92px;
  }

  .detail .screen {
    height: 100dvh;
    padding-bottom: 42px;
  }

  .tabbar {
    bottom: 0;
    height: var(--mobile-nav-height);
    border-radius: 0;
    background: #081425;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  .home-route .home-ai-search {
    bottom: calc(var(--mobile-nav-height) + 12px);
  }

  .calendar-voice-fab {
    bottom: calc(var(--mobile-nav-height) + 18px);
  }

  .toast {
    bottom: calc(var(--mobile-nav-height) + 10px);
  }

  html[data-theme="light"] .tabbar {
    background: #f8fafd;
    box-shadow: none;
  }
}

.assistant-fab.ai-brain-mark::before {
  margin-right: 7px;
}

.message.ai > .ai-brain-mark::before,
.notice > .ai-brain-mark::before {
  width: 19px;
  height: 19px;
}

/* Keep navigation and page details available while long pages scroll. */
:root {
  --detail-top-inset: 26px;
}

@media (max-width: 430px) {
  :root {
    --detail-top-inset: max(20px, calc(env(safe-area-inset-top) + 10px));
  }
}

  .detail .screen {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .detail .page-head,
  .case-sticky-head {
    position: sticky;
    top: 0;
    z-index: 55;
    margin: calc(0px - var(--detail-top-inset)) -18px 18px;
    padding: var(--detail-top-inset) 18px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .14);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .case-sticky-head {
    z-index: 56;
  }

  .case-sticky-head .page-head {
    position: static;
    margin: 0;
    padding: 0 0 9px;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .case-sticky-head .case-identity {
    margin: 0 2px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
  }

  html[data-theme="light"] .detail .page-head,
  html[data-theme="light"] .case-sticky-head {
    background: var(--bg);
    box-shadow: 0 10px 24px rgba(34, 48, 72, .08);
  }

  html[data-theme="light"] .case-sticky-head .page-head {
    background: transparent;
    box-shadow: none;
  }

  .detail .page-head,
  .case-sticky-head,
  html[data-theme="light"] .detail .page-head,
  html[data-theme="light"] .case-sticky-head {
    border-bottom: 0;
    box-shadow: none;
  }

  .case-sticky-head .case-identity {
    border-top: 0;
  }

/* Shared mobile typography for list rows and secondary screens. */
@media (max-width: 699px), (max-height: 699px) and (orientation: landscape) and (pointer: coarse) {
  .notification {
    min-height: 88px;
    gap: 14px;
    padding: 17px 2px;
  }

  .notification p,
  .calendar-event small,
  .history-item p,
  .urgent-panel > p {
    font-size:calc(13px * var(--ui-font-scale, 1));
    line-height: 1.45;
  }

  .notification small,
  .history-item time,
  .urgent-panel > div span {
    font-size:calc(11px * var(--ui-font-scale, 1));
  }

  .case-card-labels {
    display: grid;
    justify-items: start;
    gap: 6px;
    margin-bottom: 9px;
  }

  .case-stage-preview {
    font-size:calc(12px * var(--ui-font-scale, 1));
  }
}

/* Case header is a true fixed layer, independent from the scrolling surface. */
#app:has(> .case-sticky-head) {
  padding-top: 0;
}

.case-sticky-head {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 70;
  width: min(100%, 480px);
  margin: 0;
  padding: var(--detail-top-inset) 18px 12px;
  transform: translateX(-50%);
  background: var(--bg);
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.case-sticky-spacer {
  width: 100%;
  min-height: 0;
  pointer-events: none;
}

/* iPhone-style calendar event form. */
.calendar-event-form {
  display: block;
  padding-top: 10px;
  background: #101e32;
}

.calendar-event-form-head {
  display: grid;
  grid-template-columns: 78px 1fr 78px;
  align-items: center;
  margin-bottom: 18px;
}

.calendar-event-form-head h2 {
  margin: 0;
  text-align: center;
  font-size:calc(16px * var(--ui-font-scale, 1));
}

.calendar-event-form-head button:first-child { text-align: left; }
.calendar-event-form-head button:last-child { text-align: right; }

.calendar-title-field :is(input,textarea) {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size:calc(19px * var(--ui-font-scale, 1));
  font-weight: 650;
  resize: none;
  overflow: hidden;
  font-family: inherit;
}

.calendar-note-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.calendar-note-field > span small {
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 500;
  opacity: .72;
}

.calendar-note-field textarea {
  width: 100%;
  min-height: 78px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  font-family: inherit;
  font-size:calc(15px * var(--ui-font-scale, 1));
  line-height: 1.4;
}

.calendar-note-field textarea:focus {
  border-color: rgba(155, 135, 255, .48);
  box-shadow: 0 0 0 3px rgba(139, 112, 255, .08);
}

.calendar-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 66px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.calendar-time-range {
  display: grid;
  grid-template-columns: auto auto auto auto;
  align-items: baseline;
  justify-content: end;
  gap: 7px;
}

.calendar-time-range > em {
  color: var(--muted);
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-style: normal;
  line-height: 1.15;
  transform: translateY(-1px);
}

.calendar-time-range .calendar-picker-control {
  align-items: baseline;
}

.calendar-time-range.all-day-range > em,
.calendar-time-range.all-day-range > .calendar-picker-control:last-child {
  display: none;
}

.calendar-form-row input,
.calendar-form-row select {
  max-width: 210px;
  min-height: 42px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: #aa9cff;
  font-family: inherit;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: -.01em;
  text-align: right;
  -webkit-tap-highlight-color: transparent;
  transition: color .16s ease, font-size .16s ease, transform .16s ease;
}

.calendar-form-row input:focus,
.calendar-form-row input:focus-visible,
.calendar-form-row select:focus,
.calendar-form-row select:focus-visible {
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.calendar-form-row input::-webkit-datetime-edit {
  padding: 0;
  color: #aa9cff;
}

.calendar-form-row input::-webkit-calendar-picker-indicator {
  margin-left: 7px;
  opacity: .7;
}

.calendar-form-row input::-webkit-datetime-edit-day-field:focus,
.calendar-form-row input::-webkit-datetime-edit-month-field:focus,
.calendar-form-row input::-webkit-datetime-edit-year-field:focus,
.calendar-form-row input::-webkit-datetime-edit-hour-field:focus,
.calendar-form-row input::-webkit-datetime-edit-minute-field:focus,
.calendar-form-row input::-webkit-datetime-edit-second-field:focus,
.calendar-form-row input::-webkit-datetime-edit-ampm-field:focus {
  padding: 0 2px;
  border: 0;
  outline: 0;
  border-radius: 0;
  background: transparent;
  color: #6f56d2;
  font-size:calc(20px * var(--ui-font-scale, 1));
  font-weight: 850;
  animation: calendar-segment-pop .18s ease-out;
}

@keyframes calendar-segment-pop {
  from { font-size:calc(16px * var(--ui-font-scale, 1)); opacity: .72; }
  to { font-size:calc(20px * var(--ui-font-scale, 1)); opacity: 1; }
}

.calendar-form-row select:focus {
  color: #6f56d2;
  font-size:calc(18px * var(--ui-font-scale, 1));
  transform: scale(1.05);
  transform-origin: right center;
}

.calendar-alert-row > span {
  display: grid;
  gap: 3px;
}
.calendar-alert-row small { color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }

.calendar-case-row > span {
  display: grid;
  gap: 3px;
}
.calendar-case-row small { color: var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); }
.calendar-case-row select {
  width: min(220px, 56vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-calendar-events {
  display: grid;
  gap: 8px;
}

.case-calendar-events > button {
  width: 100%;
  min-height: 68px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 38px 3px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 17px;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  color: var(--text);
  text-align: left;
}

.case-calendar-events time {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.case-calendar-events time b { font-size:calc(17px * var(--ui-font-scale, 1)); }
.case-calendar-events time small { margin-top: 4px; color: var(--muted); font-size:calc(10px * var(--ui-font-scale, 1)); text-transform: uppercase; }
.case-calendar-events .accent-line { width: 3px; height: 38px; border-radius: 4px; }
.case-calendar-events div { min-width: 0; display: grid; gap: 5px; }
.case-calendar-events div strong { overflow: hidden; font-size:calc(14px * var(--ui-font-scale, 1)); text-overflow: ellipsis; white-space: nowrap; }
.case-calendar-events div small { overflow: hidden; color: var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); text-overflow: ellipsis; white-space: nowrap; }
.case-calendar-events > button > b { color: var(--muted); font-size:calc(20px * var(--ui-font-scale, 1)); font-weight: 400; }

html[data-theme="light"] .calendar-form-row input,
html[data-theme="light"] .calendar-form-row select {
  background: transparent;
  color: #6750e8;
}

html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit {
  color: #6750e8;
}

html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-day-field:focus,
html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-month-field:focus,
html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-year-field:focus,
html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-hour-field:focus,
html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-minute-field:focus,
html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-second-field:focus,
html[data-theme="light"] .calendar-form-row input::-webkit-datetime-edit-ampm-field:focus,
html[data-theme="light"] .calendar-form-row select:focus {
  color: #49339f;
}

/* Custom calendar values keep the selected segment visually consistent on iOS. */
.calendar-picker-control {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
}

.calendar-form-row .calendar-picker-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.calendar-picker-display {
  display: inline-flex;
  min-height: 42px;
  padding: 4px 0;
  align-items: baseline;
  justify-content: flex-end;
  gap: 2px;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: #aa9cff;
  font-family: inherit;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
  -webkit-tap-highlight-color: transparent;
}

.calendar-picker-display i {
  color: currentColor;
  font-style: normal;
  opacity: .72;
}

.calendar-picker-display.all-day i,
.calendar-picker-display.all-day [data-picker-part="minute"] {
  display: none;
}

.calendar-picker-display [data-picker-part] {
  display: inline-block;
  padding: 2px 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.calendar-picker-display:focus,
.calendar-picker-display:focus-visible,
.calendar-picker-display:active {
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.ios-date-wheel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(2, 9, 20, .52);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.ios-date-wheel {
  width: min(100%, 430px);
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: #111e31;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .34);
  animation: ios-date-wheel-in .22s cubic-bezier(.22, .75, .28, 1);
}

@keyframes ios-date-wheel-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.ios-date-wheel header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 50px;
  align-items: center;
  gap: 10px;
}

.ios-date-wheel header strong {
  color: var(--text);
  font-size:calc(16px * var(--ui-font-scale, 1));
  text-align: center;
}

.ios-date-wheel header button {
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: #a99aff;
  font-family: inherit;
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-weight: 700;
  line-height: 1;
}

.ios-date-wheel header button:last-child {
  text-align: right;
}

.ios-date-wheel header button:first-child {
  text-align: left;
}

.ios-wheel-manual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: max-content;
  max-width: 100%;
  margin: 2px auto 8px;
  padding: 5px 7px;
  border: 1px solid rgba(151, 132, 255, .18);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}

.ios-wheel-manual span { color: var(--muted); font-size:calc(30px * var(--ui-font-scale, 1)); font-weight: 750; line-height: 1; }

.ios-wheel-manual input {
  width: 58px;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size:calc(40px * var(--ui-font-scale, 1));
  font-weight: 750;
  line-height: 1.05;
  text-align: center;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

.ios-wheel-manual input.year { width: 108px; }

.ios-wheel-manual-time { min-width: 164px; }
.ios-wheel-manual-date { min-width: 246px; }

.ios-wheel-manual input:focus { color: #fff; }

.ios-date-wheel-columns {
  position: relative;
  display: grid;
  grid-template-columns: .72fr 1.55fr .9fr;
  height: 220px;
  overflow: hidden;
}

.ios-time-wheel .ios-date-wheel-columns {
  grid-template-columns: 1fr 1fr;
  padding: 0 48px;
}

.ios-time-wheel .ios-date-wheel-columns::after {
  content: ":";
  position: absolute;
  z-index: 3;
  top: 88px;
  left: 50%;
  height: 44px;
  color: var(--text);
  font-size:calc(21px * var(--ui-font-scale, 1));
  font-weight: 800;
  line-height: 44px;
  transform: translateX(-50%);
  pointer-events: none;
}

.ios-alert-wheel .ios-date-wheel-columns {
  grid-template-columns: 1fr;
  padding: 0 34px;
}

.ios-alert-wheel .ios-date-wheel-option {
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.ios-alert-wheel .ios-date-wheel-option.selected {
  font-size:calc(20px * var(--ui-font-scale, 1));
}

.ios-date-wheel-selection {
  position: absolute;
  z-index: 0;
  top: 88px;
  right: 0;
  left: 0;
  height: 44px;
  border-top: 1px solid rgba(151, 132, 255, .28);
  border-bottom: 1px solid rgba(151, 132, 255, .28);
  pointer-events: none;
}

.ios-date-wheel-column {
  position: relative;
  z-index: 1;
  height: 220px;
  padding: 88px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 25%, #000 75%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 25%, #000 75%, transparent 100%);
}

.ios-date-wheel-column::-webkit-scrollbar {
  display: none;
}

.ios-date-wheel-option {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: #71809a;
  font-family: inherit;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 600;
  line-height: 44px;
  text-align: center;
  scroll-snap-align: center;
  transition: color .06s ease, font-size .06s ease, font-weight .06s ease, transform .06s ease;
}

.ios-date-wheel-option.selected {
  color: #f4f7ff;
  font-size:calc(21px * var(--ui-font-scale, 1));
  font-weight: 800;
  transform: scale(1.06);
}

/* Larger values in the event form pickers: date, time and reminder. */
.calendar-event-backdrop .ios-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-columns {
  height: 320px;
}

.calendar-event-backdrop .ios-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-column {
  height: 320px;
  padding-top: 128px;
  padding-bottom: 128px;
}

.calendar-event-backdrop .ios-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-selection {
  top: 128px;
  height: 64px;
}

.calendar-event-backdrop .ios-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-option {
  height: 64px;
  font-size:clamp(calc(19px * var(--ui-font-scale, 1)), calc(5.6vw * var(--ui-font-scale, 1)), calc(22px * var(--ui-font-scale, 1)));
  line-height: 64px;
}

.calendar-event-backdrop .ios-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-option.selected {
  font-size:clamp(calc(24px * var(--ui-font-scale, 1)), calc(7.1vw * var(--ui-font-scale, 1)), calc(28px * var(--ui-font-scale, 1)));
}

.calendar-event-backdrop .ios-time-wheel .ios-date-wheel-option {
  font-size:clamp(calc(26px * var(--ui-font-scale, 1)), calc(7.6vw * var(--ui-font-scale, 1)), calc(30px * var(--ui-font-scale, 1)));
}

.calendar-event-backdrop .ios-time-wheel .ios-date-wheel-option.selected {
  font-size:clamp(calc(32px * var(--ui-font-scale, 1)), calc(9.7vw * var(--ui-font-scale, 1)), calc(38px * var(--ui-font-scale, 1)));
}

.calendar-event-backdrop .ios-time-wheel .ios-date-wheel-columns::after {
  top: 128px;
  height: 64px;
  font-size:calc(42px * var(--ui-font-scale, 1));
  line-height: 64px;
}

.calendar-event-backdrop .ios-alert-wheel .ios-date-wheel-option {
  font-size:clamp(calc(19px * var(--ui-font-scale, 1)), calc(5.6vw * var(--ui-font-scale, 1)), calc(22px * var(--ui-font-scale, 1)));
}

.calendar-event-backdrop .ios-alert-wheel .ios-date-wheel-option.selected {
  font-size:clamp(calc(24px * var(--ui-font-scale, 1)), calc(7.1vw * var(--ui-font-scale, 1)), calc(28px * var(--ui-font-scale, 1)));
}

html[data-theme="light"] .ios-date-wheel-backdrop {
  background: rgba(30, 35, 46, .28);
}

html[data-theme="light"] .ios-date-wheel {
  background: #f8f9fc;
  box-shadow: 0 -18px 50px rgba(31, 35, 48, .16);
}

html[data-theme="light"] .ios-date-wheel-option {
  color: #8a8f9c;
}

html[data-theme="light"] .ios-date-wheel-option.selected {
  color: #171b25;
}

.calendar-event {
  grid-template-columns: 84px 3px 1fr 10px;
}

.calendar-event time {
  white-space: nowrap;
}

.calendar-add-event {
  width: 100%;
  min-height: 54px;
  margin: 10px 0 15px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(146, 125, 255, .28);
  border-radius: 17px;
  background: rgba(118, 91, 231, .09);
  color: #aa9cff;
  font-family: inherit;
}

.calendar-add-event span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  background: rgba(136, 109, 255, .16);
  font-size:calc(20px * var(--ui-font-scale, 1));
  font-weight: 500;
  line-height: 1;
}

.calendar-add-event:active {
  transform: scale(.985);
}

/* Unified productivity layer */
.case-picker-hero {
  margin: 8px 0 14px;
}

.case-picker-hero h2 {
  margin: 0 0 5px;
  font-size:calc(20px * var(--ui-font-scale, 1));
}

.case-picker-hero p,
.notification-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-size:calc(14px * var(--ui-font-scale, 1));
  line-height: 1.45;
}

.universal-input {
  min-height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 17px;
  background: rgba(255,255,255,.055);
  box-shadow: inset 0 0 0 1px rgba(148,163,190,.16);
}

.universal-input > span {
  color: #9a8cff;
  font-size:calc(23px * var(--ui-font-scale, 1));
}

.universal-input input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font:650 calc(16px * var(--ui-font-scale, 1))/1.2 inherit;
}

.universal-input button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size:calc(25px * var(--ui-font-scale, 1));
}

.picker-list,
.global-search-results,
.smart-notifications {
  display: grid;
  gap: 10px;
}

.unified-case-result,
.search-result {
  width: 100%;
  min-height: 74px;
  padding: 13px;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 15px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  color: var(--text);
  text-align: left;
  font-family: inherit;
}

.unified-case-result > span,
.search-result-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: rgba(124,94,236,.17);
  color: #ae9eff;
  font-weight: 850;
  font-style: normal;
}

.unified-case-result div,
.search-result div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.unified-case-result strong,
.search-result strong {
  overflow: hidden;
  font-size:calc(16px * var(--ui-font-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-case-result small,
.unified-case-result em,
.search-result small {
  overflow: hidden;
  color: var(--muted);
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-case-result > b,
.search-result > b {
  color: var(--muted);
  font-size:calc(21px * var(--ui-font-scale, 1));
}

.global-search-entry {
  width: 100%;
  margin: 2px 0 12px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 12px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 17px;
  background: rgba(127,102,240,.09);
  color: var(--text);
  text-align: left;
}

.global-search-entry > span {
  color: #a997ff;
  font-size:calc(27px * var(--ui-font-scale, 1));
  text-align: center;
}

.global-search-entry div { display:grid; gap:2px; }
.global-search-entry strong { font-size:calc(15px * var(--ui-font-scale, 1)); }
.global-search-entry small { overflow:hidden; color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); text-overflow:ellipsis; white-space:nowrap; }
.global-search-entry > b { color:var(--muted); }
.global-search-field { margin: 8px 0 10px; }

.search-scope {
  margin-bottom: 14px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.search-scope span {
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  font-size:calc(12px * var(--ui-font-scale, 1));
  white-space: nowrap;
}

.global-search-results section { display:grid; gap:8px; }
.global-search-results section + section { margin-top:12px; }
.global-search-results h3 { margin:3px 2px 2px; font-size:calc(15px * var(--ui-font-scale, 1)); }
.global-search-results h3 span { margin-left:5px; color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }
.search-result-icon.doc { background:rgba(68,178,255,.14); color:#7ccaff; }
.search-result-icon.note { background:rgba(255,190,73,.14); color:#ffc65c; }
.search-result-icon.chat { background:rgba(65,210,151,.14); color:#5ee2aa; font-size:calc(11px * var(--ui-font-scale, 1)); }

.workflow-badge {
  padding: 4px 7px;
  border-radius: 8px;
  font-size:calc(10px * var(--ui-font-scale, 1));
  font-weight: 800;
  letter-spacing: .01em;
}

.workflow-badge.attention { background:rgba(255,83,105,.13); color:#ff8395; }
.workflow-badge.analysis { background:rgba(255,185,61,.13); color:#ffc55f; }
.workflow-badge.new { background:rgba(84,203,255,.13); color:#70d2ff; }
.workflow-badge.clear { background:rgba(70,209,151,.12); color:#68dca9; }

.smart-notification {
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
}

.notification-main {
  width: 100%;
  padding: 15px;
  display: grid;
  grid-template-columns: 10px minmax(0,1fr) 18px;
  gap: 12px;
  align-items: start;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.notification-main div { display:grid; gap:5px; }
.notification-main strong { font-size:calc(16px * var(--ui-font-scale, 1)); }
.notification-main p { margin:0; color:var(--text); font-size:calc(15px * var(--ui-font-scale, 1)); line-height:1.35; }
.notification-main small { color:var(--muted); font-size:calc(13px * var(--ui-font-scale, 1)); }
.notification-main > b { color:var(--muted); transition:transform .2s ease; }
.smart-notification.open .notification-main > b { transform:rotate(180deg); }
.notification-actions { max-height:0; padding:0 12px; display:grid; grid-template-columns:1fr 1fr; gap:7px; overflow:hidden; transition:max-height .25s ease,padding .25s ease; }
.smart-notification.open .notification-actions { max-height:130px; padding:0 12px 12px; }
.notification-actions button { min-height:38px; border:0; border-radius:11px; background:rgba(125,99,239,.12); color:#ac9cff; font:750 calc(12px * var(--ui-font-scale, 1))/1 inherit; }

.notification-detail-sheet {
  max-height: calc(100dvh - max(18px, env(safe-area-inset-top)));
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #0b192d 0%, #071426 100%);
}

.notification-detail-sheet .grabber { flex:0 0 auto; margin-bottom:10px; }
.notification-detail-sheet > header { min-height:48px; display:grid; grid-template-columns:44px 1fr 44px; align-items:center; flex:0 0 auto; }
.notification-detail-sheet > header h2 { grid-column:2; margin:0; font-size:calc(20px * var(--ui-font-scale, 1)); text-align:center; }
.notification-detail-sheet > header button { grid-column:3; width:38px; height:38px; border:1px solid rgba(120,110,210,.22); border-radius:13px; background:#10213a; color:#a993ff; font:400 calc(28px * var(--ui-font-scale, 1))/1 inherit; }
.notification-detail-scroll { min-height:0; padding:12px 1px 2px; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.notification-detail-title,
.notification-detail-card,
.notification-detail-note { margin:0 0 12px; border:1px solid rgba(120,110,210,.2); border-radius:20px; background:linear-gradient(145deg,var(--panel2),var(--panel)); }
.notification-detail-title { padding:18px; }
.notification-detail-title small,
.notification-detail-note small { display:block; margin-bottom:8px; color:#a7b1c5; font-size:calc(11px * var(--ui-font-scale, 1)); font-weight:750; letter-spacing:.08em; }
.notification-detail-title strong { display:block; color:var(--text); font-size:calc(21px * var(--ui-font-scale, 1)); line-height:1.25; overflow-wrap:anywhere; }
.notification-detail-title p { margin:8px 0 0; color:var(--muted); font-size:calc(13px * var(--ui-font-scale, 1)); line-height:1.45; }
.notification-detail-card { overflow:hidden; }
.notification-detail-row { min-height:56px; padding:13px 16px; display:grid; grid-template-columns:minmax(92px,.8fr) minmax(0,1.4fr) 10px; align-items:center; gap:10px; border-bottom:1px solid rgba(130,145,175,.16); }
.notification-detail-row:last-child { border-bottom:0; }
.notification-detail-row span { color:var(--text); font-size:calc(15px * var(--ui-font-scale, 1)); font-weight:650; }
.notification-detail-row strong { color:#f1f3f8; font-size:calc(15px * var(--ui-font-scale, 1)); line-height:1.25; text-align:right; overflow-wrap:anywhere; }
.notification-detail-row > b { color:#7786a2; font-size:calc(20px * var(--ui-font-scale, 1)); }
.notification-detail-note { min-height:108px; padding:16px; }
.notification-detail-note p { margin:0; color:var(--text); font-size:calc(15px * var(--ui-font-scale, 1)); line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.notification-detail-case { width:100%; min-height:52px; margin:0 0 12px; padding:0 16px; display:flex; align-items:center; justify-content:space-between; border:1px solid rgba(120,110,210,.2); border-radius:17px; background:rgba(118,85,246,.1); color:#b6a9ff; font:700 calc(14px * var(--ui-font-scale, 1))/1.2 inherit; }
.notification-detail-case span { font-size:calc(20px * var(--ui-font-scale, 1)); }
.notification-detail-calendar { min-height:50px; margin-bottom:0; font-size:calc(14px * var(--ui-font-scale, 1)); }

html[data-theme="light"] .notification-detail-sheet { background:linear-gradient(180deg,#f8f8f2 0%,#edf3ee 100%); }
html[data-theme="light"] .notification-detail-sheet > header button { background:#f1eefc; border-color:rgba(103,80,232,.22); color:#6750e8; }
html[data-theme="light"] .notification-detail-title,
html[data-theme="light"] .notification-detail-card,
html[data-theme="light"] .notification-detail-note { background:rgba(255,255,255,.96); border-color:var(--light-surface-edge,rgba(24,91,70,.19)); }
html[data-theme="light"] .notification-detail-row strong { color:var(--text); }

.rich-empty {
  min-height: 230px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: rgba(255,255,255,.035);
  text-align: center;
}

.rich-empty > span { display:grid; width:58px; height:58px; place-items:center; margin-bottom:13px; border-radius:18px; background:rgba(125,99,239,.14); color:#aa99ff; font-size:calc(23px * var(--ui-font-scale, 1)); font-weight:850; }
.rich-empty h3 { margin:0 0 7px; font-size:calc(19px * var(--ui-font-scale, 1)); }
.rich-empty p { max-width:290px; margin:0 0 16px; color:var(--muted); font-size:calc(14px * var(--ui-font-scale, 1)); line-height:1.45; }

.upload-center-summary {
  padding: 16px;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 13px;
  align-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg,rgba(125,96,239,.18),rgba(65,200,153,.08));
}

.upload-center-summary > span { display:grid; width:52px; height:52px; place-items:center; border-radius:16px; background:#765bea; color:white; font-size:calc(21px * var(--ui-font-scale, 1)); font-weight:850; }
.upload-center-summary div { display:grid; gap:4px; }
.upload-center-summary strong { font-size:calc(16px * var(--ui-font-scale, 1)); }
.upload-center-summary small { color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); line-height:1.35; }
.upload-job { padding:15px; margin-bottom:var(--card-stack-gap,12px); border-radius:18px; background:linear-gradient(145deg,var(--panel2),var(--panel)); }
.upload-job-head { display:grid; grid-template-columns:42px minmax(0,1fr) 40px; gap:11px; align-items:center; }
.upload-job-head > span { display:grid; width:42px; height:42px; place-items:center; border-radius:13px; background:rgba(125,99,239,.15); color:#ad9dff; font-size:calc(10px * var(--ui-font-scale, 1)); font-weight:850; }
.upload-job-head div { min-width:0; display:grid; gap:3px; }
.upload-job-head strong { overflow:hidden; font-size:calc(15px * var(--ui-font-scale, 1)); text-overflow:ellipsis; white-space:nowrap; }
.upload-job-head small { overflow:hidden; color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); text-overflow:ellipsis; white-space:nowrap; }
.upload-job-head > b { color:#aa99ff; text-align:right; }
.upload-progress { height:6px; margin:12px 0 9px; overflow:hidden; border-radius:10px; background:rgba(255,255,255,.07); }
.upload-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#765bea,#47d39d); transition:width .35s ease; }
.upload-job.error .upload-progress i { background:#ff5f72; }
.upload-job-foot { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.upload-job-foot > span { color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }
.upload-job-foot div { display:flex; gap:5px; }
.upload-job-foot button { min-height:31px; padding:0 9px; border:0; border-radius:9px; background:rgba(255,255,255,.065); color:var(--text); font-size:calc(11px * var(--ui-font-scale, 1)); }

.home-head-actions { display:flex; align-items:center; gap:7px; }
.head-text-action { min-height:36px; padding:0 9px; border:0; background:transparent; color:#a997ff; font:800 calc(13px * var(--ui-font-scale, 1))/1 inherit; }
.home-layout-button,.home-search-button { display:grid; width:38px; height:38px; place-items:center; border:0; border-radius:13px; background:rgba(255,255,255,.055); color:var(--text); font-size:calc(20px * var(--ui-font-scale, 1)); }
.home-cards { display:grid; gap:14px; }
.home-card-block { display:grid; gap:8px; }
.home-reorder-hint { margin:-5px 2px 11px; color:var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); text-align:center; opacity:.72; }
.home-cards > [data-home-card] { touch-action:pan-y; user-select:none; -webkit-user-select:none; transition:transform .18s ease,opacity .18s ease,filter .18s ease; }
.home-cards > [data-home-card].home-card-pressing { transform:scale(.985); filter:brightness(1.08); }
.home-card-placeholder { min-height:92px; border-radius:22px; background:rgba(126,101,238,.07); box-shadow:inset 0 0 0 2px rgba(146,124,255,.18); animation:home-placeholder-pulse 1s ease-in-out infinite alternate; }
.home-card-dragging { transform-origin:center; opacity:.97; filter:brightness(1.1); box-shadow:0 24px 60px rgba(0,0,0,.48)!important; transition:none!important; }
.home-reorder-mode .home-cards > [data-home-card] { animation:home-card-jiggle .38s ease-in-out infinite alternate; }
.home-reorder-mode .home-cards > [data-home-card]:nth-child(even) { animation-direction:alternate-reverse; animation-delay:-.16s; }
@keyframes home-card-jiggle { from { rotate:-.22deg; } to { rotate:.22deg; } }
@keyframes home-placeholder-pulse { from { opacity:.55; } to { opacity:1; } }
.news-card { min-height:170px; padding:19px; overflow:hidden; position:relative; text-align:left; }
.news-card::after { content:'§'; position:absolute; right:14px; bottom:-22px; color:rgba(151,163,188,.12); font:900 calc(92px * var(--ui-font-scale, 1))/1 Georgia,serif; }
.news-card h2 { max-width:270px; margin:15px 0 8px; }
.news-card p { max-width:290px; margin:0 0 14px; color:var(--muted); font-size:calc(13px * var(--ui-font-scale, 1)); line-height:1.4; }

.home-layout-list { margin:14px 0 18px; display:grid; gap:7px; }
.home-layout-row { min-height:54px; padding:8px 12px; display:grid; grid-template-columns:minmax(0,1fr) 42px; align-items:center; gap:12px; border-radius:14px; background:rgba(255,255,255,.045); }
.home-layout-row strong { font-size:calc(14px * var(--ui-font-scale, 1)); }
.home-layout-row label { position:relative; width:39px; height:23px; }
.home-layout-row input { position:absolute; opacity:0; }
.home-layout-row i { display:block; width:39px; height:23px; border-radius:20px; background:#43506a; }
.home-layout-row i::after { content:''; display:block; width:19px; height:19px; margin:2px; border-radius:50%; background:white; transition:transform .2s; }
.home-layout-row input:checked + i { background:#55c998; }
.home-layout-row input:checked + i::after { transform:translateX(16px); }

.undo-toast { position:fixed; z-index:400; left:50%; bottom:calc(94px + env(safe-area-inset-bottom)); width:min(360px,calc(100% - 28px)); min-height:52px; padding:9px 10px 9px 15px; display:flex; align-items:center; justify-content:space-between; gap:12px; transform:translateX(-50%); border-radius:16px; background:#f1f4fb; box-shadow:0 14px 40px rgba(0,0,0,.35); color:#172033; font-size:calc(13px * var(--ui-font-scale, 1)); font-weight:700; animation:undo-in .2s ease-out; }
.undo-toast.swipe-dismissible { touch-action:pan-y; user-select:none; -webkit-user-select:none; will-change:transform,opacity; }
.undo-toast.swipe-dismissible.swiping { animation:none; }
.undo-toast button { min-height:35px; padding:0 11px; border:0; border-radius:10px; background:#765bea; color:white; font-weight:800; }
.undo-toast.swipe-dismissible button { touch-action:manipulation; }
@keyframes undo-in { from { opacity:0; transform:translate(-50%,10px); } }
@media (prefers-reduced-motion:reduce) { .undo-toast { animation:none; } }
html[data-theme="light"] .search-scope span { background:rgba(42,47,61,.055); }
html[data-theme="light"] .home-layout-button,
html[data-theme="light"] .home-search-button { background:rgba(42,47,61,.06); }

/* Поиск событий календаря */
.calendar-search-trigger span {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
  display: block;
}

.calendar-search-trigger span::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 2px;
  right: -5px;
  bottom: -3px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

.calendar-search-sheet {
  max-height: min(82dvh, 720px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calendar-search-sheet > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.calendar-search-sheet > header h2 { margin: 0; }
.calendar-search-sheet > header small { color: var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); }
.calendar-search-sheet > header button {
  border: 0;
  background: none;
  color: #a895ff;
  font-size:calc(14px * var(--ui-font-scale, 1));
  font-weight: 700;
}

.calendar-search-field {
  min-height: 52px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 44px;
  gap: 9px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.calendar-search-field > span {
  width: 13px;
  height: 13px;
  border: 1.8px solid var(--muted);
  border-radius: 50%;
  position: relative;
}

.calendar-search-field > span::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 1.8px;
  right: -5px;
  bottom: -3px;
  background: var(--muted);
  transform: rotate(45deg);
}

.calendar-search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size:calc(16px * var(--ui-font-scale, 1));
}

#sheetRoot .calendar-search-field > button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted);
  font-size:calc(18px * var(--ui-font-scale, 1));
}

.calendar-search-results {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 9px;
  padding-bottom: 8px;
}

.calendar-search-result {
  display: grid;
  grid-template-columns: 100px 3px 1fr 34px;
  gap: 11px;
  align-items: center;
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
}

.calendar-search-date strong,
.calendar-search-result > div:nth-of-type(2) > strong { display: block; font-size:calc(14px * var(--ui-font-scale, 1)); line-height: 1.3; }
.calendar-search-date time { display: block; margin-top: 5px; color: #a895ff; font-size:calc(14px * var(--ui-font-scale, 1)); font-weight: 750; }
.calendar-search-result small { display: block; margin-top: 5px; color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); line-height: 1.35; }
.calendar-search-result .accent-line { height: 46px; }
.calendar-search-result > button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  background: rgba(116,88,255,.13);
  color: #ad9eff;
  font-size:calc(22px * var(--ui-font-scale, 1));
}

.calendar-search-empty {
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--panel2), var(--panel));
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
  color: var(--muted);
}

.calendar-search-empty > span { font-size:calc(30px * var(--ui-font-scale, 1)); }
.calendar-search-empty strong { color: var(--text); font-size:calc(16px * var(--ui-font-scale, 1)); }
.calendar-search-empty small { max-width: 280px; font-size:calc(13px * var(--ui-font-scale, 1)); line-height: 1.45; }

.calendar-voice-command label input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 16px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  font-size:calc(15px * var(--ui-font-scale, 1));
}

/* Comfort, accessibility and consistent system states. */
:root { --muted: #9aabc2; }

.text-size-options { display:grid; gap:9px; margin-bottom:24px; }
.text-size-options button { display:grid; grid-template-columns:1fr auto; gap:4px 12px; width:100%; padding:15px 16px; border:1px solid var(--line); border-radius:17px; background:var(--panel); color:var(--text); text-align:left; }
.text-size-options button::after { content:'○'; grid-column:2; grid-row:1 / span 2; align-self:center; color:var(--muted); font-size:calc(21px * var(--ui-font-scale, 1)); }
.text-size-options button.active { border-color:rgba(116,88,255,.65); background:rgba(116,88,255,.12); }
.text-size-options button.active::after { content:'●'; color:#9d8aff; }
.text-size-options strong { font-size:calc(15px * var(--ui-font-scale, 1)); }
.text-size-options small { color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }

.interface-hints-reset { width:100%; min-height:58px; margin:0 0 26px; padding:10px 14px; border:1px solid var(--line); border-radius:17px; background:var(--panel); color:var(--text); text-align:left; }
.interface-hints-reset > span { display:grid; width:34px; height:34px; place-items:center; border-radius:11px; background:rgba(116,88,255,.13); color:#aa9bff; font-weight:850; }
.draft-status { margin:-2px 2px 6px; color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); text-align:right; transition:color .2s ease; }
.draft-status.restored,.draft-status.saved { color:var(--green); }


.autosave-status { margin:-2px 2px 3px; color:var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); text-align:right; transition:color .2s ease; }
.autosave-status.saved { color:var(--green); }
.stage-change-mark { display:grid; place-items:center; width:48px; height:48px; margin:0 auto 14px; border-radius:16px; background:rgba(245,185,66,.14); color:var(--yellow); font-size:calc(26px * var(--ui-font-scale, 1)); font-weight:800; }
.stage-change-sheet h2,.stage-change-sheet > p { text-align:center; }
.stage-change-sheet > p { color:var(--muted); font-size:calc(14px * var(--ui-font-scale, 1)); line-height:1.5; }

.pdf-page-result small { white-space:normal; line-height:1.4; }
.pdf-page-result small b { color:#a99aff; }
.pdf-preview-sheet { text-align:left; }
.pdf-page-badge { display:inline-flex; margin:2px 0 12px; padding:7px 10px; border-radius:10px; background:rgba(116,88,255,.14); color:#b2a5ff; font-size:calc(12px * var(--ui-font-scale, 1)); font-weight:750; }
.pdf-preview-sheet h2 { line-height:1.25; }
.pdf-preview-sheet > p { padding:14px; border-left:3px solid var(--accent); border-radius:0 12px 12px 0; background:rgba(116,88,255,.07); color:var(--text); font-size:calc(14px * var(--ui-font-scale, 1)); line-height:1.55; }

.upload-job.error { border-color:rgba(255,92,108,.35); }
.upload-job.offline,.upload-job.paused { border-color:rgba(245,185,66,.28); }
.upload-job.done { border-color:rgba(51,214,159,.25); }
.upload-center-summary.has-error { border-color:rgba(255,92,108,.35); background:rgba(255,92,108,.08); }
.upload-center-summary.is-offline { border-color:rgba(245,185,66,.28); background:rgba(245,185,66,.07); }
.upload-job.error .upload-job-foot > span { color:#ff8995; }
.upload-job.offline .upload-job-foot > span,.upload-job.paused .upload-job-foot > span { color:#e6b94e; }
.upload-job.done .upload-job-foot > span { color:var(--green); }

.toast { max-width:min(390px,calc(100vw - 28px)); white-space:normal; text-align:center; line-height:1.35; }

.calendar-voice-examples { display: grid; gap: 8px; margin: 12px 0; }
.calendar-voice-examples button {
  min-height: 44px;
  border: 1px solid rgba(116,88,255,.2);
  border-radius: 14px;
  background: rgba(116,88,255,.09);
  color: #b7aaff;
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-weight: 700;
}

html[data-theme="light"] .calendar-search-sheet,
html[data-theme="light"] .calendar-voice-command { background: #fff; }
html[data-theme="light"] .calendar-search-field,
html[data-theme="light"] .calendar-search-result,
html[data-theme="light"] .calendar-voice-command label input { background: rgba(42,47,61,.045); }

@media (max-width: 380px) {
  .calendar-search-result { grid-template-columns: 82px 3px 1fr 30px; padding: 11px; gap: 9px; }
  .calendar-search-date strong,
  .calendar-search-result > div:nth-of-type(2) > strong { font-size:calc(13px * var(--ui-font-scale, 1)); }
  .calendar-search-result small { font-size:calc(11px * var(--ui-font-scale, 1)); }
}

@media (max-width: 699px), (max-height: 699px) and (orientation: landscape) and (pointer: coarse) {
  .home-route .home-ai-search {
    bottom: calc(var(--mobile-nav-height, 86px) + 42px) !important;
  }
}

/* Messenger-style swipe actions for case cards. */
.case-swipe-row {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 20px;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  isolation: isolate;
  contain: paint;
  -webkit-user-select: none;
  user-select: none;
}

.case-swipe-row .case-card {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  transition: transform .22s cubic-bezier(.22,.78,.25,1);
  will-change: transform;
  backface-visibility: hidden;
}

.case-swipe-row.swiping .case-card {
  transition: none;
}

.case-swipe-row .case-card:active {
  transform: translate3d(0,0,0);
}

.case-swipe-row.open .case-card {
  transform: translate3d(-222px,0,0);
}

.case-swipe-row.open .case-card:active {
  transform: translate3d(-222px,0,0);
}

.case-swipe-actions {
  position: absolute;
  z-index: 1;
  inset: 0 0 0 auto;
  width: 222px;
  display: grid;
  grid-template-columns: repeat(3,74px);
  overflow: hidden;
  border-radius: 0 20px 20px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .08s linear, visibility 0s linear .08s;
}

.case-swipe-row.swiping .case-swipe-actions,
.case-swipe-row.open .case-swipe-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.case-action {
  min-width: 0;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  color: #fff;
}

.case-action.pin { background: #239d75; }
.case-action.archive { background: #7157e9; }
.case-action.delete { background: #e34f60; }
.case-action > span:not(.case-action-icon) { font-size:calc(25px * var(--ui-font-scale, 1)); line-height: 1; }
.case-action-icon {
  display: block;
  width: 28px;
  height: 28px;
  background: #fff;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.case-pin-icon {
  -webkit-mask-image: url('assets/actions/case-pin.png');
  mask-image: url('assets/actions/case-pin.png');
}
.case-archive-icon {
  -webkit-mask-image: url('assets/actions/case-archive.png');
  mask-image: url('assets/actions/case-archive.png');
}
.case-action > small { max-width: 68px; font-size:calc(9px * var(--ui-font-scale, 1)); line-height: 1.15; font-weight: 800; }

.case-card:has(.case-card-pin-mark) { position: relative; }
.case-card-pin-mark {
  position: absolute;
  z-index: 1;
  right: 16px;
  top: 12px;
  width: 20px;
  height: 20px;
  background: #a895ff;
  -webkit-mask: url('assets/actions/case-pin.png') center / contain no-repeat;
  mask: url('assets/actions/case-pin.png') center / contain no-repeat;
  filter: drop-shadow(0 3px 8px rgba(116,88,255,.28));
  pointer-events: none;
}

.case-card:has(.case-card-pin-mark) .case-preview-meta {
  padding-inline-end: 28px;
}

html[data-theme="light"] .case-card-pin-mark {
  background: #674ce2;
}

.case-delete-sheet { text-align: center; }
.case-delete-mark {
  width: 50px;
  height: 50px;
  margin: 2px auto 13px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255,92,108,.14);
  color: #ff7c8a;
  font-size:calc(32px * var(--ui-font-scale, 1));
  line-height: 1;
}

.case-delete-sheet > p {
  margin: 7px 0 18px;
  font-size:calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
}

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

.case-delete-actions button {
  min-height: 48px;
  border-radius: 14px;
  font-size:calc(14px * var(--ui-font-scale, 1));
  font-weight: 800;
}

.case-delete-actions .danger {
  border: 1px solid rgba(255,92,108,.32);
  background: rgba(255,92,108,.17);
  color: #ff8995;
}

/* Окно «Этот файл уже добавлен» (12.11.2026, Николай): три кнопки в столбик на всю ширину, главная —
   «Сохранить отдельно» — первой; снизу отступ под полосу телефона, чтобы последняя кнопка не пряталась. */
.material-duplicate-backdrop .case-delete-sheet {
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}
.material-duplicate-backdrop .case-delete-actions { grid-template-columns: 1fr; }
.material-duplicate-backdrop [data-duplicate-copy] { order: -2; }
.material-duplicate-backdrop [data-duplicate-replace] { order: -1; }

html[data-theme="light"] .case-swipe-row .case-card {
  background: #fff;
}

/* Swipe left on a calendar event to reveal its delete action. */
.calendar-event-swipe-row {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 18px;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  isolation: isolate;
  contain: paint;
  -webkit-user-select: none;
  user-select: none;
}

.calendar-event-swipe-row .calendar-event {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  transition: transform .22s cubic-bezier(.22,.78,.25,1);
  will-change: transform;
  backface-visibility: hidden;
}

.calendar-event-swipe-row.swiping .calendar-event { transition: none; }
.calendar-event-swipe-row .calendar-event:active { transform: translate3d(0,0,0); }
.calendar-event-swipe-row.open .calendar-event { transform: translate3d(-84px,0,0); }
.calendar-event-swipe-row.open .calendar-event:active { transform: translate3d(-84px,0,0); }

.calendar-event-swipe-actions {
  position: absolute;
  z-index: 1;
  inset: 0 0 0 auto;
  width: 84px;
  overflow: hidden;
  border-radius: 0 18px 18px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .08s linear, visibility 0s linear .08s;
}

.calendar-event-swipe-row.swiping .calendar-event-swipe-actions,
.calendar-event-swipe-row.open .calendar-event-swipe-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.calendar-event-delete-action {
  width: 100%;
  height: 100%;
  padding: 9px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: #e34f60;
  color: #fff;
}

.calendar-event-delete-action span { font-size:calc(27px * var(--ui-font-scale, 1)); line-height: 1; }
.calendar-event-delete-action small { font-size:calc(10px * var(--ui-font-scale, 1)); font-weight: 800; }
html[data-theme="light"] .calendar-event-swipe-row .calendar-event { background: #fff; }

/* Pearl & emerald light theme. The dark theme keeps its violet identity. */
html[data-theme="light"] {
  --bg: #f6f5ef;
  --panel: #ffffff;
  --panel2: #f2f8f4;
  --text: #173229;
  --muted: #6d7f78;
  --accent: #168862;
  --red: #df5263;
  --yellow: #c48920;
  --green: #168862;
  --line: rgba(24, 91, 70, .12);
  background: #e8eee9;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 12% -8%, rgba(92, 198, 153, .22), transparent 36%),
    radial-gradient(circle at 92% 10%, rgba(100, 174, 205, .13), transparent 31%),
    linear-gradient(180deg, #f8f7f2 0%, #eef4ef 100%);
}

html[data-theme="light"] .app-shell {
  background:
    radial-gradient(circle at 12% 0, rgba(71, 186, 137, .10), transparent 27%),
    linear-gradient(180deg, #faf9f4 0%, #f3f7f3 100%);
  box-shadow: 0 0 72px rgba(27, 73, 57, .17);
}

html[data-theme="light"] .focus-card {
  border-color: rgba(214, 78, 96, .22);
  background: linear-gradient(145deg, #fff1f2 0%, #fffafa 72%, #ffffff 100%);
  box-shadow: 0 14px 30px rgba(184, 59, 78, .10);
}
html[data-theme="light"] .news-card::after { color: rgba(44, 121, 158, .15); }

html[data-theme="light"] .focus-card-top strong,
html[data-theme="light"] .focus-alert,
html[data-theme="light"] .focus-footer b { color: #c73f54; }

html[data-theme="light"] .tabbar {
  border-top-color: rgba(22, 116, 83, .13);
  background: rgba(252, 253, 249, .91);
  box-shadow: 0 -12px 34px rgba(35, 91, 69, .09);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
}

html[data-theme="light"] .tab { color: #7b8b85; }
html[data-theme="light"] .tab.active { color: #137b59; }
html[data-theme="light"] .calendar-page-front { background: #fbfcf8; }

html[data-theme="light"] .add-main,
html[data-theme="light"] .primary,
html[data-theme="light"] .assistant-fab,
html[data-theme="light"] .send-question,
html[data-theme="light"] .chat-box button {
  background: linear-gradient(145deg, #32ad7e 0%, #137b59 100%);
  box-shadow: 0 12px 28px rgba(22, 136, 98, .28);
}

html[data-theme="light"] .add-main { border-color: #f5f7f2; }

html[data-theme="light"] .icon-btn,
html[data-theme="light"] .bell,
html[data-theme="light"] .home-ai-search,
html[data-theme="light"] .chat-box,
html[data-theme="light"] .search,
html[data-theme="light"] .universal-input,
html[data-theme="light"] .global-search-entry {
  border-color: rgba(22, 116, 83, .14);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 24px rgba(35, 91, 69, .08);
}

html[data-theme="light"] .home-attach,
html[data-theme="light"] .ui-icon,
html[data-theme="light"] .sheet > button > span,
html[data-theme="light"] .upload-zone > span {
  background: rgba(22, 136, 98, .12);
  color: #137b59;
}

html[data-theme="light"] .chip.active,
html[data-theme="light"] .calendar .days button.today,
html[data-theme="light"] .calendar .days button.selected,
html[data-theme="light"] .calendar-week-strip button.selected {
  border-color: #168862;
  background: #168862;
  color: #ffffff;
}

html[data-theme="light"] .case-tabs button.active,
html[data-theme="light"] .section-title button,
html[data-theme="light"] .text-btn,
html[data-theme="light"] .security-note,
html[data-theme="light"] .transcript time,
html[data-theme="light"] .calendar-search-date time {
  color: #137b59;
  border-color: #168862;
}

html[data-theme="light"] .profile-avatar,
html[data-theme="light"] .avatar,
html[data-theme="light"] .chat-intro > span {
  background: linear-gradient(145deg, #45b98b 0%, #137b59 100%);
  box-shadow: 0 10px 24px rgba(22, 136, 98, .20);
}

html[data-theme="light"] .menu-row,
html[data-theme="light"] .toggle-row,
html[data-theme="light"] .preference-list,
html[data-theme="light"] .calendar-event,
html[data-theme="light"] .urgent-row,
html[data-theme="light"] .urgent-accordion,
html[data-theme="light"] .sheet,
html[data-theme="light"] .calendar-event-form,
html[data-theme="light"] .calendar-search-sheet,
html[data-theme="light"] .calendar-voice-command {
  background: rgba(255, 255, 255, .95);
}

html[data-theme="light"] .form input,
html[data-theme="light"] .form select,
html[data-theme="light"] .task-sheet input,
html[data-theme="light"] .calendar-form-row input,
html[data-theme="light"] .calendar-form-row select,
html[data-theme="light"] .calendar-note-field textarea,
html[data-theme="light"] .note-form textarea,
html[data-theme="light"] .calendar-picker-display {
  border-color: rgba(22, 116, 83, .13);
  background: #f1f8f4;
}

html[data-theme="light"] .upload-zone {
  border-color: rgba(22, 136, 98, .30);
  background: rgba(22, 136, 98, .055);
}

html[data-theme="light"] .home-card-placeholder {
  background: rgba(22, 136, 98, .07);
  box-shadow: inset 0 0 0 2px rgba(22, 136, 98, .18);
}

/* Compact, collapsible case-section editor. */
.case-sections-toggle {
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.case-sections-toggle small,
.case-sections-toggle strong {
  display: block;
}

.case-sections-toggle small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size:calc(12px * var(--ui-font-scale, 1));
}

.case-sections-arrow {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 12px;
  background: rgba(116,88,255,.12);
  color: #aa99ff;
  font-size:calc(24px * var(--ui-font-scale, 1));
  line-height: 1;
  transition: transform .28s ease;
}

.case-sections-body {
  max-height: 520px;
  overflow: hidden;
  opacity: 1;
  transition: max-height .32s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}

.case-sections-body > p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size:calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
}

.case-sections-editor.collapsed .case-sections-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.case-sections-editor.expanded .case-sections-arrow {
  transform: rotate(180deg);
}

.global-search-results:empty {
  display: none;
}

/* Keep client and case-card typography aligned with calendar and notifications. */
@media (max-width: 699px), (max-height: 699px) and (orientation: landscape) and (pointer: coarse) {

  .case-stage-preview {
    font-size:calc(13px * var(--ui-font-scale, 1));
    line-height: 1.4;
  }

  .summary-lead > div small {
    margin-bottom: 5px;
    font-size:calc(13px * var(--ui-font-scale, 1));
  }

  .summary-lead > div strong {
    font-size:calc(16px * var(--ui-font-scale, 1));
    line-height: 1.35;
    white-space: normal;
  }

  .summary-edit {
    width: 42px;
    height: 42px;
    padding: 0;
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 13px;
    font-size:0;
  }

  .summary-edit span {
    font-size:calc(23px * var(--ui-font-scale, 1));
    font-weight: 500;
    line-height: 1;
    transform: translateY(-1px);
  }

  .summary-lead > div {
    flex: 1 1 auto;
  }

  .client-avatar {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 16px;
  }

  .summary-field {
    min-height: 72px;
    padding: 12px;
  }

  .case-sections-editor {
    padding: 16px;
  }

  .case-sections-head small {
    margin-bottom: 5px;
    font-size:calc(12px * var(--ui-font-scale, 1));
  }

  .case-sections-head strong {
    font-size:calc(16px * var(--ui-font-scale, 1));
    line-height: 1.35;
  }

  .case-sections-head > span {
    min-width: 32px;
    height: 32px;
    font-size:calc(13px * var(--ui-font-scale, 1));
  }

  .case-sections-editor > p {
    margin: 8px 0 14px;
    font-size:calc(13px * var(--ui-font-scale, 1));
    line-height: 1.45;
  }

  .case-section-option {
    min-height: 39px;
    padding: 9px 11px;
    font-size:calc(13px * var(--ui-font-scale, 1));
    line-height: 1.2;
  }
}

/* Complete emerald accent pass for every light-theme control and icon. */
html[data-theme="light"] .case-card-pin-mark {
  background: #168862;
  filter: drop-shadow(0 3px 8px rgba(22, 136, 98, .28));
}

html[data-theme="light"] .case-action.pin { background: #168862; }

html[data-theme="light"] .calendar-add-event {
  border-color: rgba(22, 136, 98, .25);
  background: rgba(22, 136, 98, .085);
  color: #137b59;
}

html[data-theme="light"] .calendar-add-event span {
  background: rgba(22, 136, 98, .15);
  color: #137b59;
}

html[data-theme="light"] .profile-menu-icon { background: #168862; }

html[data-theme="light"] .menu-row > span,
html[data-theme="light"] .profile-tool-icon { color: #137b59; }

html[data-theme="light"] .profile-tool-icon {
  border-color: rgba(22, 136, 98, .22);
  background: rgba(22, 136, 98, .11);
}

html[data-theme="light"] .profile-tool-icon.percent {
  border-color: rgba(22, 136, 98, .22);
  background: rgba(22, 136, 98, .11);
  color: #137b59;
}

html[data-theme="light"] .case-sections-arrow,
html[data-theme="light"] .case-sections-head > span,
html[data-theme="light"] .case-kind-badge,
html[data-theme="light"] .case-section-badges span,
html[data-theme="light"] .note-case-result > span,
html[data-theme="light"] .case-type-option > span,
html[data-theme="light"] .case-type-current > span,
html[data-theme="light"] .document-case-option > span,
html[data-theme="light"] .upload-case-current > span,
html[data-theme="light"] .upload-case-dropdown button > span,
html[data-theme="light"] .processing-material-type,
html[data-theme="light"] .rich-empty > span,
html[data-theme="light"] .upload-job-head > span,
html[data-theme="light"] .calendar-search-result > button,
html[data-theme="light"] .pdf-page-badge {
  background: rgba(22, 136, 98, .12);
  color: #137b59;
}

html[data-theme="light"] .case-section-option.active,
html[data-theme="light"] .note-case-result.selected,
html[data-theme="light"] .upload-case-dropdown button.active,
html[data-theme="light"] .text-size-options button.active {
  border-color: rgba(22, 136, 98, .38);
  background: rgba(22, 136, 98, .11);
  color: #116f51;
}

html[data-theme="light"] .text-size-options button.active::after,
html[data-theme="light"] .interface-hints-reset > span,
html[data-theme="light"] .pdf-page-result small b,
html[data-theme="light"] .upload-job-head > b,
html[data-theme="light"] .calendar-search-sheet > header button,
html[data-theme="light"] .head-text-action {
  color: #137b59;
}

html[data-theme="light"] .summary-edit,
html[data-theme="light"] .profile-photo-pick,
html[data-theme="light"] .case-type-current button,
html[data-theme="light"] .note-case-hint,
html[data-theme="light"] .calendar-voice-examples button,
html[data-theme="light"] .notification-actions button {
  border-color: rgba(22, 136, 98, .22);
  background: rgba(22, 136, 98, .09);
  color: #137b59 !important;
}

html[data-theme="light"] .summary-field,
html[data-theme="light"] .document-upload-settings input {
  border-color: rgba(22, 116, 83, .13);
  background: #f1f8f4;
}

html[data-theme="light"] .case-tab-placeholder { background: rgba(22, 136, 98, .08); }

html[data-theme="light"] .case-tabs button.case-tab-dragging {
  border-color: rgba(22, 136, 98, .34);
  color: #137b59;
}

html[data-theme="light"] .doc-icon { background: rgba(22, 136, 98, .10); }

html[data-theme="light"] .doc-icon::before,
html[data-theme="light"] .search-result-icon.doc::before { background: #168862; }

html[data-theme="light"] .upload-center-summary > span {
  background: linear-gradient(145deg, #34ad7e, #137b59);
  box-shadow: 0 9px 22px rgba(22, 136, 98, .22);
}

html[data-theme="light"] .upload-progress { background: rgba(22, 136, 98, .10); }
html[data-theme="light"] .upload-progress i { background: linear-gradient(90deg, #168862, #51c99a); }
html[data-theme="light"] .undo-toast button { background: #168862; }
html[data-theme="light"] .pdf-preview-sheet > p { background: rgba(22, 136, 98, .07); }

/* Final interaction polish: calendar months, profile surfaces, tasks and analytics. */
.badge {
  color: #fff !important;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(80,0,12,.22);
}

#app > .menu-row {
  margin-bottom: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
}

.settings-card > :first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.settings-card > :last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.calendar-month-view {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  transform: translate3d(0,0,0);
  backface-visibility: hidden;
  contain: layout paint;
  isolation: isolate;
  will-change: transform,opacity;
  -webkit-user-select: none;
  user-select: none;
}

.calendar-month-view.calendar-month-swiping { transition: none !important; }
.calendar-month-view .legend { display: none; }

.calendar-events-title .muted {
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 400;
}

.calendar-today-trigger {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.calendar-today-trigger:active { opacity: .65; }
.calendar-today-trigger:focus-visible { outline: 2px solid rgba(146,125,255,.75); outline-offset: 5px; border-radius: 8px; }

.calendar-month-view .calendar-month-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 750;
  line-height: 1;
}

.calendar-month-title span {
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
  transform: translateY(-1px);
}

.ios-calendar-month-wheel .ios-date-wheel-columns {
  grid-template-columns: minmax(0,1.55fr) minmax(82px,.75fr);
  gap: 10px;
  padding: 0 clamp(12px,4vw,20px);
}

.ios-calendar-month-wheel .ios-date-wheel-selection {
  top: 78px;
  height: 64px;
}

.ios-calendar-month-wheel .ios-date-wheel-column {
  padding-top: 78px;
  padding-bottom: 78px;
}

.ios-calendar-month-wheel .ios-date-wheel-option {
  max-width: 100%;
  height: 64px;
  padding-right: 3px;
  padding-left: 3px;
  overflow: hidden;
  font-size:clamp(calc(20px * var(--ui-font-scale, 1)),calc(6.2vw * var(--ui-font-scale, 1)),calc(24px * var(--ui-font-scale, 1)));
  line-height: 64px;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.ios-calendar-month-wheel .ios-date-wheel-option.selected {
  font-size:clamp(calc(24px * var(--ui-font-scale, 1)),calc(7.2vw * var(--ui-font-scale, 1)),calc(28px * var(--ui-font-scale, 1)));
  transform: none;
}

html[data-text-size="large"] .ios-calendar-month-wheel .ios-date-wheel-option.selected {
  font-size:calc(24px * var(--ui-font-scale, 1));
}

html[data-text-size="large"] .ios-calendar-month-wheel .ios-date-wheel-option {
  font-size:calc(18px * var(--ui-font-scale, 1));
}

html[data-text-size="large"] .ios-calendar-month-wheel .ios-date-wheel-option.selected {
  font-size:calc(22px * var(--ui-font-scale, 1));
}

/* Purple is reserved for today; a temporary manual choice uses the voice-action green. */
.calendar .days button.today,
html[data-theme="light"] .calendar .days button.today {
  border-color: #7458ff;
  background: linear-gradient(145deg,#8d75ff,#674be9);
  color: #fff;
  box-shadow: 0 7px 18px rgba(116,88,255,.3);
}

.calendar .days button.selected:not(.today),
html[data-theme="light"] .calendar .days button.selected:not(.today) {
  border-color: rgba(118,255,205,.32);
  background: linear-gradient(145deg,#39dda5,#16a978);
  color: #062d22;
  box-shadow: 0 7px 18px rgba(24,190,134,.32);
}

.calendar-month-transition-stage {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  border-radius: 20px;
  isolation: isolate;
  contain: layout paint;
  overflow-anchor: none;
}

.calendar-month-transition-stage + .calendar-events-title {
  margin-top: 18px;
  overflow-anchor: none;
}

.calendar-month-view,
.calendar-events-title,
.calendar-add-event { overflow-anchor: none; }

.calendar-month-transition-stage > .calendar-month-view {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0 !important;
  will-change: transform;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.calendar-month-return-track {
  position: absolute;
  inset: 0 auto auto 0;
  display: flex;
  gap: 20px;
  width: 100%;
  will-change: transform;
  backface-visibility: hidden;
}

.calendar-month-return-track > .calendar-month-view {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  margin: 0 !important;
  pointer-events: none;
  touch-action: pan-y;
  backface-visibility: hidden;
}

.case-task-list { margin-top: 10px; }
.task-swipe-row {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 18px;
  isolation: isolate;
  contain: paint;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  -webkit-user-select: none;
  user-select: none;
}

.task-swipe-row .task-row {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 76px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  transition: transform .22s cubic-bezier(.22,.78,.25,1);
  will-change: transform;
  backface-visibility: hidden;
}

.task-swipe-row.swiping .task-row { transition: none; }
.task-swipe-row.open .task-row { transform: translate3d(-168px,0,0); }
.task-row.done strong { opacity: .54; text-decoration: line-through; }
.task-row strong { font-size:calc(15px * var(--ui-font-scale, 1)) !important; line-height: 1.28; }
.task-row small { margin-top: 6px; font-size:calc(12px * var(--ui-font-scale, 1)) !important; line-height: 1.25; }

.task-swipe-actions {
  position: absolute;
  z-index: 1;
  inset: 0 0 0 auto;
  width: 168px;
  display: grid;
  grid-template-columns: 84px 84px;
  overflow: hidden;
  border-radius: 0 18px 18px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .08s linear,visibility 0s linear .08s;
}

.task-swipe-row.swiping .task-swipe-actions,
.task-swipe-row.open .task-swipe-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.task-swipe-actions button {
  min-width: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
}

.task-edit-action { background: #239d75; }
.task-delete-action { background: #e34f60; }
.task-swipe-actions span { font-size:calc(25px * var(--ui-font-scale, 1)); line-height: 1; }
.task-swipe-actions small { font-size:calc(9px * var(--ui-font-scale, 1)); font-weight: 850; }

.task-editor-sheet header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
}

.task-editor-sheet header small { color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }
.task-editor-sheet header h2 { margin: 3px 0 0; font-size:calc(21px * var(--ui-font-scale, 1)); }
.task-editor-sheet header button { border: 0; background: none; color: var(--accent); font-size:calc(13px * var(--ui-font-scale, 1)); font-weight: 800; }
.task-editor-sheet > label { display: block; margin: 0 0 13px; color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); font-weight: 750; }
.task-editor-sheet input,.task-editor-sheet select { width: 100%; min-height: 49px; margin-top: 7px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel2); color: var(--text); font:inherit; font-size:calc(14px * var(--ui-font-scale, 1)); }

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

.polished-analysis .analysis-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 18px;
  align-items: center;
  gap: 13px;
  padding: 14px;
  text-align: left;
}

.polished-analysis .analysis-card > div { min-width: 0; }
.polished-analysis .analysis-card strong { display: block; font-size:calc(15px * var(--ui-font-scale, 1)) !important; line-height: 1.25; }
.polished-analysis .analysis-card small { display: block; margin-top: 5px; color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)) !important; line-height: 1.3; }
.polished-analysis .analysis-card > b { color: var(--muted); font-size:calc(22px * var(--ui-font-scale, 1)); font-weight: 500; }
.analysis-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(151,129,255,.24);
  border-radius: 14px;
  background: rgba(116,88,255,.13);
  color: #b7a9ff;
  font-size:calc(18px * var(--ui-font-scale, 1));
  line-height: 1;
  font-weight: 850;
}

.analysis-icon.alert { background: rgba(255,83,105,.12); border-color: rgba(255,83,105,.22); color: #ff8192; }
.analysis-icon.clock { font-size:calc(20px * var(--ui-font-scale, 1)); }
.analysis-icon.person { font-size:calc(17px * var(--ui-font-scale, 1)); }
.analysis-icon.assistant { font-size:calc(12px * var(--ui-font-scale, 1)); letter-spacing: -.3px; }

html[data-theme="light"] #app > .menu-row,
html[data-theme="light"] .task-swipe-row .task-row,
html[data-theme="light"] .polished-analysis .analysis-card {
  border-color: var(--light-surface-edge);
  background: rgba(255,255,255,.97);
  box-shadow: var(--light-surface-shadow);
}

html[data-theme="light"] .analysis-icon {
  border-color: rgba(22,136,98,.20);
  background: rgba(22,136,98,.10);
  color: #137b59;
}

html[data-theme="light"] .analysis-icon.alert {
  border-color: rgba(223,82,99,.20);
  background: rgba(223,82,99,.10);
  color: #cf4053;
}

@media (min-width: 560px) {
  .polished-analysis { grid-template-columns: 1fr 1fr; }
}

html[data-theme="light"] .preference-row > span,
html[data-theme="light"] .preference-row.active,
html[data-theme="light"] .quick i,
html[data-theme="light"] .camera-symbol,
html[data-theme="light"] .storage-type,
html[data-theme="light"] .notice,
html[data-theme="light"] .global-search-entry,
html[data-theme="light"] .global-search-entry > span {
  border-color: rgba(22, 136, 98, .18);
  background: rgba(22, 136, 98, .09);
  color: #137b59;
}

html[data-theme="light"] .storage-type::after { border-color: #168862; }

html[data-theme="light"] .theme-option.active {
  border-color: #168862;
  box-shadow: 0 10px 28px rgba(22, 136, 98, .18);
}

html[data-theme="light"] .home-ai-spark,
html[data-theme="light"] .ai-orb,
html[data-theme="light"] .message.ai span,
html[data-theme="light"] .audio-wave,
html[data-theme="light"] .analysis-card > span,
html[data-theme="light"] .notice > span {
  color: #137b59;
}

html[data-theme="light"] .timeline-item > i {
  border-color: #61c7a0;
  background: #168862;
}

html[data-theme="light"] .calendar .days button.selected,
html[data-theme="light"] .calendar-week-strip button.selected {
  box-shadow: 0 7px 18px rgba(22, 136, 98, .28);
}

html[data-theme="light"] .ios-date-wheel-selection {
  border-top-color: rgba(22, 136, 98, .24);
  border-bottom-color: rgba(22, 136, 98, .24);
}

/* Stronger surface separation for the pearl light theme. */
html[data-theme="light"] {
  --light-surface-edge: rgba(24, 91, 70, .19);
  --light-surface-shadow: 0 14px 32px rgba(30, 78, 61, .13), 0 2px 7px rgba(30, 78, 61, .06);
  --light-control-shadow: 0 7px 17px rgba(30, 78, 61, .10);
}

html[data-theme="light"] .card,
html[data-theme="light"] .profile-card,
html[data-theme="light"] .case-swipe-row .case-card,
html[data-theme="light"] .case-sections-editor,
html[data-theme="light"] .settings-card,
html[data-theme="light"] .preference-list,
html[data-theme="light"] .theme-option,
html[data-theme="light"] .calendar-event-swipe-row .calendar-event,
html[data-theme="light"] .smart-notification,
html[data-theme="light"] .upload-job,
html[data-theme="light"] .rich-empty,
html[data-theme="light"] .document-upload-settings,
html[data-theme="light"] .profile-photo-editor {
  border: 1px solid var(--light-surface-edge);
  box-shadow: var(--light-surface-shadow);
}

html[data-theme="light"] .focus-card {
  border-color: rgba(198, 63, 84, .30);
  box-shadow: 0 16px 34px rgba(170, 55, 73, .16), 0 2px 7px rgba(170, 55, 73, .07);
}

html[data-theme="light"] .calendar-add-event,
html[data-theme="light"] .case-tabs button,
html[data-theme="light"] .icon-btn,
html[data-theme="light"] .bell,
html[data-theme="light"] .summary-edit,
html[data-theme="light"] .secondary,
html[data-theme="light"] .home-layout-button,
html[data-theme="light"] .home-search-button {
  border: 1px solid rgba(22, 116, 83, .22);
  box-shadow: var(--light-control-shadow);
}

html[data-theme="light"] .calendar-add-event,
html[data-theme="light"] .summary-edit,
html[data-theme="light"] .secondary {
  background: #e8f5ee;
}

html[data-theme="light"] .form input,
html[data-theme="light"] .form select,
html[data-theme="light"] .task-sheet input,
html[data-theme="light"] .summary-field,
html[data-theme="light"] .calendar-form-row input,
html[data-theme="light"] .calendar-form-row select,
html[data-theme="light"] .calendar-note-field textarea,
html[data-theme="light"] .note-form textarea,
html[data-theme="light"] .calendar-picker-display,
html[data-theme="light"] .search,
html[data-theme="light"] .home-ai-search,
html[data-theme="light"] .global-search-entry {
  border-color: rgba(22, 116, 83, .20);
}

html[data-theme="light"] .form input,
html[data-theme="light"] .form select,
html[data-theme="light"] .task-sheet input,
html[data-theme="light"] .summary-field,
html[data-theme="light"] .calendar-form-row input,
html[data-theme="light"] .calendar-form-row select,
html[data-theme="light"] .calendar-note-field textarea,
html[data-theme="light"] .note-form textarea {
  box-shadow: inset 0 1px 3px rgba(30, 78, 61, .055);
}

html[data-theme="light"] .pressable,
html[data-theme="light"] .calendar-add-event,
html[data-theme="light"] .case-tabs button,
html[data-theme="light"] .summary-edit,
html[data-theme="light"] .secondary {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

html[data-theme="light"] .pressable:active,
html[data-theme="light"] .calendar-add-event:active,
html[data-theme="light"] .case-tabs button:active,
html[data-theme="light"] .summary-edit:active,
html[data-theme="light"] .secondary:active {
  box-shadow: 0 3px 9px rgba(30, 78, 61, .08);
}

/* Privacy badge uses the supplied shield and follows the active theme accent. */
.security-shield-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: url("assets/actions/security-shield.png") center / contain no-repeat;
  mask: url("assets/actions/security-shield.png") center / contain no-repeat;
}

/* More legible values in the event editor. */

/* Green actions and case linking in the light theme. */

/* Event values sit directly on the form surface, without highlighted pills. */
html[data-theme="light"] .calendar-event-form .calendar-picker-display,
html[data-theme="light"] .calendar-event-form .calendar-case-row select {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Enlarged high-contrast values in the new-event form. Labels keep their original typography. */

.calendar-event-form .calendar-time-range > em,
html[data-theme="light"] .calendar-event-form .calendar-time-range > em {
  color: #fff;
  font-size:calc(19.5px * var(--ui-font-scale, 1));
}

/* The case filters float directly on the page instead of a shared platform. */
.chips,
html[data-theme="light"] .chips {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Remove the rectangular inner fill from editable oval case filters. */
html[data-theme="light"] .filter-token .chip {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* A clearer emerald-to-white background across every light-theme screen. */
html[data-theme="light"] body {
  background:
    radial-gradient(circle at 8% -6%, rgba(35, 174, 116, .30), transparent 36%),
    linear-gradient(180deg, #d2eadf 0%, #edf7f1 38%, #ffffff 76%, #f4f8f5 100%);
}

html[data-theme="light"] .case-sticky-head {
  background: linear-gradient(180deg, #d8eee3 0%, #e8f5ed 100%);
}

/* AI document builder widget and workflow. */
.document-builder-card {
  position: relative;
  text-align: left;
  color: var(--text);
  background: linear-gradient(145deg, rgba(50, 214, 159, .17), rgba(116, 88, 255, .18) 72%, var(--panel));
  border-color: rgba(94, 210, 166, .25);
}

.document-builder-card-icon {
  position: absolute;
  right: 13px;
  bottom: 13px;
  width: 62px;
  height: 62px;
  background: rgba(116, 224, 181, .14);
  -webkit-mask: url('assets/actions/document.png?v=2') center / contain no-repeat;
  mask: url('assets/actions/document.png?v=2') center / contain no-repeat;
}
.document-builder-card p {
  display: -webkit-box;
  max-width: 135px;
  margin: 0 0 5px;
  overflow: hidden;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.legal-calculator-card {
  position: relative;
  text-align: left;
  color: var(--text);
  overflow: hidden;
}
.legal-calculator-card::after {
  content: '';
  position: absolute;
  right: -32px;
  bottom: -42px;
  width: 122px;
  height: 122px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .07;
}
.state-duty-card {
  background: linear-gradient(145deg, rgba(44, 177, 135, .20), rgba(17, 69, 73, .34) 72%, var(--panel));
  border-color: rgba(67, 214, 166, .28);
}
.article-395-card {
  background: linear-gradient(145deg, rgba(60, 142, 218, .18), rgba(69, 77, 171, .28) 72%, var(--panel));
  border-color: rgba(102, 164, 226, .28);
}
.legal-calculator-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: #75dfb8;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 850;
}
.article-395-card .legal-calculator-icon { color: #8dc7ff; }
.legal-calculator-card p {
  display: -webkit-box;
  max-width: 138px;
  margin: 0 0 5px;
  overflow: hidden;
  color: var(--muted);
  font-size:calc(9px * var(--ui-font-scale, 1));
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Focused state-duty calculator. The two unrelated reference rows from the visual sample are intentionally omitted. */
.state-duty-reset {
  align-self: center;
  justify-self: end;
  min-width: 0;
  border: 0;
  padding: 8px 4px 8px 0;
  background: transparent;
  color: var(--accent);
  font:inherit;
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-weight: 750;
  white-space: nowrap;
}

body:has(.state-duty-calculator) .page-head,
body:has(.article395-calculator) .page-head {
  grid-template-columns: 44px minmax(0, 1fr) max-content;
}

body:has(.article395-calculator) .page-head .head-copy h1 {
  overflow: visible;
  font-size:clamp(calc(13.5px * var(--ui-font-scale, 1)), calc(4.2vw * var(--ui-font-scale, 1)), calc(18px * var(--ui-font-scale, 1)));
  letter-spacing: -.45px;
  text-overflow: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  white-space: nowrap;
}

.state-duty-calculator {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 18px;
}

.state-duty-price {
  margin: 4px 0 14px;
  padding: 15px 16px;
  display: grid;
  gap: 5px;
  justify-items: end;
  border: 1px solid rgba(112, 223, 179, .22);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(47, 197, 143, .10), rgba(109, 80, 232, .08)), var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .10);
}
.state-duty-price > label { color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); font-weight: 700; }
.state-duty-price > div {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.state-duty-price output {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  max-width: 100%;
  color: var(--text);
  font:inherit;
  font-size:clamp(calc(31px * var(--ui-font-scale, 1)), calc(9vw * var(--ui-font-scale, 1)), calc(44px * var(--ui-font-scale, 1)));
  font-weight: 500;
  line-height: 1.05;
  text-align: right;
}
.state-duty-price output,
.article395-principal output {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.state-duty-price b { color: var(--muted); font-size:calc(22px * var(--ui-font-scale, 1)); }

.state-duty-results {
  display: grid;
  gap: 10px;
}
.state-duty-result-group h2 {
  margin: 0 0 7px;
  color: #6fddb4;
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-weight: 850;
  letter-spacing: -.01em;
}
.state-duty-result-row {
  min-width: 0;
  padding: 8px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  border-top: 1px solid rgba(132, 153, 187, .10);
}
.state-duty-result-row span { min-width: 0; color: var(--text); font-size:calc(14px * var(--ui-font-scale, 1)); line-height: 1.25; }
.state-duty-result-row output { color: var(--text); font-size:calc(17px * var(--ui-font-scale, 1)); font-weight: 800; white-space: nowrap; }

.state-duty-keypad {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.state-duty-keypad button {
  min-width: 0;
  min-height: 48px;
  border: 1px solid rgba(132, 153, 187, .14);
  border-radius: 15px;
  background: rgba(135, 151, 181, .13);
  color: var(--text);
  font:inherit;
  font-size:calc(22px * var(--ui-font-scale, 1));
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.state-duty-keypad button:active { transform: scale(.96); background: rgba(112, 223, 179, .17); }

html[data-theme="light"] .state-duty-reset,
html[data-theme="light"] .state-duty-result-group h2 { color: #138b65; }
html[data-theme="light"] .state-duty-keypad button {
  border-color: rgba(22, 144, 103, .15);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 5px 14px rgba(21, 99, 73, .07);
}

@media (max-height: 700px) {
  .state-duty-price { padding-block: 11px; margin-bottom: 9px; }
  .state-duty-price output { font-size:calc(30px * var(--ui-font-scale, 1)); }
  .state-duty-results { gap: 7px; }
  .state-duty-result-group { padding: 10px 13px 7px; }
  .state-duty-result-row { padding: 5px 0; }
  .state-duty-keypad { margin-top: 8px; gap: 5px; }
  .state-duty-keypad button { min-height: 44px; }
}

/* Article 395 calculator: compact inputs, submit-only result and a transparent rate-by-rate breakdown. */
.article395-calculator {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 18px;
}
.article395-form {
  display: grid;
  gap: 10px;
}
.article395-form label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 750;
}
.article395-principal {
  padding: 14px 15px;
  justify-items: end;
  border: 1px solid rgba(112, 223, 179, .22);
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(47, 197, 143, .10), rgba(109, 80, 232, .08)), var(--panel);
}
.article395-principal > div {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.article395-principal output {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font:inherit;
  font-size:clamp(calc(27px * var(--ui-font-scale, 1)), calc(8vw * var(--ui-font-scale, 1)), calc(40px * var(--ui-font-scale, 1)));
  font-weight: 650;
  line-height: 1.1;
  text-align: right;
}
.article395-principal b { color: var(--muted); font-size:calc(22px * var(--ui-font-scale, 1)); }
.article395-dates {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.article395-dates label {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.article395-dates input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font:inherit;
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-weight: 800;
  color-scheme: dark;
}
.article395-submit {
  margin: 1px 0 2px;
  min-height: 46px;
  background: linear-gradient(145deg, #33d69f, #16956c);
  font-size:calc(13px * var(--ui-font-scale, 1));
  box-shadow: 0 8px 20px rgba(51, 214, 159, .20);
}
.article395-result,
.article395-empty {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
}
.article395-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
}
.article395-empty span { color: #6fddb4; font-size:calc(30px * var(--ui-font-scale, 1)); font-weight: 850; }
.article395-empty p { margin: 0; color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }
.article395-result-main {
  padding: 16px;
  display: grid;
  gap: 5px;
}
.article395-result-main small { color: var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); font-weight: 700; }
.article395-result-main > strong { color: #6fddb4; font-size:clamp(calc(29px * var(--ui-font-scale, 1)), calc(8vw * var(--ui-font-scale, 1)), calc(39px * var(--ui-font-scale, 1))); line-height: 1.08; }
.article395-result-main span { color: var(--muted); font-size:calc(12px * var(--ui-font-scale, 1)); }
.article395-result-main span b { color: var(--text); }
.article395-breakdown { border-top: 1px solid rgba(132, 153, 187, .12); }
.article395-breakdown summary {
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  font-size:calc(11px * var(--ui-font-scale, 1));
  font-weight: 750;
  list-style: none;
  cursor: pointer;
}
.article395-breakdown summary::-webkit-details-marker { display: none; }
.article395-breakdown[open] summary b { transform: rotate(180deg); }
.article395-breakdown article {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  border-top: 1px solid rgba(132, 153, 187, .09);
}
.article395-breakdown article span { color: var(--muted); font-size:calc(10px * var(--ui-font-scale, 1)); }
.article395-breakdown article strong { color: var(--text); font-size:calc(10px * var(--ui-font-scale, 1)); text-align: right; }
.article395-breakdown article small { grid-column: 1 / -1; color: #6fddb4; font-size:calc(11px * var(--ui-font-scale, 1)); font-weight: 800; }
.article395-note { margin: 11px 5px 0; color: var(--muted); font-size:calc(9px * var(--ui-font-scale, 1)); line-height: 1.45; text-align: center; }

html[data-theme="light"] .article395-principal,
html[data-theme="light"] .article395-dates label,
html[data-theme="light"] .article395-result,
html[data-theme="light"] .article395-empty {
  border-color: rgba(22, 144, 103, .18);
  background: rgba(255, 255, 255, .80);
  box-shadow: 0 12px 28px rgba(21, 99, 73, .09);
}
html[data-theme="light"] .article395-dates input { color-scheme: light; }
html[data-theme="light"] .article395-result-main > strong,
html[data-theme="light"] .article395-breakdown article small,
html[data-theme="light"] .article395-empty span { color: #138b65; }
html[data-theme="light"] .article395-submit {
  background: linear-gradient(145deg, #28af84, #11825f);
  box-shadow: 0 8px 20px rgba(21, 151, 109, .18);
}

@media (max-width: 350px) {
  .article395-dates { grid-template-columns: 1fr; }
}

.document-builder-intro,
.document-builder-ready {
  margin-bottom: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(75, 210, 160, .20);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(51, 214, 159, .12), rgba(116, 88, 255, .08));
}

.document-builder-brain,
.document-builder-ready > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #43c997, #6552dc);
  color: #fff;
  font-size:calc(14px * var(--ui-font-scale, 1));
  font-weight: 850;
}

.document-builder-intro strong,
.document-builder-ready strong { display: block; font-size:calc(15px * var(--ui-font-scale, 1)); }
.document-builder-intro small,
.document-builder-ready small { display: block; margin-top: 4px; color: var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); line-height: 1.4; }

.document-builder-form {
  display: grid;
  gap: 10px;
  padding-bottom: 22px;
}

.document-builder-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size:calc(12px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.document-builder-form label > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.document-builder-form label small { font-size:calc(10px * var(--ui-font-scale, 1)); font-weight: 500; opacity: .72; }
.document-builder-form input,
.document-builder-form select,
.document-builder-form textarea {
  width: 100%;
  min-height: 51px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: 0;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size:calc(15px * var(--ui-font-scale, 1));
  font-weight: 650;
  line-height: 1.3;
}
.document-builder-form textarea { min-height: 92px; resize: vertical; font-weight: 500; }
.document-builder-form input::placeholder,
.document-builder-form textarea::placeholder { color: var(--muted); opacity: .65; }
.document-builder-submit { display: flex; align-items: center; justify-content: center; gap: 8px; font-size:calc(14px * var(--ui-font-scale, 1)); }
.document-builder-submit span { font-size:calc(11px * var(--ui-font-scale, 1)); }

.generated-document {
  padding: 20px 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 15px 35px rgba(0, 0, 0, .16);
}
.generated-document header { margin-bottom: 20px; text-align: center; }
.generated-document header small { color: var(--muted); font-size:calc(11px * var(--ui-font-scale, 1)); }
.generated-document header h2 { margin: 7px 0 0; font-size:calc(20px * var(--ui-font-scale, 1)); text-transform: uppercase; }
.generated-document h3 { margin: 21px 0 7px; font-size:calc(14px * var(--ui-font-scale, 1)); }
.generated-document p { margin: 7px 0; font-size:calc(13px * var(--ui-font-scale, 1)); line-height: 1.55; }
.generated-document-note { margin-top: 24px !important; color: var(--muted); font-size:var(--text-2xs) !important; }
.document-builder-actions { margin: 12px 0 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.document-builder-actions button { min-height: 48px; border-radius: 14px; }
html[data-theme="light"] .document-builder-card-icon { background: rgba(22, 136, 98, .15); }
html[data-theme="light"] .state-duty-card {
  background: linear-gradient(145deg, #d9f3e7 0%, #edf8f2 62%, #ffffff 100%);
  border-color: rgba(22, 136, 98, .28);
  box-shadow: 0 15px 32px rgba(22, 116, 83, .13);
}
html[data-theme="light"] .article-395-card {
  background: linear-gradient(145deg, #dceef8 0%, #eef7fa 62%, #ffffff 100%);
  border-color: rgba(42, 128, 170, .25);
  box-shadow: 0 15px 32px rgba(34, 105, 139, .12);
}
html[data-theme="light"] .legal-calculator-icon { background: rgba(255,255,255,.72); }
html[data-theme="light"] .document-builder-brain,
html[data-theme="light"] .document-builder-ready > span { background: linear-gradient(145deg, #32ad7e, #137b59); }

/* Premium calendar event editor — visual-only restructuring. */
.calendar-event-backdrop {
  background: rgba(2, 8, 18, .72);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

.calendar-event-form {
  width: min(100%,480px);
  max-height: min(94dvh,900px);
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(151,176,213,.13);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  background: linear-gradient(160deg,#10223a 0%,#09182b 48%,#0d2037 100%);
  box-shadow: 0 -24px 70px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.035);
  scrollbar-width: none;
}

.calendar-event-form::-webkit-scrollbar { display: none; }
.calendar-event-form { touch-action: pan-y; overscroll-behavior-y: contain; }
.calendar-event-form.swiping-down { transition: none; animation: none; will-change: transform; }
.calendar-event-form.dismiss-down { transition: transform .18s cubic-bezier(.32,.02,.7,.35); animation: none; }
.calendar-event-form > .grabber {
  width: 42px;
  height: 5px;
  margin: 1px auto 18px;
  background: #526984;
  opacity: .82;
}

.calendar-event-form-head {
  grid-template-columns: 82px minmax(0,1fr) 82px;
  min-height: 48px;
  margin: 0 0 22px;
}

.calendar-event-form-head h2 {
  color: #f7f9ff;
  font-size:calc(21px * var(--ui-font-scale, 1));
  font-weight: 750;
  letter-spacing: -.025em;
  white-space: nowrap;
}

.calendar-event-form-head button {
  min-height: 44px;
  color: #a78dff;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: -.01em;
}

.calendar-event-fields {
  display: grid;
  gap: 10px;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.calendar-event-form .calendar-title-field {
  gap: 13px;
  min-height: 108px;
  padding: 18px 17px 20px;
  border-bottom: 1px solid rgba(140,171,210,.075);
}

.calendar-event-form .calendar-title-field > span,
.calendar-event-form .calendar-note-field > span {
  color: #f4f7fc;
  font-size:calc(12px * var(--ui-font-scale, 1));
  font-weight: 650;
  line-height: 1;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.calendar-event-form .calendar-title-field :is(input,textarea) {
  color: #f4f7fc;
  font-size:calc(22px * var(--ui-font-scale, 1));
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.calendar-event-form .calendar-form-row {
  grid-template-columns: 48px minmax(92px,auto) minmax(0,1fr) 14px;
  gap: 12px;
  min-height: 74px;
  padding: 11px 16px 11px 13px;
  border-bottom: 1px solid rgba(140,171,210,.075);
  color: #f5f8fc;
  font-size:calc(16px * var(--ui-font-scale, 1));
  align-items: center;
}

.calendar-row-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg,rgba(22,195,159,.22),rgba(31,150,144,.13));
  color: #39dfb0;
  box-shadow: inset 0 0 0 1px rgba(67,229,189,.06);
}

.calendar-row-icon svg { width: 25px; height: 25px; }
.calendar-row-title,
.calendar-event-form .calendar-alert-row b,
.calendar-event-form .calendar-case-row b {
  color: #f4f7fc;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 650;
  line-height: 1.2;
}

.calendar-row-chevron {
  align-self: center;
  color: #7187a2;
  font-size:calc(28px * var(--ui-font-scale, 1));
  font-weight: 300;
  line-height: 1;
  transform: translateY(-1px);
}
.calendar-event-form .calendar-picker-display,
.calendar-event-form .calendar-time-range .calendar-picker-display,
.calendar-event-form .calendar-alert-display,
html[data-theme="light"] .calendar-event-form .calendar-picker-display {
  min-height: 42px;
  padding: 0;
  color: #f4f7fc;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: -.012em;
  white-space: nowrap;
  align-items: center;
}

.calendar-date-parts { display: none; }
.calendar-date-row .calendar-picker-control { justify-self: stretch; }

.calendar-event-form .calendar-time-range .calendar-picker-control {
  min-width: 48px;
}

.calendar-event-form .calendar-time-range > em,
html[data-theme="light"] .calendar-event-form .calendar-time-range > em {
  color: #8093aa;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 450;
  transform: none;
}
.calendar-event-form .calendar-alert-row > span,
.calendar-event-form .calendar-case-row > span { gap: 4px; }
.calendar-event-form .calendar-alert-row small,
.calendar-event-form .calendar-case-row small {
  color: #8fa2ba;
  font-size:calc(13px * var(--ui-font-scale, 1));
  font-weight: 450;
  line-height: 1.25;
}

.calendar-event-form .calendar-alert-row .calendar-picker-display {
  width: 100%;
  max-width: 100%;
  height: auto;
  font-size:calc(20px * var(--ui-font-scale, 1));
  font-weight: 550;
  line-height: 1.15;
  text-align: right;
  white-space: normal;
  overflow-wrap: normal;
}

.calendar-event-form .calendar-alert-row .calendar-picker-display [data-picker-part="alert"] {
  display: block;
  width: 100%;
}
.calendar-event-form .calendar-case-display {
  width: min(190px,46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  justify-content: flex-end;
  font-size:calc(20px * var(--ui-font-scale, 1));
}

.calendar-event-form .calendar-case-display [data-picker-part="case"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-backdrop .ios-case-wheel .ios-date-wheel-option {
  overflow: hidden;
  padding-right: 10px;
  padding-left: 10px;
  font-size:clamp(calc(17px * var(--ui-font-scale, 1)),calc(5.1vw * var(--ui-font-scale, 1)),calc(20px * var(--ui-font-scale, 1)));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-backdrop .ios-case-wheel .ios-date-wheel-option.selected {
  font-size:clamp(calc(21px * var(--ui-font-scale, 1)),calc(6.2vw * var(--ui-font-scale, 1)),calc(24px * var(--ui-font-scale, 1)));
}
.calendar-event-form .calendar-case-row select,
html[data-theme="light"] .calendar-event-form .calendar-case-row select {
  width: min(190px,46vw);
  min-height: 42px;
  padding: 0;
  appearance: none;
  border: 0;
  background: transparent;
  color: #f4f7fc;
  box-shadow: none;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 550;
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
}

.calendar-event-form .calendar-note-field {
  gap: 13px;
  min-height: 132px;
  padding: 17px;
  color: #9fb1c9;
}

.calendar-event-form .calendar-note-field textarea,
html[data-theme="light"] .calendar-event-form .calendar-note-field textarea {
  min-height: 76px;
  padding: 0;
  border: 0;
  border-radius: 0;
  resize: none;
  background: transparent;
  color: #f4f7fc;
  box-shadow: none;
  font-size:calc(16px * var(--ui-font-scale, 1));
  font-weight: 450;
  line-height: 1.45;
}

.calendar-event-form .calendar-note-field textarea::placeholder {
  color: #8699b2;
  opacity: 1;
}

.calendar-event-form .calendar-form-voice-control {
  grid-template-columns: 54px minmax(0,1fr);
  gap: 14px;
  min-height: 84px;
  margin-top: 22px;
  padding: 13px 16px;
}

.calendar-event-form .calendar-form-voice-control button {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(145deg,rgba(24,195,158,.22),rgba(22,139,137,.16));
  color: #3de0b1;
}

.calendar-event-form .calendar-form-voice-control small {
  color: #9aacbf;
  font-size:calc(14px * var(--ui-font-scale, 1));
  font-weight: 450;
  line-height: 1.45;
}

html[data-theme="light"] .calendar-event-form .calendar-title-field,
html[data-theme="light"] .calendar-event-form .calendar-form-row,
html[data-theme="light"] .calendar-event-form .calendar-note-field,
html[data-theme="light"] .calendar-event-form .calendar-form-voice-control {
  border-color: rgba(30,102,77,.10);
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 24px rgba(30,78,61,.07),inset 0 1px 0 rgba(255,255,255,.8);
}

html[data-theme="light"] .calendar-event-form-head h2,
html[data-theme="light"] .calendar-event-form .calendar-title-field :is(input,textarea),
html[data-theme="light"] .calendar-event-form .calendar-row-title,
html[data-theme="light"] .calendar-event-form .calendar-alert-row b,
html[data-theme="light"] .calendar-event-form .calendar-case-row b,
html[data-theme="light"] .calendar-event-form .calendar-picker-display,
html[data-theme="light"] .calendar-event-form .calendar-case-row select,
html[data-theme="light"] .calendar-event-form .calendar-note-field textarea { color: #173229; }

.calendar-event > div { min-width: 0; }
.calendar-event strong.calendar-event-title {
  display: block;
  max-width: 100%;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.28;
}

.calendar-add-event.unavailable,
.calendar-add-event:disabled {
  cursor: default;
  opacity: .48;
  filter: saturate(.35);
}

@media (max-width: 430px) {
  .calendar-event-form { padding-right: 14px; padding-left: 14px; }
  .calendar-event-form .calendar-form-row { grid-template-columns: 44px minmax(72px,auto) minmax(0,1fr) 12px; gap: 9px; padding-right: 12px; padding-left: 11px; }
  .calendar-row-icon { width: 40px; height: 40px; border-radius: 13px; }
  .calendar-row-icon svg { width: 23px; height: 23px; }
}

/* Keep the densest event rows balanced when the app text setting is enlarged. */

/* iPhone Calendar inspired event editor, limited to the fields supported by the app. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ios-reference-event-form > .grabber { display: none; }

.ios-reference-event-form .calendar-event-form-head h2 {
  font-size:calc(22px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: -.025em;
}

.ios-reference-event-form .calendar-event-form-head button {
  display: grid;
  width: 54px;
  height: 54px;
  min-height: 54px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  background: #29292c;
  color: #fff;
  font-size:calc(39px * var(--ui-font-scale, 1));
  font-weight: 250;
  line-height: 1;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}

.ios-reference-event-form .calendar-event-form-head button:last-child {
  justify-self: end;
  background: #4a4a4e;
  font-size:calc(34px * var(--ui-font-scale, 1));
  font-weight: 450;
}

.ios-reference-event-form .ios-reference-event-fields {
  display: grid;
  gap: 20px;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.ios-reference-event-form .calendar-title-field,
.ios-reference-event-form .calendar-schedule-card,
.ios-reference-event-form .calendar-reminder-row,
.ios-reference-event-form .calendar-case-row,
.ios-reference-event-form .calendar-note-field {
  border: 0;
  border-radius: 24px;
  background: #2c2c2e;
  box-shadow: none;
}

.ios-reference-event-form .calendar-title-field {
  display: block;
  min-height: 96px;
  padding: 20px 18px;
}

.ios-reference-event-form .calendar-title-field :is(input,textarea) {
  min-height: 54px;
  color: #f5f5f7;
  font-size:calc(22px * var(--ui-font-scale, 1));
  font-weight: 450;
  line-height: 1.28;
}

.ios-reference-event-form .calendar-title-field :is(input,textarea)::placeholder {
  color: #8e8e93;
  font-weight: 450;
  opacity: 1;
}

.ios-reference-event-form .calendar-schedule-card {
  overflow: hidden;
}

.ios-reference-event-form .calendar-schedule-card .calendar-form-row {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ios-reference-event-form .calendar-date-row {
  grid-template-columns: minmax(76px,1fr) minmax(0,auto);
  gap: 12px;
  min-height: 66px;
  margin: 0 18px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.10) !important;
}

.ios-reference-event-form .calendar-time-range-row {
  display: block;
  min-height: 0;
  padding: 0 18px;
}

.ios-reference-event-form .calendar-time-range {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 0;
}

.ios-reference-event-form .calendar-time-line {
  display: grid;
  grid-template-columns: minmax(76px,1fr) minmax(0,auto);
  gap: 12px;
  min-height: 66px;
  align-items: center;
}

.ios-reference-event-form .calendar-time-line + .calendar-time-line {
  border-top: 1px solid rgba(255,255,255,.10);
}

.ios-reference-event-form .calendar-time-range.all-day-range .calendar-end-line {
  display: none;
}

.ios-reference-event-form .calendar-row-title,
.ios-reference-event-form .calendar-alert-row b,
.ios-reference-event-form .calendar-case-row b {
  color: #f5f5f7;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 500;
}

.ios-reference-event-form .calendar-date-row .calendar-picker-display,
.ios-reference-event-form .calendar-time-line .calendar-picker-display {
  min-height: 42px;
  padding: 7px 13px;
  border-radius: 16px;
  background: #3a3a3c;
  color: #f5f5f7;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 500;
  line-height: 1;
}

.ios-reference-event-form .calendar-reminder-row,
.ios-reference-event-form .calendar-second-reminder-row,
.ios-reference-event-form .calendar-case-row {
  grid-template-columns: minmax(105px,1fr) minmax(0,48%) 14px;
  gap: 10px;
  min-height: 68px;
  padding: 10px 16px 10px 18px;
}

.ios-reference-event-form .calendar-alert-row .calendar-picker-display,
.ios-reference-event-form .calendar-case-display {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  color: #a7a7ad;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 450;
  line-height: 1.15;
  text-align: right;
}

.ios-reference-event-form .calendar-case-display [data-picker-part="case"] {
  min-width: 0;
}

.ios-reference-event-form .calendar-note-field {
  display: block;
  min-height: 146px;
  padding: 18px;
}

.ios-reference-event-form .calendar-note-field textarea,
html[data-theme="light"] .ios-reference-event-form .calendar-note-field textarea {
  width: 100%;
  min-height: 110px;
  padding: 0;
  color: #f5f5f7;
  font-size:calc(17px * var(--ui-font-scale, 1));
  font-weight: 400;
  line-height: 1.4;
}

.ios-reference-event-form .calendar-note-field textarea::placeholder {
  color: #8e8e93;
}

html[data-theme="light"] .ios-reference-event-form .calendar-title-field,
html[data-theme="light"] .ios-reference-event-form .calendar-schedule-card,
html[data-theme="light"] .ios-reference-event-form .calendar-reminder-row,
html[data-theme="light"] .ios-reference-event-form .calendar-case-row,
html[data-theme="light"] .ios-reference-event-form .calendar-note-field {
  background: #fff;
}

html[data-theme="light"] .ios-reference-event-form .calendar-row-title,
html[data-theme="light"] .ios-reference-event-form .calendar-alert-row b,
html[data-theme="light"] .ios-reference-event-form .calendar-case-row b,
html[data-theme="light"] .ios-reference-event-form .calendar-title-field :is(input,textarea),
html[data-theme="light"] .ios-reference-event-form .calendar-note-field textarea {
  color: #161618;
}

html[data-theme="light"] .ios-reference-event-form .calendar-date-row .calendar-picker-display,
html[data-theme="light"] .ios-reference-event-form .calendar-time-line .calendar-picker-display {
  background: #ededf2;
  color: #161618;
}

/* Restore the product palette and accommodate a persistent second reminder. */

.ios-reference-event-form .calendar-event-form-head button:last-child {
  border-color: rgba(164,143,255,.30);
  background: linear-gradient(145deg,#8d75ff,#674be9);
  color: #fff;
  box-shadow: 0 8px 20px rgba(103,75,233,.28),inset 0 1px 0 rgba(255,255,255,.18);
}

.ios-reference-event-form .calendar-title-field,
.ios-reference-event-form .calendar-schedule-card,
.ios-reference-event-form .calendar-reminders-card,
.ios-reference-event-form .calendar-case-row,
.ios-reference-event-form .calendar-note-field {
  border: 1px solid rgba(140,171,210,.075);
  background: linear-gradient(145deg,rgba(29,51,79,.96),rgba(20,39,65,.97));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025),0 10px 26px rgba(0,0,0,.08);
}

.ios-reference-event-form .calendar-reminders-card {
  overflow: hidden;
  border-radius: 24px;
}

.ios-reference-event-form .calendar-reminders-card .calendar-reminder-row,
.ios-reference-event-form .calendar-reminders-card .calendar-second-reminder-row {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ios-reference-event-form .calendar-reminders-card .calendar-second-reminder-row {
  border-top: 1px solid rgba(140,171,210,.16);
}

html[data-theme="light"] .calendar-event-form.ios-reference-event-form {
  border-color: rgba(31,83,66,.12);
  background: linear-gradient(160deg,#f4faf7,#eaf4ef);
}

html[data-theme="light"] .ios-reference-event-form .calendar-event-form-head button {
  border-color: rgba(89,68,185,.12);
  background: rgba(255,255,255,.82);
  color: #7259e8;
}

html[data-theme="light"] .ios-reference-event-form .calendar-event-form-head button:last-child {
  background: linear-gradient(145deg,#8d75ff,#674be9);
  color: #fff;
}

html[data-theme="light"] .ios-reference-event-form .calendar-title-field,
html[data-theme="light"] .ios-reference-event-form .calendar-schedule-card,
html[data-theme="light"] .ios-reference-event-form .calendar-reminders-card,
html[data-theme="light"] .ios-reference-event-form .calendar-case-row,
html[data-theme="light"] .ios-reference-event-form .calendar-note-field {
  border-color: rgba(30,102,77,.10);
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 24px rgba(30,78,61,.07),inset 0 1px 0 rgba(255,255,255,.8);
}

html[data-theme="light"] .ios-reference-event-form .calendar-reminders-card .calendar-reminder-row,
html[data-theme="light"] .ios-reference-event-form .calendar-reminders-card .calendar-second-reminder-row { background: transparent; }

/* Compact event editor: keep the calendar palette and reserve more room for notes. */

.calendar-event-form.ios-reference-event-form {
  padding: 14px 15px calc(16px + env(safe-area-inset-bottom));
  border-color: rgba(126,158,204,.12);
  background: linear-gradient(160deg,#122640 0%,#09192d 52%,#10253e 100%);
  box-shadow: 0 -24px 70px rgba(3,12,27,.52);
}

.ios-reference-event-form .calendar-event-form-head {
  grid-template-columns: 50px minmax(0,1fr) 50px;
  min-height: 50px;
  margin-bottom: 12px;
}

.ios-reference-event-form .calendar-event-form-head button {
  width: 48px;
  height: 48px;
  min-height: 48px;
  border-color: rgba(150,134,255,.20);
  background: linear-gradient(145deg,#213b5b,#162e4b);
  color: #b8a8ff;
  font-size:calc(34px * var(--ui-font-scale, 1));
}

.ios-reference-event-form .calendar-event-form-head button:last-child {
  background: linear-gradient(145deg,#927cff,#694ce9);
  font-size:calc(30px * var(--ui-font-scale, 1));
}

.ios-reference-event-form .calendar-title-field {
  min-height: 78px;
  padding: 12px 16px;
}

.ios-reference-event-form .calendar-title-field :is(input,textarea) {
  min-height: 48px;
}

.ios-reference-event-form .calendar-date-row {
  min-height: 54px;
  margin: 0 15px;
  padding: 5px 0;
  border-bottom-color: rgba(142,176,219,.16) !important;
}

.ios-reference-event-form .calendar-time-range-row { padding: 0 15px; }

.ios-reference-event-form .calendar-time-line + .calendar-time-line {
  border-top-color: rgba(142,176,219,.16);
}

.ios-reference-event-form .calendar-date-row .calendar-picker-display,
.ios-reference-event-form .calendar-time-line .calendar-picker-display {
  min-height: 38px;
  padding: 5px 11px;
  border-radius: 14px;
  background: #264463;
}

.ios-reference-event-form .calendar-reminders-card { border-radius: 22px; }

.ios-reference-event-form .calendar-reminder-row,
.ios-reference-event-form .calendar-second-reminder-row,
.ios-reference-event-form .calendar-case-row {
  grid-template-columns: minmax(112px,1fr) minmax(0,46%) 12px;
  gap: 8px;
  min-height: 56px;
  padding: 5px 13px 5px 15px;
}

.ios-reference-event-form .calendar-reminders-card .calendar-reminder-row,
.ios-reference-event-form .calendar-reminders-card .calendar-second-reminder-row {
  background: transparent;
}

.ios-reference-event-form .calendar-alert-row b,
.ios-reference-event-form .calendar-case-row b,
.ios-reference-event-form .calendar-alert-row .calendar-picker-display,
.ios-reference-event-form .calendar-case-display {
  font-size:calc(15px * var(--ui-font-scale, 1));
  line-height: 1.15;
}

.ios-reference-event-form .calendar-row-chevron {
  color: #8da3bf;
  font-size:calc(24px * var(--ui-font-scale, 1));
}

.ios-reference-event-form .calendar-note-field {
  min-height: 166px;
  padding: 14px 16px;
}

html[data-text-size="large"] .ios-reference-event-form .calendar-alert-row b,
html[data-text-size="large"] .ios-reference-event-form .calendar-case-row b,
html[data-text-size="large"] .ios-reference-event-form .calendar-alert-row .calendar-picker-display,
html[data-text-size="large"] .ios-reference-event-form .calendar-case-display,
html[data-text-size="large"] .ios-reference-event-form .calendar-alert-row b,
html[data-text-size="large"] .ios-reference-event-form .calendar-case-row b,
html[data-text-size="large"] .ios-reference-event-form .calendar-alert-row .calendar-picker-display,
html[data-text-size="large"] .ios-reference-event-form .calendar-case-display {
  font-size:calc(14px * var(--ui-font-scale, 1));
}

/* Keep the event actions below the iPhone system area and outside field scrolling. */
.calendar-event-form.ios-reference-event-form {
  display: flex;
  height: min(calc(100dvh - max(env(safe-area-inset-top),48px)),920px);
  max-height: min(calc(100dvh - max(env(safe-area-inset-top),48px)),920px);
  flex-direction: column;
  overflow: hidden;
}

.ios-reference-event-form .calendar-event-form-head {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  margin: 0 -1px 10px;
  padding: 0 1px 8px;
  background: linear-gradient(180deg,var(--bg),var(--panel2));
  box-shadow: 0 8px 14px color-mix(in srgb,var(--text) 8%,transparent);
}

.ios-reference-event-form .calendar-event-form-head h2 {
  font-size:calc(20px * var(--ui-font-scale, 1));
  white-space: nowrap;
}

.ios-reference-event-form .ios-reference-event-fields {
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: none;
}

.ios-reference-event-form .ios-reference-event-fields::-webkit-scrollbar { display: none; }

.ios-reference-event-form .calendar-date-row,
.ios-reference-event-form .calendar-time-line {
  min-height: 47px;
}

.ios-reference-event-form .calendar-date-row {
  padding-top: 3px;
  padding-bottom: 3px;
}

.ios-reference-event-form .calendar-date-row .calendar-picker-display,
.ios-reference-event-form .calendar-time-line .calendar-picker-display {
  min-height: 34px;
  padding: 4px 10px;
}

.ios-reference-event-form .calendar-reminder-row,
.ios-reference-event-form .calendar-second-reminder-row,
.ios-reference-event-form .calendar-case-row {
  min-height: 48px;
  padding-top: 3px;
  padding-bottom: 3px;
}

.ios-reference-event-form .calendar-note-field {
  min-height: 188px;
}

/* Give the event time a safe column before the vertical event divider. */
.calendar-event-swipe-row .calendar-event {
  grid-template-columns: 96px 3px minmax(0,1fr) 10px;
  column-gap: 14px;
}

.calendar-event-swipe-row .calendar-event time {
  min-width: 0;
  white-space: nowrap;
}

.calendar-event-discard-backdrop {
  z-index: 145;
  background: rgba(5,18,36,.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.calendar-event-discard-sheet {
  border-color: rgba(137,118,255,.18);
  background: linear-gradient(160deg,#142a47,#0b1c32);
}

.calendar-event-discard-sheet .case-delete-actions {
  grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr);
}

.calendar-event-discard-sheet .case-delete-actions button {
  padding-right: 10px;
  padding-left: 10px;
  white-space: normal;
}

/* A denser, Apple-like picker rhythm for date, time and reminder wheels. */
.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) {
  padding: 6px 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: 22px;
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) header {
  min-height: 46px;
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) header strong {
  font-size:calc(15px * var(--ui-font-scale, 1));
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) header button {
  font-size:calc(14px * var(--ui-font-scale, 1));
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-columns {
  height: 248px;
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-column {
  height: 248px;
  padding-top: 100px;
  padding-bottom: 100px;
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-selection {
  top: 100px;
  height: 48px;
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-option {
  height: 48px;
  font-size:clamp(calc(16px * var(--ui-font-scale, 1)),calc(4.6vw * var(--ui-font-scale, 1)),calc(18px * var(--ui-font-scale, 1)));
  line-height: 48px;
}

.calendar-event-backdrop .ios-date-wheel.ios-event-date-wheel:not(.ios-calendar-month-wheel) .ios-date-wheel-option.selected {
  font-size:clamp(calc(20px * var(--ui-font-scale, 1)),calc(5.8vw * var(--ui-font-scale, 1)),calc(23px * var(--ui-font-scale, 1)));
}

/* Reminder values must stay on one row even with larger interface text. */
.calendar-event-backdrop .ios-date-wheel.ios-alert-wheel:not(.ios-case-wheel) .ios-date-wheel-columns {
  padding-right: 20px;
  padding-left: 20px;
}

.calendar-event-backdrop .ios-date-wheel.ios-alert-wheel:not(.ios-case-wheel) .ios-date-wheel-option {
  overflow: hidden;
  padding-right: 8px;
  padding-left: 8px;
  font-size:clamp(calc(15px * var(--ui-font-scale, 1)),calc(4.3vw * var(--ui-font-scale, 1)),calc(17px * var(--ui-font-scale, 1)));
  line-height: 64px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-backdrop .ios-date-wheel.ios-alert-wheel:not(.ios-case-wheel) .ios-date-wheel-option.selected {
  font-size:clamp(calc(18px * var(--ui-font-scale, 1)),calc(5.1vw * var(--ui-font-scale, 1)),calc(20px * var(--ui-font-scale, 1)));
  transform: scale(1.02);
}

.calendar-event-backdrop .ios-date-wheel:is(.ios-time-wheel,.ios-alert-wheel:not(.ios-case-wheel)) .ios-date-wheel-columns {
  height: 248px;
}

.calendar-event-backdrop .ios-date-wheel:is(.ios-time-wheel,.ios-alert-wheel:not(.ios-case-wheel)) .ios-date-wheel-column {
  height: 248px;
  padding-top: 100px;
  padding-bottom: 100px;
}

.calendar-event-backdrop .ios-date-wheel:is(.ios-time-wheel,.ios-alert-wheel:not(.ios-case-wheel)) .ios-date-wheel-selection {
  top: 100px;
  height: 48px;
}

.calendar-event-backdrop .ios-date-wheel:is(.ios-time-wheel,.ios-alert-wheel:not(.ios-case-wheel)) .ios-date-wheel-option {
  height: 48px;
  line-height: 48px;
}

.calendar-event-backdrop .ios-date-wheel.ios-time-wheel .ios-date-wheel-columns::after {
  top: 100px;
  height: 48px;
  line-height: 48px;
}

/* Native-style top-edge tap target for the independently scrolling calendar. */
.calendar-scroll-top-hitarea {
  position: fixed;
  z-index: 59;
  top: 0;
  left: 50%;
  width: min(100%,480px);
  height: max(env(safe-area-inset-top),18px);
  transform: translateX(-50%);
  background: transparent;
  touch-action: pan-y;
}

/* Dark event editor colors reuse the calendar design tokens; geometry stays unchanged. */
html:not([data-theme="light"]) .calendar-event-backdrop {
  background: color-mix(in srgb,var(--bg) 78%,transparent);
}

html:not([data-theme="light"]) .calendar-event-form.ios-reference-event-form {
  border-color: color-mix(in srgb,var(--accent) 22%,transparent);
  background: linear-gradient(180deg,var(--bg),color-mix(in srgb,var(--bg) 88%,#000));
  box-shadow: 0 -24px 70px rgba(3,12,27,.52);
  color: var(--text);
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-event-form-head {
  background: linear-gradient(180deg,var(--bg),color-mix(in srgb,var(--bg) 92%,var(--panel)));
  box-shadow: 0 8px 14px color-mix(in srgb,var(--bg) 72%,transparent);
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-event-form-head h2 { color: var(--text); }

html:not([data-theme="light"]) .ios-reference-event-form .calendar-event-form-head button {
  border-color: color-mix(in srgb,var(--accent) 22%,transparent);
  background: var(--panel);
  color: color-mix(in srgb,var(--accent) 72%,#fff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-event-form-head button:last-child {
  border-color: color-mix(in srgb,var(--accent) 34%,transparent);
  background: linear-gradient(145deg,color-mix(in srgb,var(--accent) 86%,#fff),var(--accent));
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb,var(--accent) 27%,transparent),inset 0 1px 0 rgba(255,255,255,.16);
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-title-field,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-schedule-card,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-reminders-card,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-case-row,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-note-field {
  border-color: color-mix(in srgb,var(--accent) 20%,transparent);
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025),0 8px 22px rgba(3,12,27,.10);
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-row-title,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-alert-row b,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-case-row b,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-title-field :is(input,textarea),
html:not([data-theme="light"]) .ios-reference-event-form .calendar-note-field textarea { color: var(--text); }

html:not([data-theme="light"]) .ios-reference-event-form .calendar-title-field :is(input,textarea)::placeholder,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-note-field textarea::placeholder {
  color: color-mix(in srgb,var(--muted) 72%,var(--bg));
  opacity: 1;
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-date-row,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-time-line + .calendar-time-line,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-reminders-card .calendar-second-reminder-row {
  border-color: color-mix(in srgb,var(--muted) 16%,transparent) !important;
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-date-row .calendar-picker-display,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-time-line .calendar-picker-display {
  background: color-mix(in srgb,var(--panel2) 92%,var(--accent));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-alert-row .calendar-picker-display,
html:not([data-theme="light"]) .ios-reference-event-form .calendar-case-display {
  color: color-mix(in srgb,var(--text) 82%,var(--muted));
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-row-chevron {
  color: color-mix(in srgb,var(--muted) 84%,var(--accent));
}

/* Event importance tags and compact, centered multi-dot calendar markers. */
.calendar .days button.has-event::after { content: none; }

.calendar-day-number { position: relative; z-index: 1; line-height: 1; }

.calendar-event-dots {
  position: absolute;
  z-index: 2;
  top: calc(75% + .25em);
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%,-50%);
}

.calendar-event-dot {
  display: block;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--panel);
}

.calendar-event-dot + .calendar-event-dot { margin-left: -2px; }
.calendar-event-dot.green,
.calendar-tag-swatch.green { --tag-color:var(--calendar-tag-green); background: var(--tag-color); }
.calendar-event-dot.yellow,
.calendar-tag-swatch.yellow { --tag-color:var(--calendar-tag-yellow); background: var(--tag-color); }
.calendar-event-dot.red,
.calendar-tag-swatch.red { --tag-color:var(--calendar-tag-red); background: var(--tag-color); }
.calendar-event-dot.purple,
.calendar-tag-swatch.purple { --tag-color:var(--calendar-tag-purple); background: var(--tag-color); }
.calendar-event-dot.blue,
.calendar-tag-swatch.blue { --tag-color:var(--calendar-tag-blue); background: var(--tag-color); }
.calendar-event-dot.white,
.calendar-tag-swatch.white { --tag-color:var(--calendar-tag-white); background: var(--tag-color); }
.accent-line.green { background: var(--calendar-tag-green); }
.accent-line.yellow { background: var(--calendar-tag-yellow); }
.accent-line.red { background: var(--calendar-tag-red); }
.accent-line.purple { background: var(--calendar-tag-purple); }
.accent-line.blue { background: var(--calendar-tag-blue); }
.accent-line.white { background: var(--calendar-tag-white); }

.ios-reference-event-form .calendar-tag-row {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-items: center;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 7px 20px;
  border: 1px solid rgba(132,168,215,.10);
  border-radius: 22px;
  background: linear-gradient(145deg,#1d3655,#142a47);
}

.ios-reference-event-form .calendar-tag-options {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0;
}

.calendar-tag-option {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.calendar-tag-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.calendar-tag-swatch {
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 50%;
  transition: transform .16s ease,box-shadow .16s ease;
}

.calendar-tag-option input:checked + .calendar-tag-swatch {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--panel),0 0 0 5px var(--tag-color);
}

.calendar-tag-option input:focus-visible + .calendar-tag-swatch {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

html:not([data-theme="light"]) .ios-reference-event-form .calendar-tag-row {
  border-color: color-mix(in srgb,var(--accent) 20%,transparent);
  background: linear-gradient(145deg,var(--panel2),var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025),0 8px 22px rgba(3,12,27,.10);
}

@media (max-width: 360px) {
  .ios-reference-event-form .calendar-tag-row { padding-right: 14px; padding-left: 14px; }
  .calendar-tag-option { width: 26px; height: 26px; flex-basis: 26px; }
  .calendar-tag-swatch { width: 18px; height: 18px; }
}

/* Материал без дела (29.09.2026): пункт «Новое дело» в выборе дела и пояснение в заметке. */
.new-case-choice .new-case-avatar {
  display: grid;
  place-items: center;
  background: rgba(116, 88, 255, .16);
  color: #a895ff;
  font-size: calc(22px * var(--ui-font-scale, 1));
  font-weight: 500;
  line-height: 1;
}
.note-no-case {
  display: grid;
  gap: 10px;
}
.note-no-case .note-case-label { margin-bottom: 0; }
.note-no-case p {
  margin: 0;
  color: var(--muted);
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.45;
}
