.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
[hidden] { display: none !important; }
.login-screen { min-height: 100vh; padding: 24px; display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 34px; display: grid; gap: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 35px 90px #0008; }
.login-card > div h1 { margin: 6px 0; font-size: 32px; }
.login-card > div p:last-child { margin: 0; color: var(--muted); }
.login-card label:not(.remember) { display: grid; gap: 7px; font-weight: 700; }
.remember { display: flex; align-items: center; gap: 9px; color: var(--muted); cursor: pointer; }
.remember input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-error { min-height: 24px; margin: 0; color: #ff7c89; }
.danger { padding: 12px 16px; border: 1px solid #7f2631; border-radius: 12px; background: #35131a; color: #ff8491; font-weight: 800; cursor: pointer; }
.danger:hover { background: #4b1822; border-color: #b83a49; }
.workspace { min-width: 0; }
.sidebar {
  height: 100vh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 20;
  border-right: 1px solid var(--line);
  background: #090f1b;
}
.sidebar nav { display: grid; gap: 8px; margin-top: 42px; }
.side-link {
  width: 100%;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}
.side-link span { width: 24px; color: var(--accent); font-size: 20px; text-align: center; }
.side-link:hover, .side-link.active { border-color: var(--line); background: var(--panel); color: var(--text); }
.sidebar-foot { margin-top: auto; padding: 16px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.sidebar-foot small { display: block; margin-top: 7px; color: var(--muted); }
.sidebar-foot .app-version { margin-top: 10px; color: #607089; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.user-card { width: 100%; margin-top: 10px; padding: 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.user-card:hover { border-color: #3a506e; }
.user-card > span:nth-child(2) { min-width: 0; display: grid; flex: 1; }
.user-card small { color: var(--muted); }
.user-card strong { overflow: hidden; text-overflow: ellipsis; }
.user-card > b { color: var(--muted); font-size: 22px; }
.user-avatar { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #03160e; font-weight: 900; }
#email-permission-note { color: var(--muted); font-weight: 500; }
.mobile-side-toggle { display: none; margin-bottom: 20px; border: 0; background: none; color: var(--text); font-size: 24px; }
.projects-heading { align-items: flex-end; margin-bottom: 24px; }
.projects-heading h1 { margin: 4px 0 6px; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.035em; }
.projects-heading p:last-child { margin: 0; color: var(--muted); }
.refresh-button { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 25px; line-height: 1; }
.refresh-button:hover { border-color: var(--accent); color: var(--accent); }
.project-metrics { margin: 0 0 28px; }
.project { cursor: pointer; transition: border-color .18s ease, transform .18s ease; }
.project:hover { border-color: #3a506e; transform: translateY(-2px); }
.projects { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.project { padding: 18px; border-radius: 17px; display: flex; flex-direction: column; }
.project-head { align-items: center; gap: 10px; }
.project h3 { margin: 0; min-width: 0; font-size: 18px; line-height: 1.25; }
.design-badge { max-width: 118px; margin-left: auto; padding: 5px 9px; overflow: hidden; border-radius: 999px; background: #293447; color: #c8d2e3; font-size: 10px; font-weight: 850; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.project-status { margin-top: 18px; }
.project-status .badge.ready, .project-status .badge.passed { color: #45e5a3; }
.project-status .badge.ready_to_deploy { background: #163753; color: #84d2ff; }
.project-status .badge.queued { background: #173253; color: #86bdff; }
.project-status .badge.needs_completion { background: #473611; color: #ffd572; }
.project-status .badge.failed, .project-status .badge.cancelled { background: #461923; color: #ff8e99; }
.project-status small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.project-owner { max-width: 105px; margin-left: auto; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.project .badge { flex: 0 0 auto; }
.project-meta { margin: 12px 0; display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 5px; }
.project-meta span { width: fit-content; min-width: 0; max-width: 100%; flex: 0 1 auto; padding: 4px 7px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.project-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.created-bubbles { display: flex; flex-wrap: wrap; gap: 6px; }
.created-bubbles span { padding: 4px 7px; border-radius: 999px; background: var(--panel2); color: var(--muted); font-size: 10px; white-space: nowrap; }
.details-dialog { width: min(1080px, calc(100% - 32px)); overflow: auto; }
.details-tabs { width: fit-content; max-width: calc(100% - 56px); margin: 20px 28px 0; padding: 4px; display: inline-flex; gap: 4px; border: 1px solid var(--line); border-radius: 13px; background: #0b1320; }
.details-tab { padding: 9px 15px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.details-tab.active { background: var(--panel2); color: var(--text); }
.project-details-body { padding: 20px 28px; }
.project-details-overview { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; gap: 28px; }
.project-details-files { min-width: 0; }
.project-details-quality { min-width: 0; }
.project-details-body h3 { margin: 0 0 14px; }
.project-keywords-content { max-height: 280px; overflow: auto; margin-top: 12px; overflow-wrap: anywhere; }
.project-keywords-content[hidden] { display: none; }
.project-keywords-content ul { margin: 0; padding-left: 20px; }
.project-keywords-content li + li { margin-top: 4px; }
.parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.parameter-grid .parameter { min-height: 0; }
.parameter-grid .parameter--wide { grid-column: 1 / -1; }
.parameter { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #0b1320; overflow-wrap: anywhere; }
.parameter small { display: block; margin-bottom: 3px; color: var(--muted); }
.qa-issue { display: grid; gap: 3px; padding: 9px 0; border-top: 1px solid var(--line); }
.qa-issue:first-of-type { margin-top: 8px; }
.qa-issue strong { color: #ffbd66; font-size: 12px; text-transform: uppercase; }
.qa-issue span { color: var(--muted); font-size: 13px; }
.selective-actions { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
.selective-actions select { grid-column: 1 / -1; min-width: 0; height: 42px; }
.selective-actions [data-project-correction], .selective-actions [data-rebuild-page] { grid-column: 1 / -1; min-height: 46px; }
.selective-actions button { width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.project-completion-panel { display: grid; gap: 14px; border-color: #705723; background: linear-gradient(145deg, #171b21, #171f2c); }
.project-completion-panel--blocked { border-color: #71333d; }
.project-completion-panel--blocked .project-completion-head > span { background: #461923; color: #ff8e99; }
.project-completion-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.project-completion-head > div { min-width: 0; }
.project-completion-head small, .project-completion-head strong { display: block; }
.project-completion-head strong { margin-top: 2px; font-size: 18px; }
.project-completion-head > span { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #473611; color: #ffd572; font-size: 11px; font-weight: 850; }
.project-completion-pages { margin: 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.project-completion-pages li { min-width: 0; padding: 9px 11px; display: grid; grid-template-columns: minmax(120px, .42fr) minmax(0, 1fr); gap: 12px; border: 1px solid var(--line); border-radius: 9px; background: #0b1320; }
.project-completion-pages strong, .project-completion-pages span { min-width: 0; overflow-wrap: anywhere; }
.project-completion-pages strong { font-size: 13px; }
.project-completion-pages span, .project-completion-empty { color: var(--muted); font-size: 12px; }
.project-completion-empty { margin: 0; }
.project-completion-panel [data-project-complete] { width: fit-content; max-width: 100%; min-height: 42px; white-space: normal; }
.ui-dialog { width: min(560px, calc(100% - 32px)); }
.ui-dialog__body { padding: 22px 28px; color: var(--muted); white-space: pre-wrap; }
.ui-dialog__actions { padding: 0 28px 28px; display: flex; justify-content: flex-end; gap: 10px; }
.versions-dialog { width: min(720px, calc(100% - 32px)); }
.keywords-dialog { width: min(1180px, calc(100% - 32px)); max-height: min(860px, calc(100vh - 32px)); }
.dialog-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.keywords-table-wrap { margin: 0 24px 24px; overflow: auto; max-height: min(680px, calc(100vh - 180px)); border: 1px solid var(--line); border-radius: 12px; background: #0b1320; }
.keywords-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.keywords-table th { position: sticky; top: 0; z-index: 1; padding: 12px; text-align: left; color: var(--muted); background: #101b2c; border-bottom: 1px solid var(--line); white-space: nowrap; }
.keywords-table td { padding: 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
.keywords-table tbody tr:last-child td { border-bottom: 0; }
.keywords-table td:first-child { min-width: 230px; }
.keywords-table td strong, .keywords-table td a { display: block; }
.keywords-table td a { width: fit-content; margin-top: 5px; color: var(--accent); font-size: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-grid .form-field { display: grid; gap: 7px; color: #c4cede; font-size: 13px; font-weight: 700; }
.reference-upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reference-upload-grid label { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #0b1320; }
.reference-upload-grid input[type="file"] { height: auto; min-height: 0; padding: 8px 0 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.reference-upload-field > small { color: var(--muted); font-weight: 500; }
.keyword-import-controls { margin-top: 5px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.keyword-file-input { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; opacity: 0; clip-path: inset(50%); }
#project-dialog .keyword-file-input { width: 1px; min-width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; }
.keyword-file-button { min-height: 38px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); color: var(--text); font-size: 12px; font-weight: 800; line-height: 1; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.keyword-file-button:hover { border-color: #3b5275; background: #1c2a40; }
.keyword-file-input:focus-visible + .keyword-file-button { border-color: var(--accent); box-shadow: 0 0 0 2px #00d08430; }
.keyword-file-name { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.keyword-import-controls output { justify-self: end; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.keyword-import-controls output.is-error { color: #ff8491; }
.correction-dialog { width: min(720px, calc(100% - 32px)); }
.correction-dialog .ui-dialog__body { display: grid; gap: 16px; }
.correction-dialog label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.correction-dialog label.checkbox-row { display: flex; align-items: center; gap: 9px; color: var(--text); cursor: pointer; }
.correction-dialog .checkbox-row input { flex: 0 0 auto; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--accent); }
.correction-dialog select, .correction-dialog textarea { width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #0b1320; color: var(--text); font: inherit; line-height: 1.35; outline: none; }
.correction-dialog select { height: 48px; min-height: 48px; appearance: auto; }
.correction-dialog textarea { min-height: 168px; resize: vertical; }
.qa-correction-guidance h3, .correction-history h3 { margin: 0 0 10px; color: var(--text); font-size: 15px; }
.qa-correction-guidance > [data-keywords-refresh], .qa-correction-guidance > [data-vision-refresh] { margin-top: 10px; }
.qa-correction-guidance:has(.qa-correction-item) { max-height: 300px; overflow: auto; padding-right: 4px; }
.qa-correction-item { padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 12px; border: 1px solid var(--line); border-radius: 11px; background: #0b1320; }
.qa-correction-item + .qa-correction-item { margin-top: 8px; }
.qa-correction-item strong, .qa-correction-item small { display: block; }
.qa-correction-item small, .qa-correction-item p { color: var(--muted); }
.qa-correction-item p { margin: 5px 0 0; font-size: 13px; }
.qa-correction-item button { padding: 8px 11px; }
.correction-history { padding-top: 2px; }
#correction-history { max-height: 220px; overflow: auto; padding-right: 4px; }
.correction-history-item { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--panel2) 55%, transparent); }
.correction-history-item + .correction-history-item { margin-top: 8px; }
.correction-history-item strong, .correction-history-item small { display: block; }
.correction-history-item strong { text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.correction-history-item small, .correction-history-item p { color: var(--muted); }
.correction-history-item p { margin: 5px 0 0; font-size: 13px; }
.correction-dialog select:focus, .correction-dialog textarea:focus { border-color: var(--accent); }
.versions-list { display: grid; gap: 9px; max-height: 58vh; overflow: auto; }
.version-row { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 12px; background: #0b1320; }
.version-row div { min-width: 0; display: grid; gap: 2px; }
.version-row strong { overflow-wrap: anywhere; }
.version-row small { color: var(--muted); }
.compact-empty { padding: 28px; }
.notice-stack { position: fixed; right: 22px; bottom: 22px; z-index: 1000; width: min(420px, calc(100% - 44px)); display: grid; gap: 10px; pointer-events: none; }
.notice { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel2); color: var(--text); box-shadow: 0 18px 50px #0009; opacity: 0; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice.is-visible { opacity: 1; transform: translateY(0); }
.notice--success { border-color: #16875f; background: #0b3529; }
.notice--warning { border-color: #8b6724; background: #3b2d10; }
.notice--error { border-color: #a74250; background: #421922; }
.file-list { max-height: min(56vh, 600px); overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #080e18; }
.file-row { padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); font: 13px/1.4 ui-monospace, SFMono-Regular, monospace; }
.file-row:last-child { border-bottom: 0; }
.file-row small { color: var(--muted); white-space: nowrap; }
.details-actions { padding: 0 28px 28px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.details-actions button:disabled { opacity: .45; cursor: not-allowed; }
.log-dialog__note { max-width: 680px; margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.details-delete { margin-right: auto; }
.download-link { text-decoration: none; }
.dialog-body { padding: 24px 28px 0; }
.setting-note { margin: 0 0 20px; color: var(--muted); }
.key-status { margin-bottom: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #0b1320; color: var(--muted); }
.api-fields { display: grid; gap: 18px; }
.api-fields .setting-note, .api-fields .key-status { margin: 0; }
.api-fields > label { display: grid; min-width: 0; gap: 7px; color: var(--text); font-size: 14px; font-weight: 700; }
.api-fields .secret-input { margin-top: 0; }
.field-help { display: block; width: 100%; margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.4; }
.settings-dialog .close { display: grid; width: 42px; height: 42px; flex: 0 0 42px; padding: 0; place-items: center; border: 1px solid transparent; border-radius: 10px; outline: 0; line-height: 1; }
.settings-dialog .close:hover { border-color: var(--line); background: var(--panel2); color: var(--text); }
.settings-dialog .close:focus-visible { border-color: var(--accent2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent2) 22%, transparent); }
.secret-input { display: flex; margin-top: 7px; }
.secret-input input { border-radius: 11px 0 0 11px; }
.secret-input button { padding: 0 14px; border: 1px solid var(--line); border-left: 0; border-radius: 0 11px 11px 0; background: var(--panel2); color: var(--text); cursor: pointer; }
@media (max-width: 620px) {
  .settings-dialog form { padding: 18px; }
  .settings-dialog .dialog-head { padding: 18px 18px 0; }
  .settings-dialog .dialog-body { padding: 20px 18px 0; }
  .settings-dialog .form-actions { align-items: stretch; flex-direction: column; }
  .settings-dialog .form-actions p { margin: 0; }
  .settings-dialog .form-actions button { width: 100%; }
}
select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #0b1320; color: var(--text); }
/* Keep every project-form section inside the modal. Fieldsets use a
   min-content inline size in browsers, which made the design cards
   expand the dialog and created a second, almost page-wide scroll area. */
#project-dialog { max-width: calc(100vw - 32px); overflow-x: clip; overflow-y: auto; }
#project-dialog > form { width: 100%; min-width: 0; max-width: 100%; overflow-x: clip; }
#project-dialog fieldset { width: 100%; min-width: 0; max-width: 100%; }
#project-dialog .designs { width: 100%; min-width: 0; max-width: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); }
#project-dialog .designs > label,
#project-dialog .designs span { min-width: 0; max-width: 100%; }
#project-dialog .designs b,
#project-dialog .designs small { overflow-wrap: anywhere; }
.form-grid input:not([type="hidden"]), .form-grid select { height: 48px; min-height: 48px; }
.form-grid { width: 100%; min-width: 0; max-width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid > label, .form-grid > div { min-width: 0; max-width: 100%; }
.form-grid :where(input, select, textarea) { min-width: 0; max-width: 100%; }
.form-section-title { margin-top: 8px; padding-top: 20px; display: grid; gap: 3px; border-top: 1px solid var(--line); }
.form-section-title small { color: var(--muted); font-weight: 500; }
/* Hestia paths are resolved from the domain owner during deployment. */
.deploy-install-fields > label:nth-child(1),
.deploy-install-fields > label:nth-child(2) { display: none; }
.users-list { display: grid; gap: 8px; }
.user-row { padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 11px; background: #0b1320; }
.user-row small { color: var(--muted); }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { width: min(82vw, 280px); position: fixed; left: 0; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 24px 0 70px #0008; }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-side-toggle { display: block; }
  .project-details-overview { grid-template-columns: 1fr; }
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .wide { grid-column: auto; }
  #project-dialog .designs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selective-actions { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .projects { grid-template-columns: 1fr; }
  #project-dialog .designs { grid-template-columns: minmax(0, 1fr); }
  .project-completion-head { align-items: flex-start; }
  .project-completion-pages li { grid-template-columns: 1fr; gap: 3px; }
  .project-completion-panel [data-project-complete] { width: 100%; }
  .keyword-import-controls { grid-template-columns: auto minmax(0, 1fr); }
  .reference-upload-grid { grid-template-columns: minmax(0, 1fr); }
  .keyword-import-controls output { grid-column: 1 / -1; justify-self: start; }
}
