:root {
  color-scheme: light;
  --ink: #142326;
  --ink-soft: #5c7174;
  --ink-faint: #829295;
  --line: #d8e3e1;
  --line-strong: #b9cfcb;
  --surface: #ffffff;
  --surface-soft: #f3f7f6;
  --surface-tint: #eaf7f4;
  --brand: #087f73;
  --brand-dark: #05665d;
  --brand-pale: #d9f2ed;
  --navy: #173f49;
  --danger: #b42318;
  --danger-pale: #fff0ee;
  --warning: #956000;
  --shadow: 0 18px 55px rgba(20, 51, 49, .13);
  --shadow-soft: 0 8px 26px rgba(20, 51, 49, .08);
  --radius: 16px;
  --header-height: 74px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { background: var(--surface-soft); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface-soft);
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button, label[for] { -webkit-touch-callout: none; }
button { color: inherit; }
input, textarea { min-width: 0; }

.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;
}

.app-header {
  height: calc(var(--header-height) + env(safe-area-inset-top));
  padding: calc(10px + env(safe-area-inset-top)) 22px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgba(216, 227, 225, .9);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
}

.brand-block { min-width: 0; display: flex; align-items: center; gap: 11px; }
.brand-mark { flex: 0 0 auto; border-radius: 11px; box-shadow: 0 5px 15px rgba(8, 127, 115, .16); }
.brand-copy { min-width: 0; }
.brand-copy h1 { margin: 0; font-size: 18px; line-height: 1.15; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-copy p { margin: 4px 0 0; max-width: 46vw; color: var(--ink-soft); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 9px; }

.cloud-button {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  background: var(--surface);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}
.cloud-button:hover { border-color: var(--line-strong); background: var(--surface-tint); }
.cloud-button:focus-visible { outline: 3px solid rgba(8, 127, 115, .28); outline-offset: 2px; }
.cloud-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--ink-faint); box-shadow: 0 0 0 3px rgba(130, 146, 149, .14); }
.cloud-button.is-pending .cloud-dot, .cloud-button.is-syncing .cloud-dot, .cloud-button.is-retry .cloud-dot, .cloud-button.is-offline .cloud-dot { background: #d18600; box-shadow: 0 0 0 3px rgba(209, 134, 0, .15); }
.cloud-button.is-syncing .cloud-dot { animation: cloud-pulse 1s ease-in-out infinite; }
.cloud-button.is-synced .cloud-dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(8, 127, 115, .15); }
.cloud-button.is-error .cloud-dot, .cloud-button.is-auth .cloud-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }
@keyframes cloud-pulse { 50% { opacity: .35; transform: scale(.82); } }

