/* Design Studio — after the team's UI/UX redesign (25 Nov). */
:root {
  --bg: #f4f4f2; --panel: #fff; --line: #e7e7e4; --line2: #d9d9d5; --ink: #111; --text: #333; --dim: #6b6b70; --faint: #9a9a9f;
  --blue: #2c5be0; --blue-soft: #eaf0ff; --voz: #141414; --acoustieg: #157a6e; --red: #d9480f; --ok: #16a34a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.5 "Inter", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, select, textarea, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.grow { flex: 1; }
.muted { color: var(--dim); }
.small { font-size: 12.5px; }
.link { color: var(--blue); cursor: pointer; font-weight: 600; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border: 1px solid var(--line2); background: #fff; border-radius: 10px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: #fafaf8; }
.btn.dark { background: #111; color: #fff; border-color: #111; font-weight: 600; }
.btn.dark:hover { background: #2a2a2a; }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; }
.btn.primary:hover { background: #244fd0; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--dim); }
.btn.ghost:hover { background: #ededea; color: var(--ink); }
.btn.wide { width: 100%; height: 52px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.plus { font-size: 18px; line-height: 1; margin-right: 2px; }
.chip { height: 32px; padding: 0 13px; border: 1px solid var(--line2); border-radius: 999px; background: #fff; cursor: pointer; font-size: 13px; white-space: nowrap; }
.chip:hover { border-color: #b9c6ef; background: var(--blue-soft); }
.chip.danger { color: #c2410c; }
.x { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--dim); }

/* header */
header { height: 72px; display: grid; grid-template-columns: 1fr minmax(300px, 470px) 1fr; align-items: center; gap: 20px; padding: 0 22px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 18px; letter-spacing: -.2px; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: #111; color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; letter-spacing: .3px; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 14px; border-radius: 12px; background: #f1f1ee; color: var(--faint); }
.search:focus-within { background: #fff; box-shadow: 0 0 0 2px #c9d6fb; }
#search { border: 0; outline: none; background: none; width: 100%; color: var(--ink); font-size: 15px; }
kbd { font: 500 11.5px "Inter", sans-serif; color: var(--dim); background: #fff; border: 1px solid var(--line2); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
#newDoc { justify-self: end; height: 44px; }

main { display: grid; grid-template-columns: 332px 1fr 352px; height: calc(100% - 72px); }
aside { background: #fff; display: flex; flex-direction: column; min-height: 0; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }

/* documents */
.list-head { display: flex; justify-content: space-between; padding: 22px 22px 10px; font-size: 12.5px; font-weight: 600; letter-spacing: .8px; color: var(--dim); }
#docs { overflow: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.docrow { display: grid; grid-template-columns: 36px 1fr; gap: 13px; align-items: center; padding: 10px 10px; border-radius: 12px; cursor: pointer; min-width: 0; }
.docrow > div { min-width: 0; }
.docrow:hover { background: #f6f6f4; }
.docrow.on { background: var(--blue-soft); }
.thumb { width: 36px; height: 44px; border-radius: 6px; background: var(--voz); }
.thumb.acoustieg { background: var(--acoustieg); }
.docrow .t { font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.docrow .m { color: var(--dim); font-size: 12.5px; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.badge { font-size: 10.5px; font-weight: 800; letter-spacing: .4px; padding: 1px 6px; border-radius: 4px; color: #fff; background: var(--voz); }
.badge.acoustieg { background: var(--acoustieg); }
.building-tag { color: var(--blue); font-weight: 500; }

/* centre */
#center { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
#composer { flex: 1; overflow: auto; }
.compose-wrap { display: grid; grid-template-columns: minmax(0, 866px) 268px; gap: 28px; padding: 34px 28px 40px 44px; align-items: start; }
.today { color: var(--dim); font-weight: 500; }
h1 { margin: 4px 0 6px; font-size: 38px; font-weight: 800; letter-spacing: -.8px; }
.lead { margin: 0 0 18px; color: var(--dim); font-size: 16px; }
.card { background: #fff; border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.company { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.company button { height: 64px; border-radius: 12px; border: 1.5px solid var(--line2); background: #fff; font-weight: 700; font-size: 17px; letter-spacing: .6px; cursor: pointer; }
.company button.on { background: #111; color: #fff; border-color: #111; }
.company button[data-c="acoustieg"].on { background: var(--acoustieg); border-color: var(--acoustieg); }
.field-label { font-weight: 600; font-size: 14.5px; margin-top: 4px; }
#order { min-height: 290px; resize: vertical; padding: 16px 18px; border: 1.5px solid var(--line2); border-radius: 12px; font-size: 16px; line-height: 1.6; unicode-bidi: plaintext; background: #fff; }
#order:focus { outline: none; border-color: #9db4f5; box-shadow: 0 0 0 3px var(--blue-soft); }
.drop { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1.5px dashed var(--line2); border-radius: 12px; cursor: pointer; color: var(--dim); font-size: 15px; }
.drop:hover, .drop.over { border-color: var(--blue); background: #f7f9ff; }
.drop-icon { width: 40px; height: 40px; border-radius: 10px; background: #f1f1ee; display: flex; align-items: center; justify-content: center; color: var(--text); flex: none; }
.drop-text { flex: 1; }
.filelist { display: flex; flex-wrap: wrap; gap: 6px; }
.filelist:empty { display: none; }
.filelist span { background: #f1f1ee; border-radius: 8px; padding: 4px 10px; font-size: 13px; display: inline-flex; gap: 8px; align-items: center; color: var(--text); }
.filelist span b { cursor: pointer; color: var(--faint); font-weight: 400; }
.more { border-top: 1px solid var(--line); padding-top: 12px; color: var(--text); }
.more summary { cursor: pointer; font-weight: 500; }
.more-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.more-row select { height: 38px; border: 1px solid var(--line2); border-radius: 9px; padding: 0 10px; background: #fff; }
.arrow { margin-left: 6px; }
.compose-side { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.side-card { background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.side-card b { font-size: 15.5px; }
.side-card ol { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 9px; }
.side-card li { counter-increment: s; color: var(--text); }
.side-card li::before { content: counter(s); color: var(--blue); font-weight: 600; margin-right: 12px; }
#recent { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#recent a { color: var(--blue); cursor: pointer; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
#recent a:hover { text-decoration: underline; }

/* document view */
#viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.toolbar .btn { height: 42px; padding: 0 14px; }
.titlebox { min-width: 120px; }
#docTitle { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
#docMeta { color: var(--dim); font-size: 13px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.saved { color: var(--ok); }
.zoom { display: flex; background: #f1f1ee; border-radius: 10px; padding: 3px; }
.zoom button { width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 18px; }
.zoom button:hover { background: #fff; }
select.btn { padding: 0 8px; max-width: 150px; }
.dl-group { display: flex; gap: 8px; }
.pagebar { display: flex; align-items: center; gap: 14px; padding: 10px 22px 6px; color: var(--dim); font-size: 13.5px; }
.pagebar .zoom { padding: 2px; }
.pagebar .zoom button { width: 30px; height: 30px; font-size: 16px; }
.btn.slim { height: 34px; padding: 0 12px; font-size: 13px; }
.titlebox { flex: 1 1 auto; }
#docMeta { overflow: hidden; }
.changed-note { color: var(--red); font-weight: 500; }
#stage { position: relative; flex: 1; min-height: 0; }
iframe.pv { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; background: #dfe7fd; }
#progress div { width: 30%; height: 100%; background: var(--blue); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }

/* building */
#building { flex: 1; overflow: auto; padding: 40px 28px; display: flex; justify-content: center; align-items: flex-start; }
.build-card { width: 100%; max-width: 776px; background: #fff; border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.build-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.build-head h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.build-head p { margin: 6px 0 0; }
.build-card .timer { font-size: 34px; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: #ececea; border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; width: 5%; background: var(--blue); border-radius: 4px; transition: width 1s linear; }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stages span { height: 42px; border-radius: 10px; background: #f1f1ee; color: var(--faint); display: flex; align-items: center; padding: 0 12px; font-weight: 500; font-size: 14px; }
.stages span.done { background: var(--blue-soft); color: var(--blue); }
.stages span.done::before { content: "✓ "; white-space: pre; }
.stages span.now { background: #fff; border: 2px solid var(--blue); color: var(--ink); }
.stages span.now::before { content: "● "; white-space: pre; font-size: 10px; }
.skeleton { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sk { aspect-ratio: 16 / 9; border-radius: 8px; background: #efefec; display: flex; align-items: center; justify-content: center; }
.sk.dark { background: #121212; color: #fff; font-weight: 800; letter-spacing: 3px; font-size: 18px; }
.sk.dark.acoustieg { background: var(--acoustieg); }
.sk.dashed { background: #fff; border: 1.5px dashed var(--line2); }
.sk:not(.dark):not(.dashed) { animation: shimmer 1.6s ease-in-out infinite; }
@keyframes shimmer { 50% { background: #e4e4e0; } }
.build-foot { display: flex; gap: 10px; }

/* changes panel */
.panel-head { padding: 22px 22px 14px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); }
.panel-head b { font-size: 17px; }
#chat { flex: 1; overflow: auto; padding: 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.m { max-width: 92%; border-radius: 16px; padding: 11px 15px; white-space: pre-wrap; word-wrap: break-word; unicode-bidi: plaintext; font-size: 14.5px; line-height: 1.5; }
.m.you { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 5px; }
.m.you .sel { display: block; font-size: 12px; opacity: .8; }
.m.agent { align-self: flex-start; background: #f1f1ee; border-bottom-left-radius: 5px; min-width: 70%; }
.m.agent .head { font-weight: 700; }
.m.agent .body { color: var(--text); }
.m.agent .meta { display: block; color: var(--dim); font-size: 12.5px; margin-top: 4px; }
.m.agent .acts { display: flex; gap: 14px; margin-top: 6px; font-size: 13px; }
.m.agent .acts a { color: var(--blue); cursor: pointer; font-weight: 500; text-decoration: none; }
.m.agent .acts a.plain { color: var(--text); }
.m.error { background: #fdecea; color: #9b1c1c; }
.m .files { display: flex; gap: 8px; margin-top: 8px; }
.m a.dl { font-size: 12.5px; font-weight: 600; color: var(--blue); background: #fff; border-radius: 7px; padding: 3px 9px; text-decoration: none; }
.empty-chat { color: var(--dim); font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; }
.empty-chat b { color: var(--ink); }
#status { margin: 0 18px 10px; padding: 9px 12px; background: #fff7e6; border-radius: 10px; color: #8a5a00; display: flex; gap: 9px; align-items: center; font-size: 13.5px; }
#status .timer { margin-left: auto; font-variant-numeric: tabular-nums; }
.spin { width: 13px; height: 13px; border: 2px solid #e8b04b; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
#selection { margin: 0 18px 10px; padding: 8px 10px 8px 13px; background: var(--blue-soft); color: var(--blue); border-radius: 10px; display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13.5px; }
#selText { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
#selection .chip { height: 28px; font-size: 12.5px; }
#suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
#suggest:empty { display: none; }
.composer { margin: 0 18px 18px; border: 1.5px solid var(--line2); border-radius: 16px; padding: 12px 12px 10px 16px; background: #fff; }
.composer:focus-within { border-color: #9db4f5; }
.composer.over { border-color: var(--blue); background: #f7f9ff; }
.composer.waiting { background: #f1f1ee; border-color: #f1f1ee; }
#msg { width: 100%; border: 0; outline: none; resize: none; height: 56px; font-size: 15px; unicode-bidi: plaintext; background: none; }
.composer-row { display: flex; align-items: center; gap: 8px; }
.attach { color: var(--dim); cursor: pointer; display: flex; padding: 4px; border-radius: 8px; }
.attach:hover { background: #f1f1ee; color: var(--ink); }
.send { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--blue); color: #fff; font-size: 20px; font-weight: 700; cursor: pointer; }
.send:disabled { background: #c7d2f5; cursor: not-allowed; }

/* dialogs */
.modal { position: fixed; inset: 0; background: rgba(20,20,20,.42); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-card { width: min(680px, 92vw); max-height: 88vh; background: #fff; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.modal-card.wide { width: min(1100px, 94vw); }
.modal-head, .modal-foot { display: flex; align-items: center; gap: 10px; }
#editorText { min-height: 220px; border: 1.5px solid var(--line2); border-radius: 12px; padding: 14px; font-size: 15px; line-height: 1.65; resize: vertical; unicode-bidi: plaintext; }
#editorText:focus { outline: none; border-color: #9db4f5; }
#pagerGrid { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; padding: 4px; }
.pthumb { position: relative; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: grab; background: #f1f1ee; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.pthumb img { width: 100%; display: block; pointer-events: none; }
.pthumb.over { border-color: var(--blue); }
.pthumb.dragging { opacity: .4; }
.pthumb.added { border-color: var(--ok); }
.pnum { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; font-weight: 600; border-radius: 5px; padding: 1px 7px; }
.pnew { position: absolute; left: 6px; top: 6px; background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; border-radius: 5px; padding: 1px 6px; }
.pdel { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.pdel:hover { background: #dc2626; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 30; font-size: 14px; }

@media (max-width: 1400px) {
  main { grid-template-columns: 280px 1fr 330px; }
  .compose-wrap { grid-template-columns: 1fr; padding: 28px; }
  .compose-side { display: none; }
}

/* the agent's question before building */
#asking { flex: 1; overflow: auto; padding: 40px 28px; display: flex; justify-content: center; align-items: flex-start; }
#asking h2 { margin: 0; font-size: 24px; }
.ask-text { white-space: pre-wrap; unicode-bidi: plaintext; background: #fff8e8; border-radius: 12px; padding: 16px 18px; font-size: 15px; line-height: 1.6; }
/* background picker */
#bgGrid { overflow: auto; display: flex; flex-direction: column; gap: 22px; padding: 4px 4px 10px; }
.bghead { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.bghead span { color: var(--faint); font-weight: 500; margin-left: 4px; }
.bgrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.bgthumb { border: 2px solid transparent; border-radius: 10px; padding: 0; background: #f1f1ee; cursor: pointer; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.bgthumb:hover { border-color: var(--blue); }
.bgthumb img { width: 100%; height: 150px; object-fit: cover; display: block; flex: none; background: #e9e9e6; }
.bgthumb span { display: block; }
.bgthumb { height: auto; align-items: stretch; }
.bgthumb span { font-size: 12px; color: var(--dim); padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pictures on the page: selectable, under the text */

/* phones (25 Nov): one panel at a time, picked in the bar at the bottom */
#tabs { display: none; }
@media (max-width: 820px) {
  header { height: 60px; grid-template-columns: auto 1fr auto; gap: 10px; padding: 0 12px; }
  .brand-name, .nd-text, kbd { display: none; }
  .search { height: 40px; }
  #newDoc { height: 40px; width: 44px; padding: 0; }
  .plus { margin: 0; font-size: 22px; }
  main { display: block; height: calc(100% - 60px - 62px - env(safe-area-inset-bottom)); }
  main > aside, main > #center { height: 100%; border: 0 !important; }
  body:not([data-tab="docs"]) #left, body:not([data-tab="view"]) #center, body:not([data-tab="chat"]) #right { display: none; }
  #tabs { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 15; }
  #tabs button { position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--faint); cursor: pointer; }
  #tabs button svg { width: 22px; height: 22px; }
  #tabs button.on { color: var(--blue); }
  #tabDot { position: absolute; top: 9px; left: calc(50% + 9px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
  .list-head { padding: 16px 18px 8px; }
  .compose-wrap { padding: 16px; }
  h1 { font-size: 26px; }
  .lead { font-size: 14.5px; }
  .card { padding: 16px; border-radius: 14px; }
  .company button { height: 52px; font-size: 15px; }
  #order { min-height: 200px; font-size: 15px; }
  .drop { padding: 10px 12px; font-size: 14px; }
  .toolbar { flex-wrap: wrap; padding: 10px 12px; gap: 6px; }
  .titlebox { flex-basis: 100%; min-width: 0; }
  .toolbar > .grow { display: none; }
  .toolbar .btn { height: 36px; padding: 0 10px; font-size: 13px; }
  select.btn { max-width: 120px; }
  .dl-group { gap: 6px; }
  .pagebar { flex-wrap: wrap; padding: 8px 12px 4px; gap: 8px; }
  #building, #asking { padding: 16px; }
  .build-card { padding: 20px; gap: 16px; }
  .build-head { flex-direction: column; gap: 6px; }
  .build-head h2 { font-size: 21px; }
  .stages, .skeleton { grid-template-columns: repeat(2, 1fr); }
  .panel-head { padding: 14px 16px 10px; }
  #chat { padding: 14px 12px; }
  .composer { margin: 0 12px 12px; }
  #msg { font-size: 16px; }
  #selection, #status { margin: 0 12px 8px; }
  #suggest { padding: 0 12px 10px; }
  .modal { align-items: flex-end; }
  .modal-card, .modal-card.wide { width: 100vw; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 16px; }
  .modal-head, .modal-foot { flex-wrap: wrap; }
  .bgrow { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bgthumb img { height: 96px; }
  #pagerGrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
}
