/* ===========================================================
   ImageKit — dark theme (สบายตา)
   3 columns: settings rail (left) · sections (center) · tray (right)
   Toggle switches · cover/full image display
   =========================================================== */
:root {
  --bg:        #17181b;
  --bg-2:      #1c1d21;
  --surface:   #212327;
  --surface-2: #292b30;
  --surface-3: #34363c;
  --ink:       #e9eaed;
  --ink-soft:  #b8babf;
  --muted:     #888a90;
  --line:      #313338;
  --line-2:    #3f4147;
  --primary:   #cfd2d8;
  --primary-d: #b6b9c0;
  --primary-soft: rgba(207,210,216,.13);
  --on-primary:#1a1b1e;
  --green:     #8fa089;
  --green-soft:rgba(143,160,137,.14);
  --warn:      #c8b079;
  --warn-soft: rgba(200,176,121,.12);
  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 14px 34px -18px rgba(0,0,0,.7);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35), 0 5px 16px -12px rgba(0,0,0,.6);
  --ease:      cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: 'Sarabun', 'Leelawadee UI', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--bg-2), transparent 55%),
    radial-gradient(900px 500px at -10% 0%, #141518, transparent 50%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
b { font-weight: 700; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------------- nav ---------------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(23,24,27,.8);
  backdrop-filter: saturate(120%) blur(12px);
  -webkit-backdrop-filter: saturate(120%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: 1280px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; color: var(--on-primary);
  background: linear-gradient(150deg, var(--primary), var(--primary-d));
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; letter-spacing: -.01em; }
.brand-text span { font-size: 11.5px; color: var(--muted); }
.nav-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

/* ---------------- layout ---------------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------------- hero ---------------- */
.hero { animation: rise .5s var(--ease) both; }
.drop-hero {
  background: var(--surface);
  border: 1.5px dashed var(--line-2);
  border-radius: 26px;
  padding: 56px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}
.drop-hero.drag { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.006); }
.drop-icon {
  width: 64px; height: 64px; margin: 0 auto 18px;
  display: grid; place-items: center; border-radius: 20px;
  color: var(--primary);
  background: var(--primary-soft);
}
.hero h1 { margin: 0 auto 10px; font-size: 27px; line-height: 1.3; max-width: 620px; letter-spacing: -.015em; text-wrap: balance; }
.hero p { margin: 0 auto 24px; max-width: 520px; color: var(--ink-soft); text-wrap: pretty; }
.hero-feats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.hero-feats span {
  font-size: 12.5px; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 999px;
}
.hero-steps {
  list-style: none; margin: 22px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.hero-steps li {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.hero-steps .step-no {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: var(--primary); background: var(--primary-soft);
}
.hero-steps b { font-size: 14.5px; }
.hero-steps p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------------- buttons ---------------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 14px;
  color: var(--on-primary); background: linear-gradient(150deg, var(--primary), var(--primary-d));
  padding: 11px 18px; border-radius: 12px;
  box-shadow: 0 6px 16px -10px rgba(0,0,0,.6);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -12px rgba(0,0,0,.7); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: default; transform: none; filter: grayscale(.3); }
.btn-primary.big { font-size: 16px; padding: 14px 30px; border-radius: 14px; }
.btn-primary.full { width: 100%; justify-content: center; }

.btn-light {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13.5px;
  color: var(--ink); background: var(--surface-2);
  padding: 9px 14px; border-radius: 11px;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .15s var(--ease);
}
.btn-light:hover { background: var(--surface-3); border-color: var(--primary); transform: translateY(-1px); }
.btn-light svg { color: var(--primary); }

.btn-text {
  border: 0; background: transparent; cursor: pointer; font-family: inherit;
  color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 9px;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.btn-text:hover { color: var(--primary); background: var(--primary-soft); }

/* ---------------- toolbar (sticky) ---------------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-right { flex: 1; justify-content: flex-end; }
.count-pill {
  font-size: 12.5px; color: var(--ink-soft); font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.count-pill:empty { display: none; }
.result-line {
  font-size: 12.5px; color: var(--muted); font-weight: 600;
  max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------- warn ---------------- */
.warn {
  background: var(--warn-soft); border: 1px solid rgba(214,164,74,.4); color: #e6c585;
  border-radius: 12px; padding: 11px 15px; font-size: 13px; margin-bottom: 16px;
  animation: rise .3s var(--ease) both;
}

/* ---------------- work grid (3 columns) ---------------- */
.work { animation: rise .45s var(--ease) both; }
.work-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 20px; align-items: start;
}
/* LEFT: settings rail (normal flow, no sticky) */
.work-left {
  display: flex; flex-direction: column; gap: 14px;
}
.rail-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 2px 4px 0;
}
.rail-title svg { color: var(--primary); }
/* RIGHT: tray (normal flow, no sticky) */
.work-side { display: flex; flex-direction: column; gap: 14px; }
.only-mobile { display: none; }

/* ---------------- image tray ---------------- */
.tray-card {
  max-height: calc(100vh - 148px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.tray-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 15px 10px;
}
.tray-head h3 {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font-size: 14px; line-height: 1.2;
}
.tray-head .num {
  min-width: 26px; height: 26px; padding: 0 8px;
  display: inline-grid; place-items: center;
  border-radius: 999px; color: var(--primary);
  background: var(--primary-soft); font-size: 12px; font-weight: 700;
}
.btn-text.sm { font-size: 12px; padding: 6px 8px; }
.tray-sub {
  margin: 0; padding: 0 15px 12px;
  color: var(--muted); font-size: 12.5px; line-height: 1.45;
  border-bottom: 1px solid var(--line);
}
.tray {
  flex: 1; min-height: 180px; overflow: auto;
  padding: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start; gap: 9px;
  background: var(--bg-2);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.tray::-webkit-scrollbar { width: 8px; }
.tray::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }
.tray-cell {
  position: relative; display: block; width: 100%; height: 0; padding-bottom: 100%;
  border: 2px solid var(--line); border-radius: 10px; overflow: hidden;
  cursor: pointer; background: var(--surface-2); box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.tray-cell:hover { transform: translateY(-1px); border-color: var(--line-2); }
.tray-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.tray-cell .tick {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 999px;
  color: var(--on-primary); background: rgba(0,0,0,.5);
  opacity: 0; transform: scale(.82); transition: opacity .15s var(--ease), transform .15s var(--ease), background .15s var(--ease);
}
.tray-cell.sel {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm);
}
.tray-cell.sel::after {
  content: ''; position: absolute; inset: 0; background: var(--primary-soft); pointer-events: none;
}
.tray-cell.sel .tick { opacity: 1; transform: scale(1); background: var(--primary); }
.tray-empty {
  grid-column: 1 / -1; min-height: 150px; display: grid; place-items: center; text-align: center;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; background: rgba(255,255,255,.015);
}
.tray-bar {
  position: sticky; bottom: 0; z-index: 1;
  display: grid; grid-template-columns: 1fr; gap: 8px;
  padding: 12px; border-top: 1px solid var(--line);
  background: rgba(33,35,39,.96);
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
}
.btn-primary.sm { font-size: 12.5px; padding: 9px 12px; border-radius: 10px; }

/* ---------------- side cards ---------------- */
.side-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 17px; box-shadow: var(--shadow-sm);
}
.side-card h3 {
  margin: 0 0 13px; font-size: 13px; font-weight: 700; letter-spacing: .01em;
  display: flex; align-items: center; gap: 8px; color: var(--ink);
}
.side-card h3 .ic {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  color: var(--primary); background: var(--primary-soft);
}

.field { margin-top: 13px; }
.field > label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 7px; font-weight: 600; }
.field.two { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }

