/* PersonalOS 13 additive design system and module styling. */
:root {
  --os7-accent: #188568;
  --os7-tab-delay: 300ms;
  --os7-avatar-position: 50% 50%;
}
html[data-os7-theme="green"] { --os7-theme: #188568; --os7-theme-soft: #e9f6f1; --os7-theme-border: #b8e4d5; }
html[data-os7-theme="blue"] { --os7-theme: #2563eb; --os7-theme-soft: #edf4ff; --os7-theme-border: #bfd5ff; }
html[data-os7-theme="purple"] { --os7-theme: #7c3aed; --os7-theme-soft: #f3edff; --os7-theme-border: #d8c7ff; }
html[data-os7-theme="teal"] { --os7-theme: #0f9b9a; --os7-theme-soft: #e7f8f7; --os7-theme-border: #b8e9e6; }
html[data-os7-theme="neutral"] { --os7-theme: #596579; --os7-theme-soft: #f0f2f5; --os7-theme-border: #d3d8e0; }

.main-content.page-entering.page-entered { transition: opacity var(--os7-page-duration, var(--os7-tab-delay)) ease-out, transform var(--os7-page-duration, var(--os7-tab-delay)) cubic-bezier(.2,0,0,1); }
html[data-os7-theme] .primary-button { background: var(--os7-accent); border-color: var(--os7-accent); }
html[data-os7-theme] .primary-button:hover:not(:disabled) { filter: brightness(.94); }
html[data-os7-theme] :is(button,input,select,textarea,a):focus-visible { outline-color: color-mix(in srgb, var(--os7-accent) 35%, transparent); }
html[data-os7-theme] .os7-theme-marker { background: var(--os7-theme-soft); border-color: var(--os7-theme-border); }

.os7-inline-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.os7-inline-actions > * { min-width:0; }
.os7-wide { grid-column:1/-1; }
.os7-section-gap { margin-top:25px; }
.os7-caveat { padding:11px 13px; border:1px solid var(--warning-soft,#f4dfb6); border-radius:10px; background:var(--warning-soft,#fff6e3); color:var(--text); font-size:12px; line-height:1.6; }
.os7-empty { display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:22px; border:1px dashed var(--border-strong); border-radius:13px; color:var(--muted); }
.os7-empty strong { color:var(--text); }
.os7-empty-inline { color:var(--muted); font-size:12px; }
.os7-verify-status { display:inline-flex; width:max-content; max-width:100%; margin-top:6px; padding:4px 8px; border:1px solid var(--border); border-radius:999px; color:var(--muted); background:var(--surface-2); font-size:10px; font-weight:700; }

/* Scientific calculator */
.os7-calc-card .surface-card-body { display:grid; gap:15px; }
.os7-science-tools { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.os7-science-tools label { display:grid; gap:7px; min-width:min(100%,230px); font-size:12px; font-weight:700; }
.os7-science-tags { display:flex; flex-wrap:wrap; gap:7px; }
.os7-science-tags span,.os7-formula-group { padding:5px 9px; border-radius:999px; background:var(--os7-theme-soft,#e9f6f1); border:1px solid var(--os7-theme-border,#b8e4d5); color:var(--text); font-size:10px; font-weight:750; }
.os7-calc-expression-label { display:grid; gap:7px; font-size:12px; color:var(--muted); font-weight:700; }
.os7-calc-expression { min-height:54px; font-size:20px; font-variant-numeric:tabular-nums; }
.os7-calc-result { display:flex; flex-direction:column; justify-content:center; gap:7px; min-height:90px; padding:16px 18px; border:1px solid var(--os7-theme-border,#b8e4d5); border-radius:14px; background:var(--os7-theme-soft,#e9f6f1); overflow-wrap:anywhere; }
.os7-calc-result small,.os7-conversion-result small { font-size:10px; font-weight:800; letter-spacing:.12em; color:var(--muted); }
.os7-calc-result strong { font-size:clamp(21px,4vw,32px); line-height:1.25; font-variant-numeric:tabular-nums; }
.os7-calc-keypad { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
.os7-calc-keypad button { min-width:0; min-height:47px; padding:8px 4px; border-radius:11px; font-size:clamp(12px,1.4vw,16px); font-weight:750; }
.os7-calc-history { margin-top:18px; }
.os7-calc-history-row { width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 3px; border:0; border-bottom:1px solid var(--border); background:transparent; text-align:left; cursor:pointer; }
.os7-calc-history-row span { color:var(--muted); overflow-wrap:anywhere; }
.os7-calc-history-row strong { color:var(--text); font-variant-numeric:tabular-nums; }
.os7-unit-grid,.os7-settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.os7-unit-grid label,.os7-settings-grid label { display:grid; min-width:0; align-content:start; gap:7px; color:var(--muted); font-size:12px; font-weight:700; }
.os7-conversion-result { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:16px; padding:14px 16px; border:1px solid var(--border); border-radius:12px; background:var(--surface-2); }
.os7-conversion-result small { flex-basis:100%; }
.os7-conversion-result strong { flex:1; min-width:130px; overflow-wrap:anywhere; font-size:clamp(20px,3vw,28px); font-variant-numeric:tabular-nums; }
.os7-modal-form { display:flex; flex-direction:column; min-height:0; }
.os7-form-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; overflow:auto; }
.os7-modal-result { grid-column:1/-1; padding:10px 12px; border-radius:10px; background:var(--surface-2); color:var(--text); overflow-wrap:anywhere; white-space:pre-wrap; }
.os7-expression-code { display:block; grid-column:1/-1; }

/* Chemical notebook and source-qualified identity results */
.os7-chem-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:9px; align-items:center; margin-bottom:13px; }
.os7-chemical-results,.os7-chemical-table { display:grid; gap:10px; margin-top:14px; }
.os7-chemical-result,.os7-notebook-row { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; min-width:0; padding:16px; border:1px solid var(--border); border-radius:13px; background:var(--surface); }
.os7-chemical-main { min-width:0; width:100%; }
.os7-chemical-main h3,.os7-notebook-row h3 { margin:0; font-size:15px; overflow-wrap:anywhere; }
.os7-chem-properties { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:13px 0; }
.os7-chem-properties span { display:grid; gap:4px; min-width:0; padding:9px 10px; border:1px solid var(--border); border-radius:9px; background:var(--surface-2); overflow-wrap:anywhere; }
.os7-chem-properties small { color:var(--muted); font-size:10px; }
.os7-chem-properties strong { font-size:12px; }
.os7-chemical-result .os7-caveat { margin:10px 0; }
.os7-manual-chem { margin-top:18px; padding:15px; border:1px dashed var(--border-strong); border-radius:12px; }
.os7-manual-chem h3 { margin:0 0 6px; }
.os7-manual-chem p { margin:0 0 12px; color:var(--muted); font-size:12px; }
.os7-notebook-toolbar { display:flex; align-items:center; gap:12px; }
.os7-notebook-toolbar input { flex:1; min-width:0; }
.os7-notebook-toolbar span { color:var(--muted); font-size:11px; white-space:nowrap; }
.os7-notebook-row > div:first-child { flex:1; min-width:0; }
.os7-notebook-row p { margin:6px 0; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.os7-notebook-row small { display:block; margin:4px 0 9px; color:var(--muted-2); font-size:11px; }
.os7-notebook-row a { display:inline-block; margin:5px 10px 5px 0; color:var(--os7-accent); font-size:12px; }
.os7-chem-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; overflow:auto; }
.os7-chem-form-grid .field-group { min-width:0; display:grid; gap:6px; align-content:start; color:var(--muted); font-size:12px; }
.os7-chem-form-grid .input-control { min-width:0; }

/* Shared calendar/work composer and persistent color palette */
.os7-composer-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; overflow:auto; }
.os7-composer-grid .field-group { min-width:0; display:grid; gap:6px; align-content:start; color:var(--muted); font-size:12px; }
.os7-palette-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.os7-color-swatch { width:30px; height:30px; min-width:30px; padding:0; border:2px solid var(--border); border-radius:50%; background:var(--swatch); cursor:pointer; }
.os7-color-swatch[aria-pressed="true"] { outline:3px solid var(--os7-accent); outline-offset:2px; border-color:white; }
.os7-color-picker { width:46px; min-width:46px; height:35px; padding:3px; }
.os7-custom-color-add { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; margin-top:10px; align-items:center; }
.os7-custom-palette { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:8px; }
.os7-color-swatch-static { display:inline-block; flex:0 0 23px; width:23px; height:23px; border:1px solid var(--border); border-radius:50%; background:var(--swatch); }
.os7-palette-manager { margin-top:25px; padding-top:18px; border-top:1px solid var(--border); }
.os7-palette-manager h3 { margin:0 0 6px; }
.os7-palette-row { display:grid; grid-template-columns:25px minmax(80px,1fr) auto auto auto; align-items:center; gap:9px; padding:9px 0; border-bottom:1px solid var(--border); }
.os7-palette-row code { padding:4px 6px; border:1px solid var(--border); border-radius:7px; background:var(--surface-2); }
.os7-modal-backdrop { position:fixed; inset:0; z-index:1500; display:flex; align-items:center; justify-content:center; padding:22px; background:rgba(13,27,43,.48); backdrop-filter:blur(3px); }
.os7-modal-card { max-width:800px; max-height:min(92dvh,900px); }
.os7-modal-card .modal-header,.os7-modal-card .modal-footer { flex:0 0 auto; }
.os7-modal-card .modal-body { overflow:auto; min-height:0; }

/* Stopwatch/timer flip animation: only changing glyphs animate. */
.p6-flip-digit { perspective:300px; }
.p6-flip-char { display:inline-block; transform-origin:50% 45%; backface-visibility:hidden; }
.p6-flip-char.is-flipping { animation:os7-digit-flip 220ms cubic-bezier(.2,.7,.3,1); }
@keyframes os7-digit-flip { 0% { transform:rotateX(-85deg); opacity:.5; } 55% { transform:rotateX(14deg); opacity:1; } 100% { transform:rotateX(0); opacity:1; } }

.os7-clock-history { margin-top:16px; }
.os7-clock-history-row { display:flex; justify-content:space-between; gap:14px; padding:13px 0; border-bottom:1px solid var(--border); }
.os7-clock-history-row:last-child { border-bottom:0; }
.os7-clock-history-row > div:first-child { min-width:0; }
.os7-clock-history-row strong { overflow-wrap:anywhere; }
.os7-clock-history-row p { margin:5px 0; color:var(--muted); font-size:11px; }
.os7-clock-history-row small { color:var(--muted); }

/* Personal notes / profile additions */
.os7-note-organization-row { display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0; margin:6px 0; }
.os7-note-organization-row .os7-note-organization { min-width:0; margin:0; overflow-wrap:anywhere; }
.os7-note-logo-slot { flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border:1px solid var(--border); border-radius:8px; background:var(--surface-2); overflow:hidden; }
.os7-note-logo { max-width:100%; max-height:100%; object-fit:contain; }
.os7-note-logo-slot [data-p2-photo-fallback] { font-size:8px; line-height:1.2; text-align:center; color:var(--muted); padding:3px; }

.os7-note-organization { color:var(--muted); font-size:11px; margin:6px 0; }
.os7-note-logo-preview { display:flex; align-items:center; gap:10px; margin-top:8px; }
.os7-note-logo-preview img { width:56px; height:56px; object-fit:contain; border:1px solid var(--border); border-radius:10px; background:#fff; }
.p2-profile-avatar { object-position:var(--os7-avatar-position,50% 50%); }
.p2-avatar-placeholder { object-position:var(--os7-avatar-position,50% 50%); }

@media (max-width:900px) {
  .os7-palette-row { grid-template-columns:25px minmax(70px,1fr) auto; }
  .os7-palette-row button { min-height:37px; }
}
@media (max-width:620px) {
  .os7-calc-keypad { grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
  .os7-calc-keypad button { min-height:45px; }
  .os7-wide { grid-column:auto; }
  .os7-science-tools { align-items:stretch; }
  .os7-science-tools label { min-width:0; }
  .os7-chem-search { grid-template-columns:minmax(0,1fr); }
  .os7-chem-search button { width:100%; }
  .os7-chemical-result,.os7-notebook-row,.os7-clock-history-row { flex-direction:column; }
  .os7-chemical-result .os7-inline-actions,.os7-notebook-row .os7-inline-actions { width:100%; }
  .os7-notebook-toolbar { align-items:stretch; flex-direction:column; }
  .os7-chem-properties { grid-template-columns:minmax(0,1fr); }
  .os7-modal-backdrop { align-items:flex-end; padding:0; }
  .os7-modal-card { width:100%; max-width:none; max-height:94dvh; border-radius:18px 18px 0 0; }
  .os7-modal-card .modal-body { padding:15px 16px calc(16px + env(safe-area-inset-bottom)); }
  .os7-modal-card .modal-footer { padding-bottom:calc(12px + env(safe-area-inset-bottom)); flex-wrap:wrap; }
  .os7-modal-card .modal-footer button { flex:1 1 auto; }
  .os7-palette-row { grid-template-columns:25px minmax(0,1fr); }
  .os7-palette-row code { grid-column:2; width:max-content; }
  .os7-palette-row button { grid-column:2; width:100%; }
  .os7-custom-color-add { grid-template-columns:minmax(0,1fr); }
  .os7-custom-color-add button { width:100%; }
  .os7-clock-history-row .os7-inline-actions { width:100%; }
}
@media (prefers-reduced-motion: reduce) {
  .p6-flip-char.is-flipping { animation:none !important; }
  .main-content.page-entering,.main-content.page-entering.page-entered { opacity:1!important; transform:none!important; transition:none!important; }
}


/* PersonalOS 13 — polished interactions and responsive fixes */
.os8-calculator-basic .os7-calc-keypad { grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.os8-calculator-basic .os7-calc-keypad button { min-height:clamp(46px,6vw,62px); font-size:clamp(15px,1.8vw,19px); border-radius:13px; }
.os8-calculator-basic .os7-calc-keypad button.os8-calc-operator { background:var(--os7-theme-soft,#e9f6f1); color:var(--os7-accent); border-color:var(--os7-theme-border,#b8e4d5); }
.os8-calculator-science .os7-calc-science-keypad { grid-template-columns:repeat(5,minmax(0,1fr)); }
.os8-calculator-basic .os7-calc-result { min-height:112px; }
.os8-calculator-basic .os7-calc-expression { text-align:right; font-variant-numeric:tabular-nums; }

/* Whole-card flip. The JS changes individual digits, while the card itself animates. */
.p6-flip-group { perspective:800px; }
.p6-flip-digit { transform-origin:50% 50%; transform-style:preserve-3d; backface-visibility:hidden; }
.p6-flip-digit.is-flipping { animation:os8-card-flip 260ms cubic-bezier(.2,.7,.3,1); }
@keyframes os8-card-flip {
  0% { transform:rotateX(0deg); filter:brightness(1); }
  43% { transform:rotateX(-76deg); filter:brightness(.78); }
  58% { transform:rotateX(12deg); filter:brightness(.94); }
  100% { transform:rotateX(0deg); filter:brightness(1); }
}

/* Compact palette trigger: the palette stays hidden until the user opens it. */
.os8-color-control { position:relative; display:grid; gap:8px; min-width:0; }
.os8-color-trigger { display:flex; align-items:center; gap:10px; width:max-content; max-width:100%; min-height:44px; padding:9px 12px; border:1px solid var(--border-strong); border-radius:11px; background:var(--surface); color:var(--text); text-align:left; cursor:pointer; }
.os8-color-trigger:hover { border-color:var(--os7-accent); }
.os8-color-trigger-swatch { flex:0 0 23px; width:23px; height:23px; border-radius:50%; background:var(--swatch); border:1px solid rgba(0,0,0,.14); box-shadow:inset 0 0 0 2px rgba(255,255,255,.38); }
.os8-color-trigger code { color:var(--muted); font-size:11px; margin-left:auto; }
.os8-color-chevron { color:var(--muted); margin-left:4px; }
.os8-color-popover[hidden] { display:none !important; }
.os8-color-popover { display:grid; gap:10px; width:min(100%,500px); max-height:min(48dvh,420px); overflow:auto; overscroll-behavior:contain; padding:14px; border:1px solid var(--border); border-radius:13px; background:var(--surface); box-shadow:0 12px 32px rgba(20,34,50,.13); }
.os8-color-popover-head { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.os8-color-popover-head strong { color:var(--text); font-size:12px; }
.os8-color-popover-head small { color:var(--muted); font-size:10px; }
.os8-color-popover .os7-palette-row { display:flex; flex-wrap:wrap; align-items:center; gap:9px; padding:0; border:0; }
.os8-color-popover .os7-color-swatch { flex:0 0 30px; width:30px; height:30px; border-radius:50%; padding:0; border:2px solid rgba(0,0,0,.10); background:var(--swatch); cursor:pointer; }
.os8-color-popover .os7-color-swatch[aria-pressed="true"] { outline:3px solid var(--os7-accent); outline-offset:2px; }
.os8-custom-color-picker { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:10px; border-top:1px solid var(--border); color:var(--muted); font-size:12px; }
.os8-custom-color-picker .os7-color-picker { flex:0 0 52px; width:52px; height:38px; }
.os8-custom-color-add { margin-top:0; }

/* Root cause fix for calendar/work composer: the form is a flex column and the
   form body owns vertical scrolling; the nested grid must not compete for scroll. */
.os7-modal-backdrop { overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.os7-modal-card { display:flex; flex-direction:column; width:min(800px,100%); height:min(92dvh,900px); min-height:0; overflow:hidden; }
.os7-modal-card > form { display:flex; flex:1 1 auto; flex-direction:column; width:100%; height:100%; min-height:0; overflow:hidden; }
.os7-modal-card > form > .modal-header { flex:0 0 auto; }
.os7-modal-card > form > .modal-body { flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.os7-composer-grid { overflow:visible; min-height:0; }
.os7-composer-grid .field-group { min-width:0; }
.os7-modal-card > form > .modal-footer { flex:0 0 auto; }

/* Note type chooser screenshot fix: readable, clearly differentiated cards. */
.p2-note-type-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; width:100%; }
.p2-note-type-choice { display:flex; flex-direction:column; align-items:flex-start; gap:9px; width:100%; min-width:0; min-height:155px; padding:18px; border:1px solid var(--border); border-radius:15px; background:var(--surface); color:var(--text); text-align:left; white-space:normal; box-shadow:0 2px 8px rgba(25,40,55,.04); cursor:pointer; }
.p2-note-type-choice:hover { border-color:var(--os7-accent); background:var(--os7-theme-soft,#e9f6f1); transform:translateY(-1px); }
.p2-note-type-choice:focus-visible { outline:3px solid color-mix(in srgb,var(--os7-accent) 38%, transparent); outline-offset:2px; }
.p2-note-type-icon { display:grid; place-items:center; width:38px; height:38px; border-radius:11px; background:var(--os7-theme-soft,#e9f6f1); color:var(--os7-accent); font-size:20px; font-weight:800; }
.p2-note-type-choice strong { font-size:14px; line-height:1.4; }
.p2-note-type-choice small { color:var(--muted); font-size:12px; line-height:1.55; }

@media (max-width:620px) {
  .os8-calculator-basic .os7-calc-keypad { gap:7px; }
  .os8-calculator-basic .os7-calc-keypad button { min-height:51px; border-radius:12px; }
  .os8-calculator-science .os7-calc-science-keypad { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .os8-color-trigger { width:100%; }
  .os8-color-popover { width:100%; max-height:42dvh; padding:12px; }
  .os7-modal-backdrop { align-items:flex-end; padding:0; }
  .os7-modal-card { width:100%; height:min(94dvh,900px); max-height:94dvh; border-radius:18px 18px 0 0; }
  .os7-modal-card > form > .modal-body { padding:15px 16px calc(16px + env(safe-area-inset-bottom)); }
  .os7-modal-card > form > .modal-footer { padding-bottom:calc(12px + env(safe-area-inset-bottom)); flex-wrap:wrap; }
  .os7-modal-card > form > .modal-footer button { min-height:44px; flex:1 1 auto; }
  .p2-note-type-choices { grid-template-columns:minmax(0,1fr); }
  .p2-note-type-choice { min-height:0; padding:15px; }
}
@media (prefers-reduced-motion: reduce) {
  .p6-flip-digit.is-flipping { animation:none !important; }
  .p2-note-type-choice:hover { transform:none; }
}

/* Scientific calculator memory controls: touch-friendly and wrap on narrow screens. */
.os8-calc-memory { display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin-top:12px; padding:10px; border:1px solid var(--border); border-radius:12px; background:var(--surface-muted, var(--surface)); }
.os8-calc-memory .os8-memory-value { margin-right:auto; min-width:95px; color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.os8-calc-memory button { min-height:38px; padding:7px 10px; font-size:12px; }
.os7-modal-card select.input-control { max-width:100%; }
@media (max-width:620px) { .os8-calc-memory { gap:6px; } .os8-calc-memory .os8-memory-value { flex:1 0 100%; } .os8-calc-memory button { flex:1 1 auto; min-height:42px; } }


/* PersonalOS 13 presentation refinements: reduce visual collisions and improve hierarchy. */
.page-actions,.notice-actions,.p2-toolbar-actions,.p2-row-actions,.p2-card-actions,
.q-template-links,.q-exam-actions,.q-actions,.q-history-actions,.q-attempt-footer,
.p6-clock-actions,.p6-timer-presets,
.os8-calc-memory,.os7-inline-actions,.modal-footer,.modal-actions {
  column-gap:10px; row-gap:9px;
}
.page-actions > button,.notice-actions > button,.p2-toolbar-actions > button,
.q-template-links > .secondary-button,.q-exam-actions > button,.q-actions > button,
.q-history-actions > button,.p6-clock-actions > button,.p6-timer-presets > button,
.modal-footer > button {
  flex-shrink:0; max-width:100%;
}
.q-template-links { display:flex; align-items:center; flex-wrap:wrap; gap:8px 10px; min-width:0; }
.q-template-links .field-help { flex:0 0 auto; margin:0; }
.p2-row-actions { gap:8px; }
.p2-toolbar { gap:10px; }
.page-actions > button:focus-visible,.surface-card-header button:focus-visible,
.p2-row-actions button:focus-visible,.q-template-links a:focus-visible {
  outline:3px solid color-mix(in srgb,var(--primary) 36%,transparent); outline-offset:2px;
}

/* Personal record view: avatar plus clearly separated data groups, following the supplied reference style. */
.p2-profile-hero { align-items:center; }
.p2-profile-sections { grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; align-items:stretch; }
.p2-profile-sections > .p2-detail-group { min-width:0; padding:15px; border:1px solid var(--border); border-left:3px solid var(--primary); border-radius:12px; background:var(--surface); }
.p2-profile-sections > .p2-detail-group h3 { padding-bottom:9px; border-bottom:1px solid var(--border); line-height:1.45; }
.p2-profile-sections .p2-detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px 12px; }
.p2-profile-sections .p2-detail-field strong { font-size:12px; line-height:1.5; }
.p2-profile-sections .p2-detail-field span { line-height:1.4; }

/* Dashboard is still a dashboard before data is loaded; values remain placeholders, never fake metrics. */
.p9-dashboard-status { display:flex; align-items:center; gap:16px; margin:0 0 16px; padding:16px 18px; }
.p9-dashboard-date { flex:0 0 auto; display:flex; flex-direction:column; align-items:center; justify-content:center; width:60px; min-height:62px; border:1px solid var(--border); border-radius:12px; background:var(--surface-2); }
.p9-dashboard-date strong { color:var(--primary); font-size:25px; line-height:1.1; font-variant-numeric:tabular-nums; }
.p9-dashboard-date span { max-width:100%; padding:0 3px; color:var(--muted); font-size:9px; text-align:center; }
.p9-dashboard-status-copy { flex:1 1 280px; min-width:0; }
.p9-dashboard-status-copy strong { display:block; color:var(--text); font-size:14px; }
.p9-dashboard-status-copy p { margin:5px 0 0; color:var(--muted); font-size:12px; line-height:1.55; }
.p9-kpi-grid { margin:0 0 18px; }
.p9-kpi-placeholder { min-width:0; text-align:left; cursor:pointer; }
.p9-kpi-placeholder .kpi-value { color:var(--muted); }
.p9-dashboard-unloaded .surface-card { min-width:0; }
.p9-dashboard-unloaded .surface-card-body { min-width:0; }

/* Scientific output is a result panel, not an unstyled text value. */
.os7-calc-result { position:relative; gap:9px; min-width:0; margin:14px 0 16px; padding:18px 20px; border-color:var(--os7-theme-border,var(--border)); background:linear-gradient(145deg,var(--os7-theme-soft,#edf6f2),var(--surface)); box-shadow:inset 3px 0 0 var(--os7-accent,var(--primary)); }
.os7-calc-result small { display:block; margin:0; color:var(--muted); font-size:10px; letter-spacing:.14em; }
.os7-calc-result strong { display:block; min-width:0; max-width:100%; color:var(--text); font-size:clamp(24px,3.5vw,36px); line-height:1.3; letter-spacing:0; overflow-wrap:anywhere; word-break:break-word; font-variant-numeric:tabular-nums; }
.os7-calc-result[aria-live] { transition:background-color .15s ease,border-color .15s ease; }
.os7-conversion-result { align-items:flex-start; border-color:var(--border); background:var(--surface-2); }
.os7-conversion-result strong { min-width:0; color:var(--text); line-height:1.35; }
.os7-modal-result { border:1px solid var(--border); background:var(--surface-2); line-height:1.6; overflow-wrap:anywhere; }

/* PersonalOS 13 split-flap clock: static upper/lower faces and real rotating flap layers. */
.p6-flip-digit { isolation:isolate; overflow:hidden; transform:none !important; }
.p6-flip-digit::after { display:none; }
.p6-flip-digit.is-flipping { animation:none !important; }
.p9-flip-half { position:absolute; left:0; right:0; height:50%; display:block; overflow:hidden; pointer-events:none; }
.p9-flip-half > span { position:absolute; left:0; right:0; height:200%; display:flex; align-items:center; justify-content:center; font:inherit; line-height:1; letter-spacing:inherit; white-space:nowrap; }
.p9-flip-static-top { top:0; z-index:1; background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,0)); }
.p9-flip-static-top > span { top:0; }
.p9-flip-static-bottom { bottom:0; z-index:1; background:linear-gradient(180deg,rgba(0,0,0,.13),rgba(0,0,0,.02)); }
.p9-flip-static-bottom > span { bottom:0; }
.p9-flip-top { top:0; z-index:4; transform-origin:50% 100%; transform:rotateX(-90deg); backface-visibility:hidden; background:linear-gradient(180deg,#263a50 0%,#1a2d41 100%); box-shadow:inset 0 -1px rgba(255,255,255,.13); }
.p9-flip-top > span { top:0; }
.p9-flip-bottom { bottom:0; z-index:3; transform-origin:50% 0%; transform:rotateX(90deg); backface-visibility:hidden; background:linear-gradient(180deg,#14273a 0%,#203449 100%); box-shadow:inset 0 1px rgba(255,255,255,.12); }
.p9-flip-bottom > span { bottom:0; }
.p9-flip-divider { position:absolute; z-index:5; left:0; right:0; top:calc(50% - .5px); border-top:1px solid rgba(3,12,22,.48); box-shadow:0 1px rgba(255,255,255,.12); pointer-events:none; }
.p6-flip-digit.is-flipping .p9-flip-top { animation:p9-flap-top 150ms cubic-bezier(.35,.03,.75,.45) both; }
.p6-flip-digit.is-flipping .p9-flip-bottom { animation:p9-flap-bottom 175ms cubic-bezier(.2,.68,.25,1.08) 125ms both; }
@keyframes p9-flap-top { 0% { transform:rotateX(0deg); filter:brightness(1); } 100% { transform:rotateX(-90deg); filter:brightness(.86); } }
@keyframes p9-flap-bottom { 0% { transform:rotateX(90deg); filter:brightness(.86); } 100% { transform:rotateX(0deg); filter:brightness(1); } }

@media (max-width:1100px) {
  .p2-profile-sections { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .p9-dashboard-status { align-items:flex-start; flex-wrap:wrap; }
  .p9-dashboard-status > button { margin-left:76px; }
}
@media (max-width:640px) {
  .p2-profile-sections { grid-template-columns:minmax(0,1fr); gap:11px; }
  .p2-profile-hero { align-items:flex-start; flex-wrap:wrap; gap:13px; padding:16px; }
  .p2-avatar-wrap { flex-basis:82px; }
  .p2-profile-avatar { width:68px; height:68px; }
  .p2-profile-identity { flex:1 1 calc(100% - 105px); }
  .p2-profile-actions { width:100%; align-self:stretch; }
  .p2-profile-actions button { width:100%; }
  .p2-profile-sections .p2-detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .p9-dashboard-status { padding:13px; gap:11px; }
  .p9-dashboard-date { width:52px; min-height:54px; }
  .p9-dashboard-date strong { font-size:22px; }
  .p9-dashboard-status-copy { flex-basis:calc(100% - 65px); }
  .p9-dashboard-status > button { width:100%; margin:0; }
  .p9-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .p9-kpi-placeholder { padding:12px; }
  .p9-kpi-placeholder .kpi-value { font-size:23px; }
  .page-actions,.notice-actions,.q-template-links,.p6-clock-actions,.p6-timer-presets,.modal-footer { gap:8px; }
  .page-actions > button,.notice-actions > button { min-height:42px; }
}
@media (prefers-reduced-motion: reduce) {
  .p6-flip-digit.is-flipping .p9-flip-top,.p6-flip-digit.is-flipping .p9-flip-bottom { animation:none !important; }
  .os7-calc-result[aria-live] { transition:none; }
}

.p14-chemical-actions{display:flex;gap:7px;flex-wrap:wrap;align-items:center}.p14-template-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.p14-template-links a{text-decoration:none;text-align:center;display:flex;align-items:center;justify-content:center;min-height:40px}.p14-template-links p{grid-column:1/-1}@media(max-width:600px){.p14-chemical-actions{width:100%}.p14-chemical-actions>*{flex:1}.p14-template-links{grid-template-columns:1fr}}
