@media (max-width: 640px) {
  body { font-size: 16px; }
}

.google-login { display: grid; gap: 10px; }
.google-button { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: var(--ink); border: 1px solid #d5d9d3; }
.google-button:hover { background: #f8faf8; border-color: #aeb8b1; color: var(--ink); }
.google-button svg { width: 22px; height: 22px; flex: 0 0 22px; }

.header-login-button {
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  box-shadow: none;
}
.header-login-button:hover { background: var(--green-dark); }

.group-id { margin-top: 5px !important; }
.group-id code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); background: var(--green-soft); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.62); }
.report-toolbar > div { display: grid; gap: 2px; }
.report-toolbar strong { font-size: 16px; }
.report-toolbar span { color: var(--muted); font-size: 12px; }
.report-toolbar > button { display: inline-flex; align-items: center; gap: 8px; }
.report-toolbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.empty-state { padding: 56px 24px; text-align: center; background: rgba(255,255,255,.58); border: 1px dashed #c8cec8; border-radius: 20px; }
.empty-state svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--green-soft); fill: none; stroke: var(--green); stroke-width: 1.8; }
.empty-state strong { display: block; margin: 13px 0 4px; font-size: 16px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

.report-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 30px 90px rgba(20,35,30,.24); overflow: auto; }
.report-dialog::backdrop { background: rgba(13,26,21,.48); backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 28px 30px 22px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 7px 0 5px; font-size: 28px; letter-spacing: -.035em; }
.dialog-header p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.icon-button { min-width: 44px; width: 44px; padding: 0; display: grid; place-items: center; background: transparent; color: var(--muted); border: 1px solid var(--line); box-shadow: none; }
.icon-button:hover { background: var(--green-soft); color: var(--ink); box-shadow: none; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.report-dialog form { padding: 26px 30px 30px; }
.report-dialog-fields { grid-template-columns: 1fr 1fr; }
.report-dialog-fields label:first-child { grid-column: 1 / -1; }
.report-connection-fields { grid-template-columns:repeat(3,minmax(0,1fr)); }
.workspace-layout { display:grid; grid-template-columns:210px minmax(0,1fr); gap:22px; align-items:start; }
.workspace-content { min-width:0; }
.workspace-nav { position:sticky; top:20px; display:grid; gap:6px; max-width:none; margin:0; padding:8px; border-radius:17px; }
.workspace-nav button { width:100%; display:flex; align-items:center; justify-content:flex-start; gap:10px; padding:11px 13px; text-align:left; }
.workspace-nav button svg { width:19px; height:19px; flex:0 0 19px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.run-status { padding:6px 10px; border-radius:999px; font-size:11px; font-weight:800; white-space:nowrap; }
.run-status.success { color:#17623f; background:#e5f4ea; }
.run-status.error { color:#8a2929; background:#f9e7e4; }
.sheet-fields { grid-template-columns:1fr 2fr; }
.connection-header { display:flex; align-items:center; justify-content:space-between; padding:18px 20px; border:1px solid var(--line); border-radius:18px; background:rgba(255,255,255,.62); }
.connection-header > div { display:grid; gap:2px; }
.connection-header strong { font-size:16px; }
.connection-header span { color:var(--muted); font-size:12px; }
.connection-nav { display:flex; gap:6px; margin:14px 0 0; padding:5px; max-width:max-content; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.58); }
.connection-nav button { padding:9px 14px; background:transparent; color:var(--muted); box-shadow:none; }
.connection-nav button.active { background:var(--green-soft); color:var(--green-dark); }
.connection-panel { margin-top:14px; }
.sheet-bot-note { display:flex; align-items:center; gap:10px; margin:0 0 18px; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--green-soft); }
.sheet-bot-note > span { color:var(--muted); font-size:12px; font-weight:700; }
.sheet-bot-note code { min-width:0; flex:1; color:var(--green-dark); font:700 12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere; }
.sheet-bot-note button { min-height:38px; padding:7px 12px; font-size:12px; }
.flow-section { padding:0 0 22px; margin:0 0 22px; border-bottom:1px solid var(--line); }
.flow-section:last-of-type { margin-bottom:0; }
.flow-section-title { display:flex; align-items:center; gap:11px; margin-bottom:16px; }
.flow-section-title > span { width:30px; height:30px; display:grid; place-items:center; border-radius:50%; background:var(--green-soft); color:var(--green-dark); font-weight:800; font-size:13px; }
.flow-section-title > div { display:grid; gap:1px; }
.flow-section-title strong { font-size:14px; }
.flow-section-title small,.field-help { color:var(--muted); font-size:11px; font-weight:500; }
.field-wide { grid-column:1 / -1; }
textarea { width:100%; box-sizing:border-box; resize:vertical; min-height:104px; padding:14px 16px; border:1px solid #d5d9d3; border-radius:12px; background:#fff; color:var(--ink); font:inherit; }
textarea:focus { outline:2px solid rgba(31,105,77,.16); border-color:var(--green); }
.app-active { background:#f5f4ef; overflow-x:hidden; }
.app-active .shell { max-width:none; padding:0; }
.app-active > .shell > .topbar,.app-active > .shell > footer,.app-active .dashboard-heading { display:none; }
.app-active .dashboard { margin:0; }
.app-active .workspace-layout { min-height:100dvh; grid-template-columns:248px minmax(0,1fr); gap:0; align-items:stretch; }
.app-sidebar { position:sticky; top:0; height:100dvh; min-height:100dvh; padding:24px 16px; display:flex; flex-direction:column; align-self:start; overflow:hidden; background:var(--ink); color:#fff; }
.sidebar-brand { display:flex; align-items:center; gap:12px; padding:0 8px 28px; color:#fff; text-decoration:none; }
.sidebar-brand img { width:42px; height:42px; border-radius:12px; object-fit:cover; }
.sidebar-brand span { display:grid; gap:1px; }
.sidebar-brand strong { font-size:15px; }
.sidebar-brand small { color:#a9bbb3; font-size:11px; }
.app-sidebar .workspace-nav { position:static; display:grid; gap:6px; margin:0; padding:0; border:0; border-radius:0; background:transparent; }
.app-sidebar .workspace-nav button { min-height:46px; padding:0 14px; border-radius:11px; color:#c7d4ce; }
.app-sidebar .workspace-nav button:hover { background:#263b32; color:#fff; box-shadow:none; }
.app-sidebar .workspace-nav button.active { background:#fff; color:var(--ink); }
.sidebar-account { margin-top:auto; padding:20px 8px 2px; border-top:1px solid #2d4038; display:grid; grid-template-columns:34px minmax(0,1fr); gap:10px; align-items:center; }
.sidebar-avatar { width:34px; height:34px; display:grid; place-items:center; border-radius:50%; background:#d9f99d; color:#173c2d; font-size:12px; font-weight:800; }
.sidebar-account > div { min-width:0; display:grid; }
.sidebar-account strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.sidebar-account small { color:#9fb0a8; font-size:10px; }
.sidebar-account button { grid-column:1 / -1; min-height:40px; margin-top:2px; padding:8px 12px; border:1px solid #40544b; background:transparent; color:#dbe5e0; box-shadow:none; }
.workspace-content { width:100%; min-width:0; overflow-x:hidden; background:#f5f4ef; }
.workspace-header { min-height:76px; padding:0 42px; display:flex; align-items:center; justify-content:space-between; gap:24px; border-bottom:1px solid #dde1da; background:rgba(255,255,255,.72); }
.workspace-header > div { display:grid; gap:2px; }
.workspace-header h2 { margin:0; font-size:18px; letter-spacing:-.02em; }
.workspace-header p { margin:0; color:var(--muted); font-size:12px; }
.workspace-header button { display:flex; align-items:center; gap:8px; }
.workspace-header svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.workspace-view { padding:32px 42px 48px; }
.workspace-view .report-toolbar,.workspace-view .connection-header { background:#fff; }
.reportsView { min-width:0; }
.app-active .report-toolbar > button { display:none; }
.form-notice { margin-bottom: 18px; padding: 12px 14px; border-radius: 11px; background: #fff7e5; color: #71510b; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.button-quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.button-quiet:hover { background: #f4f5f2; color: var(--ink); box-shadow: none; }
.flow-page-head { display:grid; grid-template-columns:auto minmax(0,1fr); gap:18px; align-items:start; max-width:980px; margin:0 auto 22px; }
.flow-page-head .button-quiet { display:flex; align-items:center; gap:6px; min-height:42px; padding:8px 12px; }
.flow-page-head .button-quiet svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.flow-page-head h2 { margin:6px 0 4px; font-size:28px; letter-spacing:-.035em; }
.flow-page-head p:last-child { margin:0; color:var(--muted); font-size:13px; }
.flow-page-form { max-width:980px; margin:0 auto; padding:30px; border:1px solid var(--line); border-radius:22px; background:#fff; box-shadow:var(--shadow); }
.flow-type-fieldset { min-width:0; margin:0 0 28px; padding:0 0 28px; border:0; border-bottom:1px solid var(--line); }
.flow-type-fieldset legend { margin-bottom:12px; color:var(--ink); font-size:13px; font-weight:800; }
.flow-type-select { display:grid; gap:8px; max-width:620px; }
.flow-type-select select { min-height:56px; font-weight:750; }
.flow-type-select > span { color:var(--muted); font-size:12px; font-weight:500; }
.flow-type-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.flow-type-card { position:relative; min-height:132px; display:grid; grid-template-columns:46px minmax(0,1fr) 24px; gap:14px; align-items:start; padding:20px; border:1px solid var(--line); border-radius:16px; background:#fafbf9; cursor:pointer; transition:border-color .18s,box-shadow .18s,background .18s; }
.flow-type-card:hover { border-color:#aab8b0; background:#fff; }
.flow-type-card.selected { border-color:var(--green); background:var(--green-soft); box-shadow:0 0 0 3px rgba(29,101,76,.1); }
.flow-type-card input { position:absolute; opacity:0; pointer-events:none; }
.flow-type-card:focus-within { outline:3px solid rgba(29,101,76,.22); outline-offset:2px; }
.flow-type-icon { width:46px; height:46px; display:grid; place-items:center; border-radius:13px; background:#fff; color:var(--green); border:1px solid var(--line); }
.flow-type-icon svg { width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.flow-type-card strong,.flow-type-card small { display:block; }
.flow-type-card strong { margin:2px 0 5px; font-size:15px; color:var(--ink); }
.flow-type-card small { color:var(--muted); font-size:12px; line-height:1.55; font-weight:500; }
.flow-type-check { width:22px; height:22px; display:grid; place-items:center; border-radius:50%; border:1px solid #cbd2cd; color:transparent; background:#fff; font-size:12px; font-weight:900; }
.flow-type-card.selected .flow-type-check { border-color:var(--green); background:var(--green); color:#fff; }
.flow-page-actions { position:sticky; bottom:0; z-index:2; display:flex; justify-content:flex-end; gap:10px; margin:24px -30px -30px; padding:18px 30px; border-top:1px solid var(--line); border-radius:0 0 22px 22px; background:rgba(255,255,255,.96); backdrop-filter:blur(8px); }
.report-type-badge { display:inline-flex; margin-bottom:7px; padding:4px 8px; border-radius:999px; background:var(--green-soft); color:var(--green-dark); font-size:10px; font-weight:800; }
.order-tab-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.order-tab-list > p { grid-column:1/-1; margin:0; padding:16px; border:1px dashed #c8cec8; border-radius:12px; color:var(--muted); font-size:12px; }
.order-tab-option { min-width:0; display:flex; align-items:center; gap:11px; min-height:52px; padding:11px 14px; border:1px solid var(--line); border-radius:12px; background:#fafbf9; color:var(--ink); font-size:13px; font-weight:700; cursor:pointer; }
.order-tab-option span { min-width:0; overflow-wrap:anywhere; }
.order-tab-option:has(input:checked) { border-color:var(--green); background:var(--green-soft); }
.order-tab-option input { width:20px; min-height:20px; flex:0 0 20px; accent-color:var(--green); }
.setup-panel { display:grid; gap:18px; }
.setup-panel h2 { margin:0; }
.setup-panel ol { margin:0; padding-left:22px; color:var(--muted); line-height:1.8; }
.setup-panel textarea { width:100%; min-height:360px; resize:vertical; font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }

@media (max-width: 1100px) {
  .workspace-header { padding-inline:24px; }
  .workspace-view { padding-inline:24px; }
  .flow-page-head { grid-template-columns:1fr; }
  .flow-page-head .button-quiet { width:max-content; }
  .flow-type-grid { grid-template-columns:1fr; }
  .report-dialog-fields { grid-template-columns:1fr; }
  .report-dialog-fields label:first-child,.field-wide { grid-column:auto; }
  .report-connection-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .report-connection-fields label:first-child { grid-column:1/-1; }
  .order-tab-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .app-active .workspace-layout { display:block; min-height:100dvh; }
  .app-sidebar { position:static; height:auto; min-height:auto; padding:0; overflow:visible; background:var(--ink); }
  .sidebar-brand { min-height:68px; padding:0 18px; }
  .sidebar-brand img { width:36px; height:36px; border-radius:10px; }
  .sidebar-account { display:none; }
  .app-sidebar .workspace-nav { display:flex; gap:6px; padding:10px 14px; overflow:auto; background:#fff; border-bottom:1px solid var(--line); }
  .app-sidebar .workspace-nav button { min-height:42px; width:auto; flex:1 0 auto; padding:0 14px; justify-content:center; background:#f0f2ef; color:#53635b; }
  .app-sidebar .workspace-nav button svg { display:none; }
  .app-sidebar .workspace-nav button.active { background:var(--ink); color:#fff; }
  .workspace-header { min-height:76px; padding:0 16px; }
  .workspace-header p { display:none; }
  .workspace-header button { width:44px; min-width:44px; padding:0; justify-content:center; font-size:0; }
  .workspace-header button svg { width:21px; height:21px; }
  .workspace-view { padding:20px 16px 36px; }
  .workspace-layout { display:block; }
  .workspace-nav { position:static; display:flex; max-width:none; margin-bottom:16px; overflow:auto; }
  .workspace-nav button { width:auto; flex:0 0 auto; white-space:nowrap; }
  .report-toolbar { align-items: stretch; flex-direction: column; }
  .report-toolbar > button { justify-content: center; width: 100%; }
  .report-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 20px; }
  .dialog-header { padding: 22px 20px 18px; }
  .report-dialog form { padding: 20px; }
  .report-dialog-fields { grid-template-columns: 1fr; }
  .report-dialog-fields label:first-child { grid-column: auto; }
  .report-connection-fields { grid-template-columns:1fr; }
  .field-wide { grid-column:auto; }
  .connection-nav { max-width:none; overflow:auto; }
  .connection-nav button { white-space:nowrap; }
  .sheet-bot-note { align-items:flex-start; flex-wrap:wrap; }
  .sheet-bot-note code { flex-basis:100%; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .flow-page-head { grid-template-columns:1fr; gap:12px; }
  .flow-page-head .button-quiet { width:max-content; }
  .flow-page-head h2 { font-size:24px; }
  .flow-page-form { padding:20px; border-radius:18px; }
  .flow-type-grid { grid-template-columns:1fr; }
  .flow-type-card { min-height:0; padding:16px; grid-template-columns:42px minmax(0,1fr) 22px; }
  .flow-type-icon { width:42px; height:42px; }
  .flow-page-actions { margin:22px -20px -20px; padding:14px 20px; grid-template-columns:1fr 1fr; display:grid; border-radius:0 0 18px 18px; }
  .order-tab-list { grid-template-columns:1fr; }
}
