* { box-sizing: border-box; }
:root { --ink: #111; --mute: #6b6b6b; --line: #e3e3e3; --soft: #f6f6f6; --ok: #1b7f3b; --warn: #a15c00; }
html, body { margin: 0; background: #fff; color: var(--ink); font: 15px/1.5 Arial, Helvetica, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 32px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 5; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 22px; }
.brand span { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); border-left: 1px solid var(--line); padding-left: 14px; }
nav { display: flex; gap: 8px; align-items: center; }

main { max-width: 1180px; margin: 0 auto; padding: 36px 32px 60px; }
h1 { font-size: 28px; font-weight: normal; letter-spacing: -.01em; margin: 0 0 6px; }
h3 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: normal; color: var(--mute); margin: 0 0 10px; }
.sub { color: var(--mute); margin: 0 0 28px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
em { font-style: normal; color: var(--mute); font-size: 12px; margin-left: 6px; }

.primary, .ghost { border-radius: 8px; padding: 10px 18px; cursor: pointer; border: 1px solid var(--ink); text-decoration: none; display: inline-block; }
.primary { background: var(--ink); color: #fff; }
.primary:disabled { opacity: .45; cursor: default; }
.ghost { background: #fff; border-color: var(--line); }
.ghost:hover { border-color: var(--ink); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 13px; }
.field input, .field select, .drop input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.field input:focus, .drop input:focus, textarea:focus { outline: none; border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.drop { border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-height: 170px; display: flex; flex-direction: column; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--ink); }
.drop.note { cursor: default; background: var(--soft); border-style: dashed; }
.drop.has { background: var(--soft); }
.drop.bad { border-color: #b00020; }
.dh { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.dh i { font-style: normal; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.dh i.req { color: var(--ink); }
.drop p { color: var(--mute); font-size: 13px; margin: 6px 0 12px; }
.hint { margin-top: auto; font-size: 12px; color: var(--mute); border-top: 1px dashed var(--line); padding-top: 10px; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file button { border: 0; background: none; color: var(--mute); cursor: pointer; padding: 0 2px; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 26px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 8px 0 8px 26px; position: relative; border-bottom: 1px solid var(--soft); font-size: 14px; }
.log li:last-child { border-bottom: 0; }
.log li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.log li.run::before { background: none; border: 2px solid var(--ink); border-top-color: transparent; animation: spin .9s linear infinite; width: 8px; height: 8px; }
.log li.err { color: #b00020; }
.log li.err::before { background: #b00020; }
@keyframes spin { to { transform: rotate(360deg); } }

.resultbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; }
.preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: calc(100vh - 190px); min-height: 560px; background: var(--soft); }
.preview iframe { width: 100%; height: 100%; border: 0; }
.side { display: flex; flex-direction: column; gap: 16px; height: calc(100vh - 190px); min-height: 560px; }
.flags ul { margin: 0; padding-left: 18px; font-size: 13px; max-height: 190px; overflow: auto; }
.flags li { margin-bottom: 6px; }
.flags.empty ul { list-style: none; padding: 0; color: var(--ok); }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; min-height: 80px; }
.msg { border-radius: 10px; padding: 9px 12px; font-size: 14px; white-space: pre-wrap; max-width: 92%; }
.msg.user { background: var(--ink); color: #fff; align-self: flex-end; }
.msg.bot { background: var(--soft); align-self: flex-start; }
.msg.wait { color: var(--mute); }
.composer textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; resize: vertical; }
.composer-row { display: flex; justify-content: space-between; margin-top: 8px; }

.dd { position: relative; }
.menu { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 10px; width: 300px; max-height: 360px; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 6px; }
.menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; }
.menu a small { display: block; color: var(--mute); font-size: 12px; }
.menu a:hover { background: var(--soft); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 10; }
.dialog { background: #fff; border-radius: 14px; padding: 24px; width: 460px; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
  .side, .preview { height: auto; }
}
nav button { white-space: nowrap; }
@media (max-width: 760px) {
  .top { padding: 12px 16px; }
  .brand span { display: none; }
  main { padding: 24px 16px 48px; }
  .grid, .row2 { grid-template-columns: 1fr; }
  .primary, .ghost { padding: 8px 12px; }
}

.field.name { max-width: 520px; margin-bottom: 22px; }
.drop .pw { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; }

/* costs page */
table.costs { width: 100%; border-collapse: collapse; font-size: 14px; }
table.costs th { text-align: left; font-weight: normal; color: var(--mute); border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.costs td { border-bottom: 1px solid var(--line); padding: 8px; }
table.costs tr:last-child td { border-bottom: none; }
table.costs td:last-child, table.costs th:last-child { text-align: right; }
a.ghost { color: var(--ink); }
.card.tint { background: #f5f5f5; margin: 0 0 16px; }

/* sign-in and admin pages */
main.narrow { max-width: 560px; }
.form .field { display: block; margin-bottom: 12px; }
.form .field span { display: block; margin-bottom: 4px; font-size: 13px; color: var(--mute); }
.form input, .form select { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.err { color: #b00020; }
nav a.btn { white-space: nowrap; }

/* Google Drive line on the result page */
#driveBox { margin-top: 6px; }
#driveBox .tiny { padding: 4px 10px; font-size: 13px; }
#driveBox .drivepick input { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; width: 280px; max-width: 60vw; font: inherit; font-size: 13px; }

/* customer folders on the upload page */
.customer { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; background: #fff; }
.customer .ch { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.customer .ch .toggle { border: none; background: none; font-size: 14px; cursor: pointer; transition: transform .15s; padding: 0 4px; }
.customer.open .ch .toggle { transform: rotate(90deg); }
.customer .ctitle { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.customer .cbody { display: none; padding: 0 18px 18px; }
.customer.open .cbody { display: block; }
.customer.open { box-shadow: 0 1px 8px rgba(0,0,0,.06); }
.tiny { padding: 4px 10px; font-size: 13px; }

/* Needs your answer */
#questions { max-height: 420px; overflow: auto; margin: 8px 0; }
#questions .q { border-top: 1px solid var(--line); padding: 10px 0; }
#questions .q p { margin: 0 0 6px; font-size: 14px; }
#questions .q.answered { opacity: .65; }
#questions .qopt { display: inline-block; margin-right: 14px; font-size: 14px; }
#questions textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; }
#questions .qdone { font-size: 13px; color: var(--mute); }