.status-pill {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-pale);
  font-size: .75rem;
  font-weight: 750;
  white-space: nowrap;
}
.status-pill.is-saving { color: #245da5; background: #e8f1ff; }
.status-pill.is-error { color: var(--danger); background: var(--danger-pale); }

.button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 760;
  line-height: 1.15;
  text-decoration: none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.button:hover { border-color: var(--line-strong); }
.button:active { transform: scale(.98); }
.button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, .dialog-close:focus-visible, .tree-node-main:focus-visible { outline: 3px solid rgba(8, 127, 115, .28); outline-offset: 2px; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button--primary { color: #fff; border-color: var(--brand); background: var(--brand); box-shadow: 0 6px 14px rgba(8, 127, 115, .18); }
.button--primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.button--secondary { color: var(--brand-dark); border-color: #b7d2cd; background: var(--surface); }
.button--secondary:hover { background: var(--surface-tint); }
.button--danger { color: var(--danger); border-color: #f1b9b2; background: var(--danger-pale); }
.button--quiet { min-height: 36px; padding: 7px 10px; color: var(--ink-soft); border-color: var(--line); background: var(--surface-soft); font-size: .82rem; }
.button--large { min-height: 52px; padding: 13px 20px; font-size: 1rem; }
.button--full { width: 100%; }

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: var(--surface);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-tint); border-color: var(--line-strong); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-button--brand { color: #fff; border-color: var(--brand); background: var(--brand); }
.icon-button--brand:hover { color: #fff; border-color: var(--brand-dark); background: var(--brand-dark); }
.back-to-lists { border-color: transparent; background: var(--surface-soft); }

.text-button { min-height: 32px; padding: 5px 7px; border: 0; border-radius: 7px; color: var(--brand-dark); background: transparent; cursor: pointer; font-size: .76rem; font-weight: 750; }
.text-button:hover { background: var(--surface-tint); }

.app-shell { height: calc(100dvh - var(--header-height) - env(safe-area-inset-top)); min-height: 360px; }
.eyebrow, .section-kicker { margin: 0; color: var(--brand); font-size: .72rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }

/* Dashboard */
.dashboard-screen {
  min-height: 100%;
  padding: clamp(28px, 4vw, 58px) clamp(18px, 5vw, 72px) 56px;
  background:
    radial-gradient(circle at 6% 0%, rgba(8, 127, 115, .14), transparent 28%),
    radial-gradient(circle at 94% 18%, rgba(36, 154, 132, .10), transparent 24%),
    var(--surface-soft);
  overflow: auto;
}
.dashboard-hero {
  width: min(1320px, 100%);
  margin: 0 auto clamp(30px, 5vw, 54px);
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 34px;
}
.dashboard-hero h2 { margin: 12px 0 14px; font-size: clamp(2.2rem, 5.6vw, 4.8rem); line-height: .98; letter-spacing: -.055em; }
.dashboard-hero h2 span { color: var(--brand); }
.dashboard-hero p { max-width: 690px; margin: 0; color: var(--ink-soft); font-size: clamp(1rem, 1.5vw, 1.18rem); line-height: 1.6; }

.library-card {
  width: min(1320px, 100%);
  min-height: 320px;
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid rgba(216, 227, 225, .9);
  border-radius: 24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
.library-toolbar { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.library-toolbar h3 { margin: 5px 0 0; font-size: 1.65rem; letter-spacing: -.025em; }
.toolbar-actions { display: flex; align-items: center; gap: 9px; }
.search-field {
  min-height: 42px;
  min-width: min(330px, 40vw);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-soft);
}
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8, 127, 115, .12); background: var(--surface); }
.search-field svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: var(--ink-faint); stroke-width: 1.8; stroke-linecap: round; }
.search-field input { width: 100%; height: 40px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: .9rem; }
.search-field input::placeholder { color: #87989a; }

.list-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.list-card {
  min-height: 220px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(20, 51, 49, .045);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.list-card:hover { transform: translateY(-2px); border-color: #99c4bd; box-shadow: var(--shadow-soft); }
.list-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.list-card-icon { width: 42px; height: 42px; flex: 0 0 42px; position: relative; border-radius: 12px; background: var(--brand-pale); }
.list-card-icon::before, .list-card-icon::after { content: ""; position: absolute; border-radius: 2px; background: var(--brand); }
.list-card-icon::before { width: 19px; height: 3px; left: 12px; top: 11px; box-shadow: 0 8px 0 var(--brand), 0 16px 0 var(--brand); }
.list-card-icon::after { width: 3px; height: 19px; left: 9px; top: 11px; }
.list-card-menu { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 1.25rem; letter-spacing: .08em; }
.list-card-menu:hover { background: var(--surface-soft); }
.list-card-project { margin: 18px 0 5px; color: var(--brand); font-size: .73rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card h4 { margin: 0; font-size: 1.18rem; line-height: 1.25; letter-spacing: -.015em; }
.list-card-description { display: -webkit-box; min-height: 45px; margin: 9px 0 18px; overflow: hidden; color: var(--ink-soft); font-size: .86rem; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-card-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-soft); font-size: .75rem; }
.list-card-open { min-height: 36px; padding: 7px 11px; border: 1px solid #b7d2cd; border-radius: 9px; color: var(--brand-dark); background: var(--surface); cursor: pointer; font-size: .78rem; font-weight: 800; }
.list-card-open:hover { background: var(--surface-tint); }

.empty-library { padding: 48px 20px 36px; text-align: center; }
.empty-library h3 { margin: 18px 0 7px; font-size: 1.35rem; }
.empty-library p { max-width: 470px; margin: 0 auto 18px; color: var(--ink-soft); line-height: 1.5; }
.empty-illustration { width: 92px; height: 66px; margin: 0 auto; position: relative; }
.empty-illustration span { position: absolute; width: 48px; height: 16px; left: 6px; border: 2px solid var(--brand); border-radius: 5px; background: var(--surface-tint); }
.empty-illustration span:nth-child(1) { top: 0; }
.empty-illustration span:nth-child(2) { top: 25px; left: 38px; }
.empty-illustration span:nth-child(3) { top: 50px; }
.empty-illustration span:nth-child(4) { width: 2px; height: 42px; top: 8px; left: 24px; border: 0; border-radius: 0; background: var(--brand); box-shadow: 14px 16px 0 -0.5px var(--brand); }

/* Workspace */
.workspace-screen { height: 100%; display: grid; grid-template-columns: minmax(320px, 36%) minmax(0, 1fr); overflow: hidden; }
.tree-pane { min-width: 0; height: 100%; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }
.tree-toolbar { padding: 15px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.search-field--tree { min-width: 0; width: 100%; background: var(--surface-soft); }
.tree-summary { min-height: 43px; padding: 5px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: .78rem; }
.tree-summary > div { display: flex; gap: 2px; }
.tree-view { flex: 1; min-height: 0; padding: 9px 8px 18px; overflow: auto; overscroll-behavior: contain; }
.tree-level { margin: 0; padding: 0; list-style: none; }
.tree-level .tree-level { margin-left: 18px; position: relative; }
.tree-level .tree-level::before { content: ""; position: absolute; top: -4px; bottom: 10px; left: 1px; border-left: 1px solid #cbdad8; }
.tree-item { margin: 2px 0; position: relative; }
.tree-level .tree-level > .tree-item::before { content: ""; width: 19px; position: absolute; top: 22px; left: 1px; border-top: 1px solid #cbdad8; }
.tree-node-row { min-width: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; position: relative; z-index: 1; }
.tree-toggle { width: 40px; height: 42px; padding: 0; border: 0; display: grid; place-items: center; color: var(--ink-faint); background: transparent; cursor: pointer; }
.tree-toggle::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .14s ease; }
.tree-toggle[aria-expanded="true"]::before { transform: rotate(45deg) translate(-1px, -1px); }
.tree-toggle.is-leaf { cursor: default; }
.tree-toggle.is-leaf::before { width: 5px; height: 5px; border: 0; border-radius: 50%; background: #a7b9b6; transform: none; }
.tree-node-main { min-width: 0; min-height: 42px; padding: 7px 9px; border: 1px solid transparent; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; background: transparent; cursor: pointer; }
.tree-node-main:hover { background: var(--surface-soft); }
.tree-node-main.is-selected { border-color: #a9d1ca; color: var(--brand-dark); background: var(--brand-pale); }
.tree-node-copy { min-width: 0; }
.tree-node-name { display: block; overflow: hidden; font-size: .88rem; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.tree-node-meta { display: block; margin-top: 2px; color: var(--ink-faint); font-size: .67rem; white-space: nowrap; }
.tree-photo-count { min-width: 23px; padding: 3px 6px; border-radius: 999px; color: var(--brand-dark); background: var(--surface-tint); font-size: .65rem; font-weight: 800; text-align: center; }
.tree-add-child { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 9px; color: var(--brand); background: transparent; cursor: pointer; font-size: 1.25rem; }
.tree-add-child:hover { background: var(--surface-tint); }
.tree-search-note { margin: 11px 8px; padding: 12px; border-radius: 10px; color: var(--ink-soft); background: var(--surface-soft); font-size: .82rem; line-height: 1.45; }
.tree-footer { display: none; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); grid-template-columns: 1fr 1fr; gap: 8px; background: var(--surface); }

.empty-tree { flex: 1; padding: 50px 24px; text-align: center; }
.empty-tree-mark { width: 62px; height: 62px; margin: 0 auto; position: relative; border-radius: 18px; background: var(--brand-pale); }
.empty-tree-mark::before { content: ""; width: 7px; height: 7px; position: absolute; left: 16px; top: 17px; border-radius: 50%; background: var(--brand); box-shadow: 0 21px 0 var(--brand), 25px 10px 0 var(--brand); }
.empty-tree-mark::after { content: ""; width: 26px; height: 21px; position: absolute; left: 20px; top: 21px; border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); }
.empty-tree h3 { margin: 16px 0 7px; }
.empty-tree p { margin: 0 0 17px; color: var(--ink-soft); font-size: .9rem; line-height: 1.45; }

.editor-pane { min-width: 0; height: 100%; position: relative; background: var(--surface-soft); overflow: auto; overscroll-behavior: contain; }
.no-selection { width: min(540px, calc(100% - 44px)); min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.no-selection h2 { margin: 14px 0 8px; font-size: 2rem; letter-spacing: -.035em; }
.no-selection p { margin: 0 0 21px; color: var(--ink-soft); line-height: 1.55; }
.selection-graphic { width: 132px; height: 92px; margin-bottom: 24px; position: relative; }
.selection-graphic i { position: absolute; display: block; border: 2px solid var(--brand); border-radius: 8px; background: var(--surface); box-shadow: 0 5px 13px rgba(8, 127, 115, .10); }
.selection-graphic i:nth-child(1) { width: 54px; height: 26px; left: 39px; top: 0; }
.selection-graphic i:nth-child(2) { width: 47px; height: 23px; left: 0; top: 63px; }
.selection-graphic i:nth-child(3) { width: 47px; height: 23px; right: 0; top: 63px; }
.selection-graphic i:nth-child(4) { width: 2px; height: 38px; left: 65px; top: 26px; border: 0; border-radius: 0; background: var(--brand); box-shadow: -42px 18px 0 -0.2px var(--brand), 42px 18px 0 -0.2px var(--brand); }
.selection-graphic i:nth-child(5) { width: 85px; height: 2px; left: 23px; top: 43px; border: 0; border-radius: 0; background: var(--brand); }

.node-editor { min-height: 100%; }
.mobile-editor-bar { display: none; }
.node-heading { min-height: 106px; padding: 22px clamp(22px, 3.5vw, 48px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 22px; background: rgba(255, 255, 255, .92); }
.node-path { max-width: 62vw; margin: 0 0 5px; overflow: hidden; color: var(--brand); font-size: .74rem; font-weight: 800; letter-spacing: .04em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.node-heading h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.3rem); line-height: 1.1; letter-spacing: -.035em; }
.node-heading-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.editor-content { width: min(980px, 100%); margin: 0 auto; padding: clamp(20px, 3.5vw, 44px); display: grid; gap: 18px; }
.editor-card { padding: clamp(18px, 2.5vw, 28px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-soft); }
.card-heading { margin-bottom: 22px; }
.card-heading > div:first-child { display: flex; align-items: center; gap: 12px; }
.card-heading h3 { margin: 0; font-size: 1.12rem; }
.card-heading p { margin: 4px 0 0; color: var(--ink-soft); font-size: .8rem; }
.card-heading--pictures { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-icon { width: 39px; height: 39px; flex: 0 0 39px; border-radius: 11px; display: grid; place-items: center; color: var(--brand-dark); background: var(--brand-pale); font-size: .76rem; font-weight: 900; letter-spacing: -.08em; }
.card-icon--photo { position: relative; }
.card-icon--photo::before { content: ""; width: 19px; height: 14px; border: 2px solid var(--brand); border-radius: 4px; }
.card-icon--photo::after { content: ""; width: 5px; height: 5px; position: absolute; top: 12px; left: 12px; border-radius: 50%; background: var(--brand); }
.count-badge { padding: 3px 7px; border-radius: 999px; color: var(--brand-dark); background: var(--brand-pale); font-size: .7rem; vertical-align: 2px; }
.picture-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.picture-actions .button { min-height: 44px; }

.picture-drop-zone {
  min-height: 92px;
  margin-bottom: 16px;
  padding: 17px 20px;
  border: 2px dashed #a9c9c4;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: var(--brand-dark);
  background: #f6fbfa;
  cursor: pointer;
  text-align: left;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease, transform .14s ease;
}
.picture-drop-zone:hover { border-color: var(--brand); background: var(--surface-tint); }
.picture-drop-zone:focus-visible { outline: 3px solid rgba(8, 127, 115, .26); outline-offset: 2px; }
.picture-drop-zone.is-dragover { border-color: var(--brand); background: var(--brand-pale); box-shadow: inset 0 0 0 2px rgba(8, 127, 115, .12); transform: scale(1.005); }
.picture-drop-zone strong { display: block; font-size: .94rem; }
.picture-drop-zone small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: .78rem; line-height: 1.4; }
.picture-drop-icon { width: 42px; height: 42px; flex: 0 0 42px; position: relative; border-radius: 12px; background: var(--brand-pale); }
.picture-drop-icon::before { content: ""; width: 20px; height: 15px; position: absolute; left: 9px; top: 13px; border: 2px solid var(--brand); border-radius: 4px; }
.picture-drop-icon::after { content: "+"; position: absolute; right: 5px; top: 2px; color: var(--brand); font-size: 1.15rem; font-weight: 900; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 7px; color: var(--ink); font-size: .875rem; font-weight: 760; }
.field--full { grid-column: 1 / -1; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 1rem;
  font-weight: 450;
  line-height: 1.45;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field input { min-height: 46px; padding: 10px 12px; }
.field textarea { min-height: 105px; padding: 11px 12px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8, 127, 115, .12); }
.field input::placeholder, .field textarea::placeholder { color: #8b9a9c; }
.record-actions { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.order-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.picture-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.picture-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-soft); }
.picture-preview { width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; display: block; position: relative; overflow: hidden; background: #dce7e5; cursor: zoom-in; }
.picture-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.picture-card-body { padding: 11px; display: grid; gap: 9px; }
.picture-card-body label { display: grid; gap: 5px; color: var(--ink-soft); font-size: .875rem; font-weight: 800; letter-spacing: .025em; text-transform: uppercase; }
.picture-card-body textarea { width: 100%; min-height: 70px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: var(--surface); font-size: .84rem; line-height: 1.4; resize: vertical; text-transform: none; letter-spacing: 0; font-weight: 450; }
.picture-card-body textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8, 127, 115, .10); }
.picture-meta { overflow: hidden; color: var(--ink-faint); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.picture-delete { justify-self: start; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 8px; color: var(--danger); background: transparent; cursor: pointer; font-size: .8rem; font-weight: 750; }
.picture-delete:hover { background: var(--danger-pale); }
.empty-pictures { padding: 34px 20px 25px; text-align: center; }
.empty-pictures h4 { margin: 13px 0 5px; }
.empty-pictures p { margin: 0; color: var(--ink-soft); font-size: .84rem; }
.camera-outline { width: 50px; height: 36px; margin: 0 auto; position: relative; border: 2px solid #8cb7b0; border-radius: 9px; }
.camera-outline::before { content: ""; width: 16px; height: 16px; position: absolute; left: 15px; top: 8px; border: 2px solid #8cb7b0; border-radius: 50%; }
.camera-outline::after { content: ""; width: 17px; height: 6px; position: absolute; left: 14px; top: -7px; border: 2px solid #8cb7b0; border-bottom: 0; border-radius: 5px 5px 0 0; }
.inline-notice { margin-bottom: 13px; padding: 11px 13px; border-radius: 10px; color: #245da5; background: #e9f1ff; font-size: .84rem; font-weight: 700; }

/* Dialogs */
.dialog { width: min(590px, calc(100% - 28px)); max-height: min(760px, calc(100dvh - 28px)); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: transparent; box-shadow: var(--shadow); overflow: visible; }
.dialog--small { width: min(500px, calc(100% - 28px)); }
.dialog::backdrop { background: rgba(12, 29, 32, .58); backdrop-filter: blur(4px); }
.dialog-card { max-height: min(760px, calc(100dvh - 28px)); padding: clamp(20px, 4vw, 30px); border: 1px solid rgba(255, 255, 255, .35); border-radius: 20px; display: grid; gap: 17px; background: var(--surface); overflow: auto; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-heading h2 { margin: 6px 0 0; font-size: 1.8rem; letter-spacing: -.035em; }
.dialog-close { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 0; border-radius: 10px; color: var(--ink-soft); background: var(--surface-soft); cursor: pointer; font-size: 1.65rem; line-height: 1; }
.dialog-close:hover { color: var(--ink); background: #e7edec; }
.dialog-actions { padding-top: 6px; display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions--between { justify-content: space-between; align-items: center; }
.dialog-actions--between > div { display: flex; gap: 8px; }

.export-dialog-card { gap: 13px; }
.export-choice { width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 13px; color: var(--ink); background: var(--surface); text-align: left; }
button.export-choice { cursor: pointer; }
button.export-choice:hover { border-color: #9fc7c0; background: var(--surface-tint); }
.export-choice-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; font-size: .78rem; font-weight: 900; }
.export-choice-icon--json { color: #245da5; background: #e8f1ff; }
.export-choice-icon--excel { color: #087058; background: #dff5ec; font-size: 1.15rem; }
.export-choice strong { display: block; font-size: .93rem; }
.export-choice small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: .76rem; line-height: 1.4; }
.file-tag { padding: 5px 7px; border-radius: 7px; color: var(--ink-soft); background: var(--surface-soft); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.export-choice--excel { align-items: start; }
.picture-package-option { grid-column: 2 / -1; padding: 12px; border-radius: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; background: var(--surface-soft); cursor: pointer; }
.picture-package-option input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--brand); }
.export-choice--excel > .button { grid-column: 2 / -1; }
.export-progress { padding: 12px; border-radius: 11px; background: var(--surface-soft); }
.export-progress > div { margin-bottom: 8px; display: flex; justify-content: space-between; color: var(--ink-soft); font-size: .78rem; }
.export-progress progress { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: #dce6e4; }
.export-progress progress::-webkit-progress-bar { background: #dce6e4; }
.export-progress progress::-webkit-progress-value { background: var(--brand); }
.export-progress progress::-moz-progress-bar { background: var(--brand); }

.cloud-dialog { width: min(650px, calc(100% - 24px)); }
.cloud-dialog-card { gap: 15px; }
.cloud-status-panel { padding: 14px; border: 1px solid var(--line); border-radius: 13px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; background: var(--surface-soft); }
.cloud-status-panel strong { display: block; font-size: .94rem; }
.cloud-status-panel p { margin: 4px 0 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.45; }
.cloud-status-icon { width: 32px; height: 32px; position: relative; border-radius: 50%; background: #e3eae9; }
.cloud-status-icon::after { content: ""; width: 10px; height: 10px; position: absolute; left: 11px; top: 11px; border-radius: 50%; background: var(--ink-faint); }
.cloud-status-panel.is-synced { border-color: #a7ccc6; background: #f0fbf8; }
.cloud-status-panel.is-synced .cloud-status-icon { background: var(--brand-pale); }
.cloud-status-panel.is-synced .cloud-status-icon::after { background: var(--brand); }
.cloud-status-panel.is-pending, .cloud-status-panel.is-syncing, .cloud-status-panel.is-retry, .cloud-status-panel.is-offline { border-color: #ecd39d; background: #fff9eb; }
.cloud-status-panel.is-pending .cloud-status-icon, .cloud-status-panel.is-syncing .cloud-status-icon, .cloud-status-panel.is-retry .cloud-status-icon, .cloud-status-panel.is-offline .cloud-status-icon { background: #f9e8bf; }
.cloud-status-panel.is-pending .cloud-status-icon::after, .cloud-status-panel.is-syncing .cloud-status-icon::after, .cloud-status-panel.is-retry .cloud-status-icon::after, .cloud-status-panel.is-offline .cloud-status-icon::after { background: #b87500; }
.cloud-status-panel.is-error, .cloud-status-panel.is-auth { border-color: #efb7b0; background: #fff5f3; }
.cloud-status-panel.is-error .cloud-status-icon, .cloud-status-panel.is-auth .cloud-status-icon { background: var(--danger-pale); }
.cloud-status-panel.is-error .cloud-status-icon::after, .cloud-status-panel.is-auth .cloud-status-icon::after { background: var(--danger); }
.cloud-security-note, .cloud-limit-note { margin: -6px 0 0; color: var(--ink-soft); font-size: .76rem; line-height: 1.45; }
.cloud-action-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 9px; }
.cloud-action-grid .button--quiet { grid-column: 1 / -1; justify-self: start; color: var(--danger); }
.cloud-history-heading { padding-top: 3px; border-top: 1px solid var(--line); display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.cloud-history-heading h3 { margin: 14px 0 3px; font-size: 1rem; }
.cloud-history-heading p { margin: 0; color: var(--ink-soft); font-size: .75rem; }
.cloud-version-list { max-height: 220px; display: grid; gap: 8px; overflow: auto; }
.cloud-version { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; background: var(--surface); }
.cloud-version strong { display: block; font-size: .83rem; }
.cloud-version span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: .7rem; }
.cloud-version.is-current { border-color: #a7ccc6; background: #f3fbf9; }
.cloud-version .button { min-height: 36px; padding: 7px 10px; font-size: .76rem; }
.cloud-empty-history { margin: 0; padding: 17px; border: 1px dashed var(--line-strong); border-radius: 11px; color: var(--ink-soft); background: var(--surface-soft); text-align: center; font-size: .78rem; }

.picture-dialog { width: min(1100px, calc(100% - 24px)); height: min(850px, calc(100dvh - 24px)); padding: 52px 18px 18px; border: 0; border-radius: 20px; color: #fff; background: rgba(8, 23, 26, .96); overflow: hidden; }
.picture-dialog::backdrop { background: rgba(3, 10, 12, .84); }
.picture-dialog img { width: 100%; height: calc(100% - 58px); display: block; object-fit: contain; }
.picture-dialog p { margin: 14px auto 0; overflow: hidden; color: #e5efed; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.picture-dialog-close { width: 38px; height: 38px; position: absolute; top: 10px; right: 12px; padding: 0; border: 1px solid rgba(255, 255, 255, .25); border-radius: 10px; color: #fff; background: rgba(255, 255, 255, .1); cursor: pointer; font-size: 1.6rem; }

.toast-region { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: min(390px, calc(100vw - 32px)); padding: 12px 15px; border: 1px solid #a7ccc6; border-radius: 11px; color: var(--brand-dark); background: #f0fbf8; box-shadow: var(--shadow); font-size: .85rem; font-weight: 720; animation: toast-in .2s ease; }
.toast.is-error { color: var(--danger); border-color: #efb7b0; background: #fff5f3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1020px) {
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-screen { grid-template-columns: minmax(300px, 41%) minmax(0, 1fr); }
  .picture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-actions { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  :root { --header-height: 68px; }
  .app-header { padding-left: 12px; padding-right: 12px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-copy h1 { font-size: 1rem; }
  .brand-copy p { max-width: 46vw; font-size: .68rem; }
  .desktop-action, .header-actions .status-pill { display: none !important; }
  .cloud-button { width: 42px; min-width: 42px; height: 42px; padding: 0; justify-content: center; }
  .cloud-button #cloudButtonLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dashboard-screen { padding: 27px 14px 34px; }
  .dashboard-hero { margin-bottom: 28px; align-items: stretch; flex-direction: column; gap: 20px; }
  .dashboard-hero h2 { margin-top: 10px; font-size: clamp(2.25rem, 12vw, 3.5rem); }
  .dashboard-hero .button { width: 100%; }
  .library-card { padding: 17px; border-radius: 18px; }
  .library-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { align-items: stretch; flex-direction: column; }
  .toolbar-actions .button { width: 100%; }
  .search-field { min-width: 0; width: 100%; }
  .list-grid { grid-template-columns: 1fr; }
  .list-card { min-height: 200px; }

  .workspace-screen { display: block; position: relative; overflow: hidden; }
  .tree-pane, .editor-pane { width: 100%; height: 100%; border-right: 0; }
  .workspace-screen.is-editing .tree-pane { display: none; }
  .workspace-screen:not(.is-editing) .editor-pane { display: none; }
  .tree-footer { display: grid; }
  .tree-toolbar { padding: 11px 12px; }
  .tree-summary { padding-left: 12px; padding-right: 12px; }
  .tree-view { padding-bottom: 14px; }
  .tree-node-main { min-height: 47px; }
  .tree-toggle { width: 44px; height: 44px; }
  .tree-node-row { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .tree-add-child { width: 44px; height: 44px; }

  .mobile-editor-bar { min-height: 54px; padding: 7px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); }
  .mobile-editor-bar .button { min-height: 38px; padding: 7px 10px; }
  .mobile-path { min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
  .node-heading { min-height: auto; padding: 18px 16px; align-items: stretch; flex-direction: column; }
  .node-path { max-width: 100%; }
  .node-heading h2 { font-size: 1.6rem; }
  .node-heading-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .editor-content { padding: 14px 12px calc(30px + env(safe-area-inset-bottom)); }
  .editor-card { padding: 17px; border-radius: 15px; }
  .card-heading--pictures { align-items: stretch; flex-direction: column; }
  .picture-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .picture-actions .button { width: 100%; }
  .picture-drop-zone { min-height: 86px; padding: 14px; }
  .field-grid { grid-template-columns: 1fr; }
  .picture-grid { grid-template-columns: 1fr; }
  .picture-card { display: grid; grid-template-columns: 42% 58%; }
  .picture-preview { height: 100%; min-height: 170px; aspect-ratio: auto; }
  .record-actions { align-items: stretch; }
  .order-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .order-actions .button:last-child { grid-column: 1 / -1; }
  .record-actions > .button { width: 100%; }

  .dialog { width: calc(100% - 18px); max-height: calc(100dvh - 18px); }
  .dialog-card { max-height: calc(100dvh - 18px); padding: 21px 17px calc(21px + env(safe-area-inset-bottom)); }
  .dialog-heading h2 { font-size: 1.55rem; }
  .dialog-actions--between { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions--between > div { display: grid; grid-template-columns: 1fr 1fr; }
  .export-choice { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 13px; }
  .export-choice-icon { width: 40px; height: 40px; }
  .picture-package-option, .export-choice--excel > .button { grid-column: 1 / -1; }
  .cloud-action-grid { grid-template-columns: 1fr; }
  .cloud-action-grid .button--quiet { grid-column: auto; justify-self: stretch; }
  .cloud-version { align-items: stretch; grid-template-columns: 1fr; }
  .toast-region { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .picture-card { grid-template-columns: 1fr; }
  .picture-preview { min-height: 190px; aspect-ratio: 4 / 3; }
  .tree-summary > div { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
