:root {
  --ink: #17231f;
  --muted: #66736e;
  --paper: #f5f3ec;
  --card: #fffef9;
  --line: #d9ddd6;
  --green: #1e6c55;
  --green-dark: #154c3d;
  --orange: #e5743b;
  --shadow: 0 18px 45px rgba(25, 42, 35, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 90% 0%, #dfece5 0, transparent 30rem), var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 0 .45rem; color: var(--green); font-size: .74rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 600; line-height: 1.08; }
h1 { font-size: clamp(2.15rem, 5vw, 4.3rem); }
h2 { font-size: clamp(1.45rem, 2.5vw, 2rem); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(100%, 31rem); padding: clamp(2rem, 6vw, 4rem); background: rgba(255,254,249,.94); border: 1px solid rgba(23,35,31,.09); border-radius: 2rem; box-shadow: var(--shadow); }
.login-logo-wrap { width: 11.5rem; height: 8.4rem; margin: -1rem 0 1.45rem; overflow: hidden; border-radius: 1.2rem; background: #000; box-shadow: 0 12px 25px rgba(0,0,0,.14); }
.login-logo { display: block; width: 100%; height: 17.25rem; object-fit: cover; object-position: center 44%; transform: translateY(-4.35rem); }
.brand-mark { display: grid; place-items: center; width: 4.2rem; height: 4.2rem; margin-bottom: 1.5rem; border-radius: 1.25rem; color: white; background: var(--green); font: 700 2.25rem Georgia, serif; transform: rotate(-4deg); }
.brand-mark.small { width: 2.35rem; height: 2.35rem; margin: 0; border-radius: .72rem; font-size: 1.25rem; }
.stack { display: grid; gap: 1rem; }
.login-card .stack { margin-top: 2rem; }
label { display: grid; gap: .42rem; color: #34423c; font-weight: 700; font-size: .87rem; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: .8rem; padding: .82rem .9rem; color: var(--ink); background: white; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,108,85,.13); }
.primary, .ghost, .back-button, .tool, .brand-button, .icon-button { border: 0; border-radius: .8rem; padding: .78rem 1rem; font-weight: 800; }
.primary { color: white; background: var(--green); box-shadow: 0 8px 18px rgba(30,108,85,.18); }
.primary:hover { background: var(--green-dark); }
.primary.compact { padding: .62rem .88rem; font-size: .88rem; }
.wide { width: 100%; }
.ghost { color: var(--ink); background: #e9ece7; }
.error { min-height: 1.25rem; color: #a33a30; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 4.6rem; padding: .7rem clamp(1rem, 5vw, 4rem); border-bottom: 1px solid rgba(23,35,31,.09); background: rgba(245,243,236,.88); backdrop-filter: blur(14px); }
.brand-button { display: flex; gap: .8rem; align-items: center; padding: 0; background: transparent; font: 700 1.25rem Georgia, serif; }
.top-actions, .button-row, .section-title, .project-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.user-pill { padding: .52rem .75rem; border-radius: 999px; color: var(--green-dark); background: #dfece5; font-weight: 800; font-size: .84rem; }
.content { width: min(100% - 2rem, 92rem); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 0 5rem; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.25rem; }
.hero-row .muted { max-width: 43rem; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1.15rem; }
.project-card, .card { border: 1px solid rgba(23,35,31,.09); border-radius: 1.35rem; background: var(--card); box-shadow: 0 8px 28px rgba(25,42,35,.055); }
.project-card { display: grid; gap: 1rem; min-height: 16rem; padding: 1.4rem; text-align: left; transition: transform .16s, box-shadow .16s; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card h2 { font-size: 1.55rem; }
.project-meta { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: auto; color: var(--muted); font-size: .8rem; }
.meta-chip { padding: .35rem .55rem; border-radius: 999px; background: #eef0ec; }
.status-line { display: flex; justify-content: space-between; align-items: center; }
.status-pill { display: inline-flex; padding: .43rem .7rem; border-radius: 999px; color: var(--green-dark); background: #dfece5; font-weight: 800; font-size: .78rem; }
.shared-dot { color: var(--orange); font-weight: 800; font-size: .78rem; }
.empty-state { padding: 5rem 1rem; text-align: center; border: 1px dashed #b8c0bb; border-radius: 1.5rem; }
.empty-icon { font-size: 3rem; color: var(--green); }
.back-button { margin-bottom: 1.5rem; padding-left: 0; color: var(--green); background: transparent; }
.project-heading { align-items: end; margin-bottom: 1.5rem; }
.project-heading h1 { font-size: clamp(2.1rem, 5vw, 3.8rem); }
.tabs { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: 1.25rem; padding-bottom: .3rem; }
.tab { white-space: nowrap; border: 0; border-radius: 999px; padding: .67rem .95rem; color: var(--muted); background: transparent; font-weight: 800; }
.tab.active { color: white; background: var(--ink); }
.card { padding: clamp(1.1rem, 3vw, 1.7rem); }
.two-column { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(17rem, .75fr); gap: 1.2rem; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.switch-row { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: .85rem; border: 1px solid var(--line); border-radius: 1rem; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 3.1rem; height: 1.7rem; border-radius: 999px; background: #b9bfbb; transition: .2s; }
.switch::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: white; transition: .2s; }
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch::after { transform: translateX(1.4rem); }
.note-box { display: grid; gap: .35rem; padding: 1rem; border-left: 4px solid var(--orange); border-radius: .3rem .8rem .8rem .3rem; background: #fff5ed; line-height: 1.45; }
.upload-box { padding: 1rem; border: 1px dashed #aab5af; border-radius: 1rem; background: #f8faf7; }
.drawing-list { display: grid; gap: .75rem; }
.drawing-item { display: grid; grid-template-columns: 4rem 1fr auto; gap: .8rem; align-items: center; padding: .7rem; border: 1px solid var(--line); border-radius: .9rem; }
.drawing-thumb { width: 4rem; height: 3.2rem; object-fit: cover; border-radius: .5rem; background: #eee; }
.drawing-info { min-width: 0; }
.drawing-info strong, .drawing-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawing-info span { color: var(--muted); font-size: .78rem; }
.drawing-actions { display: flex; gap: .35rem; }
.drawing-actions a, .drawing-actions button { border: 0; border-radius: .55rem; padding: .48rem .58rem; color: var(--ink); background: #e9ece7; text-decoration: none; font-weight: 800; }
.drawings-layout { grid-template-columns: minmax(19rem,.72fr) minmax(0,1.28fr); }
.tool-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.tool { padding: .5rem .72rem; color: var(--muted); background: #ecefea; }
.tool.active { color: white; background: var(--ink); }
.compact-grid { grid-template-columns: repeat(3,1fr); }
.canvas-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 1rem; background: #dfe3df; }
#drawingCanvas { display: block; width: 100%; height: auto; min-width: 38rem; background: white; touch-action: none; }
.danger-text { color: #9f372d; }
.prompt-output { min-height: 29rem; margin-top: 1rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; background: #f6f8f5; }
.prompt-files { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
.prompt-files a { padding: .6rem .78rem; border-radius: .7rem; color: var(--green-dark); background: #dfece5; text-decoration: none; font-weight: 800; }
.chat-card { display: grid; gap: 1rem; max-width: 60rem; margin: 0 auto; }
.message-list { display: flex; flex-direction: column; gap: .65rem; min-height: 20rem; max-height: 55vh; overflow-y: auto; padding: 1rem; border-radius: 1rem; background: #edf0ec; }
.message { align-self: flex-start; max-width: min(80%,38rem); padding: .72rem .85rem; border-radius: .9rem .9rem .9rem .2rem; background: white; box-shadow: 0 3px 10px rgba(0,0,0,.04); }
.message.mine { align-self: flex-end; border-radius: .9rem .9rem .2rem .9rem; color: white; background: var(--green); }
.message-meta { margin-top: .35rem; font-size: .7rem; opacity: .7; }
.message-form { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: end; }
dialog { width: min(100% - 2rem, 42rem); padding: 0; border: 0; border-radius: 1.4rem; background: var(--card); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(16,28,23,.58); backdrop-filter: blur(4px); }
.dialog-card { padding: clamp(1.3rem,4vw,2rem); }
.icon-button { padding: .3rem .55rem; color: var(--muted); background: transparent; font-size: 1.5rem; }
.check-row { display: flex; gap: .6rem; align-items: center; }
.check-row input { width: auto; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; max-width: 24rem; padding: .8rem 1rem; border-radius: .85rem; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(1rem); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 800px) {
  .login-logo-wrap { width: 10.2rem; height: 7.5rem; }
  .login-logo { height: 15.3rem; transform: translateY(-3.85rem); }
  .hero-row, .project-heading { align-items: stretch; flex-direction: column; }
  .two-column, .drawings-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: repeat(2,1fr); }
  .topbar { padding-inline: 1rem; }
  .user-pill { display: none; }
  .message-form { grid-template-columns: 1fr; }
  .message-form button { width: 100%; }
}
