/* Inspector: consistent full-width fields and always-visible alignment. */
.properties {
  --tool-ink: #252735;
  --tool-label: #626b7c;
  --control-height: 36px;
  --inspector-inset: 16px;
}
.properties .control-icon { width: 18px; height: 18px; stroke-width: 1.8; }
.properties .info-button .control-icon { width: 16px; height: 16px; }
.home-link { width: 36px; height: 36px; min-height: 36px; padding: 8px; justify-content: center; }
.properties .panel-head { padding: 12px 16px 8px; }
.properties-body { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; }
.inspector-tabs { display: flex; flex: none; margin: 12px var(--inspector-inset) 8px; padding: 3px; gap: 3px; background: #f0f2f6; border-radius: 8px; }
.inspector-tabs button { flex: 1; min-height: var(--control-height); padding: 4px 8px; border: 1px solid transparent; background: transparent; font-size: 13px; }
.inspector-tabs button[aria-selected="true"] { background: #fff; color: #b72e51; border-color: #e3dce3; box-shadow: 0 1px 3px #25273508; }
.inspector-view { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 var(--inspector-inset) 12px; }
#attributesView { display: flex; flex-direction: column; overflow: hidden; }
#selectedProperties { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#propertySettings { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; margin-right: calc(-1 * var(--settings-scrollbar, 0px)); padding-bottom: 12px; }
@supports not (scrollbar-gutter: stable) {
  #propertySettings { overflow-y: scroll; }
}
/* Keep focus rings inside the scrollport instead of underneath its scrollbar. */
#propertySettings :focus-visible, #propertySettings input:focus, #propertySettings select:focus,
#propertySettings .unit-field:focus-within { outline-offset: -2px; }
#emptySelection { overflow: auto; }
.selection-tools { flex: none; padding: 0 0 12px; border-bottom: 1px solid var(--line); background: #fff; }
.properties .selection-heading { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; min-height: var(--control-height); }
.properties .selection-heading strong { flex: 1; min-width: 0; font-size: 14px; text-align: left; }
.properties .selection-heading #editTextButton { width: auto; min-height: var(--control-height); height: var(--control-height); padding: 0 6px; gap: 4px; font-size: 12px; border-color: transparent; background: transparent; color: var(--tool-label); }
.properties .selection-heading .danger { flex: none; width: var(--control-height); height: var(--control-height); min-height: var(--control-height); padding: 8px; border: 0; background: transparent; color: #ab2948; }
.properties .object-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); grid-template-columns: none; gap: 8px; }
.properties .object-actions button { height: var(--control-height); min-height: var(--control-height); padding: 0 6px; font-size: 13px; font-weight: 400; justify-content: center; gap: 6px; background: #f7f8fa; border: 1px solid #e4e7ed; border-radius: 6px; }
.properties section:not(.layers-section), .inspector-view details { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; margin-top: 16px; padding: 12px 0 0; }
.properties #alignmentControls { border-top: 0; margin-top: 0; padding-top: 10px; }
.properties .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; margin: 0 0 8px; }
.properties .section-heading h3 { min-width: 0; margin: 0; color: var(--tool-ink); font-size: 13px; font-weight: 600; text-align: left; }
.properties .section-heading > div { display: flex; gap: 4px; }
.properties .section-heading .info-button { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 4px; border: 0; background: transparent; color: var(--tool-label); }
.properties .field { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0; min-width: 0; color: var(--tool-label); font-size: 13px; line-height: 1.4; }
.properties .field-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 8px; }
.properties .field > input, .properties .field > select { width: 100%; min-width: 0; max-width: none; height: var(--control-height); min-height: var(--control-height); padding: 6px 9px; font-size: 14px; line-height: 1.4; border: 1px solid #e4e7ed; border-radius: 6px; background: #f7f8fa; color: var(--tool-ink); }
.properties .field > input[type="color"] { width: 100%; padding: 5px; cursor: pointer; }
.properties input[type="number"] { font-variant-numeric: tabular-nums; }
.properties .unit-field { display: flex; align-items: center; min-width: 0; height: var(--control-height); border: 1px solid #e4e7ed; border-radius: 6px; background: #f7f8fa; }
.properties .unit-field > input { flex: 1; width: 0; min-width: 0; min-height: 0; height: 100%; padding: 6px 9px; border: 0; background: transparent; font-size: 14px; }
.properties .unit-field .field-unit { flex: none; width: 24px; text-align: center; font-size: 12px; color: var(--tool-label); }
.properties .unit-field:focus-within { border-color: #dc5575; outline: 2px solid #df3d601a; }
.properties .unit-field > input:focus { outline: none; }
.properties .unit-field:has(input:disabled) { background: #edf0f5; }
.properties #textProperties { display: grid; row-gap: 12px; }
.properties #textProperties .section-heading { margin: 0; }
.properties .segmented { display: flex; width: 100%; height: var(--control-height); padding: 2px; gap: 2px; border: 1px solid #e4e7ed; border-radius: 6px; background: #f0f2f6; }
.properties .segmented button { flex: 1; min-width: 0; min-height: 0; height: 100%; padding: 2px; border: 1px solid transparent; border-radius: 4px; font-size: 14px; color: var(--tool-ink); }
.properties .formatting { margin: 0; }
.properties .paragraph-align { width: 100%; }
.properties .align-buttons { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 2px; padding: 0; border: 0; background: transparent; border-radius: 0; }
.properties .align-buttons button { display: inline-flex; align-items: center; justify-content: center; min-width: 0; min-height: var(--control-height); height: var(--control-height); padding: 0; gap: 0; border: 1px solid #e4e7ed; border-radius: 6px; background: #f7f8fa; color: var(--tool-ink); }
.properties .align-buttons button[aria-pressed="true"] { background: #fff0f4; border-color: #eebacc; color: #b8294d; box-shadow: none; }
.properties .button-row { gap: 8px; }
.properties .button-row:not(.segmented) button { min-height: var(--control-height); padding: 6px; font-size: 13px; }
.inspector-view summary { cursor: pointer; min-height: 32px; padding: 4px 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.inspector-view summary:focus-visible, .tip summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.properties .geometry-section .section-heading { margin-bottom: 4px; }
.properties .layers-section { margin: 0; padding: 0 var(--inspector-inset) 12px; border: 0; }
.layers-section .section-heading { position: sticky; top: 0; background: #fff; z-index: 1; padding: 4px 0; }
.layer { min-height: 36px; }
#controlTooltip { position: fixed; z-index: 80; padding: 9px 12px; border-radius: 8px; background: #303545; color: #fff; box-shadow: 0 5px 20px #25273524; font-size: 12px; line-height: 1.65; white-space: normal; overflow-wrap: anywhere; pointer-events: auto; }
.sheet-grabber, #sheetBackdrop { display: none; }
@media(min-width:761px) { .properties .panel-head { display: none; } }
@media(max-width:1100px) and (min-width:761px) { .properties { --inspector-inset: 12px; } }
@media(max-width:760px) {
  .properties { --control-height: 44px; --inspector-inset: 16px; }
  .properties .field > input, .properties .field > select, .properties .unit-field > input { font-size: 16px; }
  .properties .section-heading .info-button { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  .inspector-view summary { min-height: 44px; padding: 10px 0; }
  .properties .section-heading { min-height: 32px; }
}

@media (max-width:760px) {
  .panel button, .mobile-dock button, .topbar button, .topbar a { -webkit-tap-highlight-color: transparent; }
  .topbar { display: flex; height: 60px; padding: 6px 8px; gap: 6px; }
  .home-link { width: 44px; height: 44px; min-height: 44px; padding: 12px; flex: none; }
  .home-link svg { width: 18px; height: 18px; }
  .brand { font-size: 15px; gap: 5px; min-width: 0; }
  .brand > span:last-child { white-space: nowrap; }
  .top-actions { margin-left: auto; gap: 2px; }
  .top-actions button { min-height: 44px; padding: 6px; }
  .top-actions .primary { font-size: 12px; white-space: nowrap; }
  .workspace { height: calc(100dvh - 120px - env(safe-area-inset-bottom)); }
  .mobile-dock { bottom: var(--keyboard-offset,0px); }
  #sheetBackdrop { display: block; position: fixed; inset: 0 0 calc(60px + env(safe-area-inset-bottom) + var(--keyboard-offset,0px)); z-index: 9; background: #2830431f; border: 0; border-radius: 0; padding: 0; opacity: 0; pointer-events: none; transition: opacity 220ms ease; }
  #sheetBackdrop.visible { opacity: 1; pointer-events: auto; }
  .panel, .panel.open { display: none; }
  .panel.sheet-mounted {
    display: flex; position: fixed; left: 0; right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom) + var(--keyboard-offset,0px));
    height: var(--sheet-full-height); max-height: none;
    padding-bottom: var(--sheet-hidden-height,0px);
    transform: translateY(var(--sheet-hidden-height,0px));
    border: 1px solid #e4e7ef; border-bottom: 0; border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 30px #25273518; overflow: hidden; will-change: transform;
    z-index: 10;
  }
  .sheet-grabber { display: flex; flex: none; width: 100%; height: 44px; min-height: 44px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 0; background: transparent; touch-action: none; }
  .sheet-grabber::before { content: ""; width: 36px; height: 4px; border-radius: 4px; background: #bbc0cd; }
  .sheet-grabber:hover, .sheet-grabber:active { background: transparent; border: 0; }
  .sheet-grabber:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; }
  .panel .panel-head { padding: 0 16px 4px; min-height: 44px; flex: none; touch-action: none; }
  .panel .panel-head h2 { font-size: 15px; }
  .panel .panel-head > button { min-width: 44px; min-height: 44px; font-size: 22px; }
  .properties-body { padding: 0; }
  .panel .asset-content { flex: 1; min-height: 0; overscroll-behavior: contain; padding: 8px 16px 16px; }
  .panel .asset-tabs { flex: none; margin: 0 16px 6px; }
  .panel .asset-tabs button { min-height: 44px; }

  .layer button, .layer button:last-child { min-height: 44px; }
  .layer button:last-child { min-width: 44px; }
}
@media (max-width:359px) {
  .brand-mark { display: none; }
  .brand { font-size: 14px; }
}
@media (prefers-reduced-motion:reduce) {
  #sheetBackdrop { transition: none; }
  .panel.sheet-mounted { will-change: auto; }
}

/* Page actions have a stable row independent of thumbnail count. */
.pages-bar { gap: 10px; }
.pages { flex: 1; }
.page-actions { max-width: none; flex-wrap: nowrap; gap: 5px; }
.page-actions button { width: 36px; height: 36px; min-height: 36px; padding: 6px; border-color: #e1e5ed; background: #f8f9fc; }
.page-actions .control-icon { width: 19px; height: 19px; }
.page-actions button:not(:disabled):hover, .page-actions button:not(:disabled):focus-visible { color: #b72e51; background: #fff0f4; border-color: #edbbc9; }
.page-actions [data-action="deletePage"]:not(:disabled):hover, .page-actions [data-action="deletePage"]:not(:disabled):focus-visible { color: #bc2445; background: #ffe9ef; }
.page-actions button:not(:disabled):active .control-icon { transform: scale(.9); }
@media(max-width:760px) {
  .pages-bar { display: grid; grid-template-columns: minmax(0,1fr) 44px; grid-template-rows: 63px 44px; gap: 8px; padding: 8px 12px; min-height: 131px; }
  .pages { grid-column: 1; grid-row: 1; }
  .add-page { grid-column: 2; grid-row: 1; width: 44px; height: 54px; }
  .page-count { grid-column: 1; grid-row: 2; justify-self: start; }
  .page-actions { grid-column: 1 / -1; grid-row: 2; max-width: none; margin: 0; justify-self: end; justify-content: flex-end; gap: 8px; }
  .page-actions button { width: 44px; height: 44px; min-height: 44px; }
}
@media(prefers-reduced-motion:reduce) {
  .page-actions button:not(:disabled):active .control-icon { transform: none; }
}