select, input[type=text], input[type=number] {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 9px 11px; width: 100%;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
select { cursor: pointer; }
select option { background: var(--surface); color: var(--ink); }
input::placeholder { color: var(--muted); }
input:focus, select:focus {
  outline: none; border-color: var(--primary); background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 999px; background: var(--line-2); cursor: pointer; margin-top: 4px; padding: 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--surface); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .15s var(--ease);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--primary);
  border: 3px solid var(--surface); cursor: pointer;
}

/* segmented resize tabs */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 5px;
}
.seg button {
  border: 0; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); background: transparent; padding: 8px 6px; border-radius: 8px;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface-3); color: var(--primary); box-shadow: var(--shadow-sm); }

.seg-body { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; animation: rise .25s var(--ease) both; }
.seg-body[hidden] { display: none; }
.row { display: grid; grid-template-columns: 1fr 84px auto; align-items: center; gap: 8px; }
.row label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.row input { width: 84px; text-align: right; }
.unit { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-2); cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); background: var(--surface-2); padding: 5px 11px; border-radius: 999px;
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.hint { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ---------------- toggle switch (เปลี่ยนจาก checkbox) ---------------- */
.check {
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-soft);
  font-weight: 600; cursor: pointer; user-select: none; margin-top: 10px;
}
.switch { position: relative; display: inline-flex; flex: none; width: 38px; height: 22px; }
.switch input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer; z-index: 1;
}
.slider {
  position: absolute; inset: 0; border-radius: 999px; pointer-events: none;
  background: var(--line-2); transition: background .2s var(--ease);
}
.slider::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #f2f4f8; box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: transform .2s var(--ease);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------- sections ---------------- */
.work-main { display: flex; flex-direction: column; gap: 16px; }
.sections { display: flex; flex-direction: column; gap: 16px; }
.section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  animation: rise .35s var(--ease) both;
}
.section.dragover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }

.sec-head {
  display: grid;
  grid-template-columns: auto minmax(150px, 240px) auto auto auto 1fr auto;
  align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.sec-no {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; color: var(--primary); background: var(--primary-soft);
  font-size: 13px; font-weight: 700;
}
.grip { color: var(--line-2); cursor: grab; font-size: 13px; letter-spacing: -2px; user-select: none; }
.sec-name {
  min-width: 0; width: 100%; font-weight: 700; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px;
}
.sec-name:hover { background: var(--surface-3); border-color: var(--line); }
.sec-name:focus { outline: none; background: var(--surface-3); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.num-tog {
  border: 1px solid var(--line-2); cursor: pointer; font-family: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); background: var(--surface); padding: 6px 11px; border-radius: 999px;
  transition: all .15s var(--ease); white-space: nowrap;
}
.num-tog:hover { border-color: var(--primary); color: var(--primary); }
.num-tog.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.sec-assign {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); cursor: pointer; font-family: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--primary); background: var(--surface); padding: 6px 10px; border-radius: 999px;
  transition: all .15s var(--ease); white-space: nowrap;
}
.sec-assign:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.sec-assign.all { color: var(--ink-soft); }
.sec-assign:disabled {
  opacity: .42; cursor: default; transform: none;
  color: var(--muted); background: var(--surface); border-color: var(--line);
}
.sec-count { justify-self: end; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.sec-del {
  border: 0; cursor: pointer; color: var(--muted); background: transparent;
  width: 28px; height: 28px; border-radius: 8px; font-size: 14px; line-height: 1;
  transition: all .15s var(--ease); flex: none;
}
.sec-del:hover { color: var(--primary); background: var(--primary-soft); }

.sec-body {
  padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 13px; min-height: 96px;
}
.sec-empty {
  grid-column: 1 / -1; display: grid; place-items: center; min-height: 86px;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; background: var(--surface-2);
}
.section.dragover .sec-empty { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------------- card (style แรก: รูปเต็มจัตุรัส + ข้อมูลคลีน) ---------------- */
.card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; cursor: grab; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
  animation: rise .3s var(--ease) both;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.card.dragging { opacity: .4; transform: scale(.97); cursor: grabbing; box-shadow: none; }

.thumb-wrap { position: relative; height: 0; padding-bottom: 100%; background: #141518; overflow: hidden; }
.thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.card:hover .thumb { transform: scale(1.04); }

/* ---- smoothness while dragging: kill transitions/animations that thrash layout ---- */
.dragging-now .card,
.dragging-now .section,
.dragging-now .thumb { transition: none !important; animation: none !important; }
.dragging-now .card:hover { transform: none; box-shadow: var(--shadow-sm); }
.dragging-now .card:hover .thumb { transform: none; }
.dragging-now .card * { pointer-events: none; }

.to-tray, .hover-x, .dl-mini {
  position: absolute; border: 0; cursor: pointer; font-family: inherit;
  opacity: 0; transform: translateY(-4px); transition: opacity .18s var(--ease), transform .18s var(--ease), background .18s var(--ease);
}
.card:hover .to-tray, .card:hover .hover-x, .card:hover .dl-mini { opacity: 1; transform: translateY(0); }
.to-tray {
  top: 8px; left: 8px; font-size: 11.5px; font-weight: 700; padding: 5px 9px; border-radius: 8px;
  color: var(--ink); background: rgba(23,24,27,.85); backdrop-filter: blur(4px); box-shadow: var(--shadow-sm);
}
.to-tray:hover { color: var(--primary); }
.hover-x {
  top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 8px; font-size: 13px; line-height: 1;
  color: #fff; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
}
.hover-x:hover { background: var(--primary); }
.dl-mini {
  bottom: 8px; left: 8px; font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px;
  color: var(--ink); background: rgba(23,24,27,.85); backdrop-filter: blur(4px); box-shadow: var(--shadow-sm);
}
.dl-mini:hover { color: var(--primary); }

.foot { padding: 10px 11px 11px; }
.fname {
  display: flex; align-items: center; gap: 1px; font-size: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; color: var(--ink); flex-wrap: wrap;
}
.pfx { color: var(--muted); }
.mid {
  font-family: inherit; font-size: 12px; color: var(--primary); font-weight: 600;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 2px 4px; min-width: 40px;
}
.mid:hover { border-color: var(--line-2); background: var(--surface-3); }
.mid:focus { outline: none; border-color: var(--primary); background: var(--surface-3); box-shadow: 0 0 0 2px var(--primary-soft); }
.ext { color: var(--muted); }
.dims { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.dims .arr { color: var(--primary); font-weight: 600; }
.saved { margin-top: 3px; font-size: 11px; color: var(--green); font-weight: 600; }

/* add section */
.add-section {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  border: 1.5px dashed var(--line-2); cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); background: transparent; padding: 11px 18px; border-radius: 12px;
  transition: all .18s var(--ease);
}
.add-section:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.add-section svg { color: var(--primary); }

/* ---------------- motion ---------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- responsive ---------------- */
/* collapse 3-col → stacked; settings rail becomes a toggle panel */
@media (max-width: 1080px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-left {
    position: static; max-height: none; overflow: visible; order: 0;
    display: none; padding-right: 0;
  }
  .work-left.open {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 14px;
    margin-bottom: 4px;
  }
  .rail-title { display: none; }
  .work-side { position: static; order: 1; }
  .work-main { order: 2; }
  .only-mobile { display: inline-flex; }
  .tray-card { max-height: 440px; }
  .tray { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
}

@media (max-width: 920px) {
  .tray-card { max-height: 430px; }
  .tray { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .sec-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .num-tog, .sec-assign, .sec-count { grid-row: 2; }
  .sec-del { grid-column: 3; grid-row: 1; }
  .sec-count { justify-self: end; }
}
@media (max-width: 640px) {
  .wrap { padding: 18px 14px 48px; }
  .nav-note { display: none; }
  .nav-in { padding: 10px 14px; }
  .brand-text span { display: none; }
  .hero-steps { grid-template-columns: 1fr; }
  .drop-hero { padding: 40px 18px; }
  .hero h1 { font-size: 22px; }
  .toolbar { position: sticky; top: 58px; margin: 0 0 14px; border-radius: 16px; box-shadow: var(--shadow); z-index: 35; flex-wrap: wrap; }
  .tb-left, .tb-right { width: 100%; justify-content: space-between; }
  .tb-right { flex: none; }
  .btn-light, .btn-text, .btn-primary { min-height: 40px; }
  .count-pill, .result-line { display: none; }
  .tb-right .btn-primary { flex: 1; justify-content: center; }
  .tray-card { max-height: 360px; }
  .tray { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .sec-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .sec-name { grid-column: 2; }
  .num-tog { grid-column: 1 / -1; justify-content: center; }
  .sec-assign { grid-row: auto; }
  .sec-assign.sel { grid-column: 1 / 3; }
  .sec-assign.all { grid-column: 3; }
  .sec-count { grid-column: 1 / 3; justify-self: start; }
  .sec-del { justify-self: end; }
  .sec-body { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 10px; gap: 10px; }
  .hover-x, .dl-mini, .to-tray { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
