:root {
  --ink: #18211e;
  --ink-soft: #42504b;
  --muted: #73807b;
  --line: #dce2df;
  --line-strong: #cbd4d0;
  --paper: #f3f5f2;
  --panel: #ffffff;
  --accent: #176b53;
  --accent-deep: #10513e;
  --accent-soft: #e2f1eb;
  --gold: #b98735;
  --gold-soft: #f6eddd;
  --danger: #b43a32;
  --danger-soft: #fbe9e7;
  --warn: #9b681a;
  --ok: #176b53;
  --sidebar: #16382e;
  --shadow: 0 14px 40px rgba(28, 47, 40, 0.07);
  --radius: 12px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -10%, #e9e1d0 0, transparent 60%),
    var(--paper);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(13, 48, 38, .96), rgba(21, 76, 59, .90)),
    repeating-linear-gradient(45deg, transparent 0 20px, rgba(255,255,255,.03) 20px 21px);
}
.login-card {
  width: min(420px, 100%);
  padding: 34px;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0,0,0,.25);
}
.login-mark, .brand-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: serif;
  font-weight: 700;
}
.login-mark { margin-bottom: 18px; }
.login-brand, .brand-kicker, .eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}
.login-card h1 { margin: 3px 0 6px; font-size: 25px; }
.login-hint { margin: 14px 0 0; text-align: center; }

.field { margin: 16px 0; }
.field label, .form-field label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
.required::after { content: " 必須"; color: var(--danger); font-size: 10px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23,107,83,.12);
}
textarea { min-height: 96px; resize: vertical; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; }

.app {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  color: #eef7f3;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent),
    var(--sidebar);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-symbol { flex: 0 0 38px; width: 38px; height: 38px; }
.brand-kicker { color: #c9ddd5; letter-spacing: .12em; }
.brand h1 { margin: 2px 0 0; font-size: 16px; }
.brand-copy { margin: 15px 3px 24px; color: rgba(238,247,243,.62); font-size: 11px; line-height: 1.7; }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  color: rgba(255,255,255,.75);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}
.nav-item span { color: rgba(255,255,255,.35); font-family: var(--mono); font-size: 10px; }
.nav-item:hover:not(:disabled) { background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); font-weight: 600; }
.nav-item:disabled { opacity: .35; cursor: not-allowed; }
.role-box {
  margin-top: auto;
  padding: 17px 4px 0;
  border-top: 1px solid rgba(255,255,255,.13);
}
.role-box label { color: rgba(255,255,255,.52); font-size: 10px; }
.role-user { margin-top: 4px; font-weight: 600; }
.role-meta { margin: 1px 0 12px; color: rgba(255,255,255,.55); font-size: 11px; }

.main { min-width: 0; padding: 28px 34px 50px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
.eyebrow { margin-bottom: 2px; }
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: .01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.badge, .pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 15px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 600;
}
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn.secondary { color: var(--accent); background: #fff; border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--accent-soft); border-color: #a8c8bc; }
.btn.ghost { min-height: 32px; color: #fff; background: transparent; border-color: rgba(255,255,255,.25); }
.btn.gold { color: #fff; background: var(--gold); border-color: var(--gold); }
.btn.gold:hover { background: #9d722d; }
.btn.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 19px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 20px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 440px; }
.project-list-count { font-size: 12px; white-space: nowrap; }
.project-list-filters {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}
.project-list-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}
.project-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
  font-size: 12px;
  color: var(--muted);
}
.project-filter-field span {
  font-weight: 600;
  color: #3d4a56;
}
.project-filter-field input,
.project-filter-field select {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.project-filter-grow {
  flex: 1 1 240px;
  min-width: 220px;
}
.project-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 1px;
}
.project-list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.project-page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.project-page-size select {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.project-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}
.project-pager .project-page-num {
  min-width: 36px;
  padding-left: 8px;
  padding-right: 8px;
}
.project-pager-info { margin-left: 4px; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat::after { content: ""; position: absolute; right: -18px; bottom: -30px; width: 75px; height: 75px; border: 12px solid var(--accent-soft); border-radius: 50%; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.stat-value { margin-top: 2px; font-family: var(--mono); font-size: 28px; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 12px 15px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); background: #f8f9f7; font-size: 11px; font-weight: 600; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #f7faf8; }
code { color: var(--accent-deep); font-family: var(--mono); font-size: 12px; }
.project-name { font-weight: 600; }
.project-sub { margin-top: 2px; color: var(--muted); font-size: 11px; }
.status {
  display: inline-flex;
  padding: 3px 9px;
  color: var(--muted);
  background: #eef1ef;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
}
.status.analyzed, .status.reviewing { color: #315d89; background: #e5eff9; }
.status.confirmed { color: var(--ok); background: var(--accent-soft); }
.status.exported, .status.completed { color: #7a5417; background: var(--gold-soft); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 20px; }
.form-grid.compact { gap: 12px 14px; }
.form-field.full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.edit-history-panel {
  margin: 18px 0 0;
  padding: 10px 16px 12px;
  background: #f7f9f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.edit-history-panel .collapse-toggle {
  width: 100%;
  padding: 2px 0;
}
.edit-history-panel .collapse-title-wrap {
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
}
.edit-history-panel h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.edit-history-panel.is-open .collapse-chevron {
  margin-top: -4px;
  transform: rotate(45deg);
}
.edit-history-body { margin-top: 10px; }
.edit-history-panel > .muted,
.edit-history-body > .muted { margin: 0; font-size: 12px; }
.edit-history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}
.edit-history-list li {
  padding: 8px 0;
  border-top: 1px solid #e4ebe4;
}
.edit-history-list li:first-child { border-top: 0; padding-top: 0; }
.edit-history-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}
.edit-history-meta time { color: var(--muted); font-variant-numeric: tabular-nums; }
.edit-history-items {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.form-note { margin: 0 0 18px; padding: 12px 14px; color: var(--ink-soft); background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 12px; }
.handoff-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.handoff-box h4 { margin: 0 0 8px; font-size: 13px; }
.handoff-box a { color: var(--accent-deep); font-weight: 600; }

.detail-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.basic-info-panel { margin-bottom: 14px; }
.basic-info-panel.is-collapsed .panel-head { border-bottom: 0; }
.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.collapse-toggle:hover h3 { color: var(--accent-deep); }
.collapse-chevron {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-top: -2px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
}
.basic-info-panel.is-open .collapse-chevron {
  margin-top: -4px;
  transform: rotate(45deg);
}
.collapse-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.collapse-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.documents-panel { margin-top: 14px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.step { padding: 11px 13px; color: var(--muted); background: #e9ece9; border-radius: 8px; font-size: 11px; }
.step strong { display: block; color: inherit; font-size: 13px; }
.step.active { color: var(--accent-deep); background: var(--accent-soft); box-shadow: inset 0 0 0 1px #bad9ce; }
.step.done { color: #fff; background: var(--accent); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 175px;
  padding: 24px;
  text-align: center;
  background: #fbfcfb;
  border: 1.5px dashed #aebdb7;
  border-radius: 10px;
  transition: .15s;
}
.drop-zone.drag { background: var(--accent-soft); border-color: var(--accent); }
.drop-icon { color: var(--accent); font-size: 29px; line-height: 1; }
.drop-zone h4 { margin: 8px 0 2px; }
.file-list { display: grid; gap: 7px; margin-top: 12px; }
.file-item, .document-item, .export-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: #f7f9f7;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
}
.file-item.is-pending, .document-item {
  flex-wrap: wrap;
  align-items: flex-start;
}
.file-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-size { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.remove-file { color: var(--danger); background: transparent; border: 0; }
.file-comment, .file-comment-field {
  flex: 1 0 100%;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}
.file-comment-field {
  display: grid;
  gap: 4px;
  margin-top: 2px;
}
.file-comment-field span { color: var(--muted); font-size: 10px; }
.file-comment-field textarea {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.drop-hint { margin-top: 6px; font-size: 11px; }

.summary-list { margin: 0; }
.summary-list div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.summary-list div:last-child { border: 0; }
.summary-list dt { color: var(--muted); font-size: 11px; }
.summary-list dd { margin: 0; font-size: 12px; font-weight: 500; }

.analysis-panel { margin-top: 14px; }
.analysis-warnings { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #d8b46a; background: #fff8e8; font-size: 12px; }
.analysis-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.analysis-table .col-include,
.quantity-table .col-include {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}
.analysis-table .col-include input,
.quantity-table .col-include input {
  min-width: 0;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent-deep, #1a5c4a);
  cursor: pointer;
}
.analysis-table textarea { min-height: 60px; }
.quantity-table textarea[data-estimate-comment] { min-height: 32px; }
.analysis-table .check-field { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.analysis-table .check-field input { width: 16px; min-width: 16px; height: 16px; padding: 0; }
.analysis-label strong { display: block; font-size: 12px; }
.analysis-label code { color: var(--muted); font-size: 10px; }
.confidence { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.confidence.high { color: var(--ok); }
.confidence.mid { color: var(--warn); }
.confidence.low { color: var(--danger); }
.source { max-width: 190px; color: var(--muted); font-size: 10px; }
.source span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-editor { display: grid; gap: 6px; min-width: 230px; }
.quantity-review { margin-top: 22px; }
.quantity-review .panel-head { padding: 0 0 10px; border: 0; }
.quantity-table-wrap {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
}
.quantity-table {
  width: max-content;
  min-width: 1180px;
  table-layout: auto;
}
.quantity-table thead { position: sticky; top: 0; z-index: 1; background: #f7f9f7; }
.quantity-table th, .quantity-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 8px 10px;
}
.quantity-table .quantity-input { display: flex; align-items: center; gap: 6px; }
.quantity-table .analysis-label { min-width: 160px; }
.quantity-table .analysis-label strong { display: inline; margin-right: 8px; }
.quantity-table .analysis-label code { white-space: nowrap; }
.quantity-table .quantity-input input { min-width: 90px; width: 110px; }
.quantity-table .quantity-input span { color: var(--muted); font-size: 10px; }
.quantity-table tr.quantity-quote { background: #f7fbf8; }
.quantity-table tr.is-hidden { display: none; }
.quantity-table tr.quantity-unknown { background: #fffaf0; }
.quantity-table .item-note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-height: 32px;
}
.quantity-table .item-note-row [data-estimate-comment] {
  box-sizing: border-box;
  width: 220px;
  min-width: 160px;
  min-height: 32px;
  height: 32px;
  max-height: 32px;
  padding: 5px 8px;
  line-height: 1.3;
  resize: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  field-sizing: fixed;
}
.quantity-table .char-count {
  flex-shrink: 0;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 32px;
  text-align: right;
  white-space: nowrap;
}
.quantity-table .evidence-src {
  flex: 0 1 200px;
  min-width: 120px;
  max-width: 240px;
  margin: 0;
  line-height: 32px;
}
.quantity-table .item-files {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}
.quantity-table .item-file { flex-wrap: nowrap; align-items: center; }
.quantity-table .item-file-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.quantity-table .item-file .btn {
  min-height: 24px;
  padding: 2px 6px;
  font-size: 11px;
  white-space: nowrap;
}
.quantity-table .item-file-hint { display: none; }
.quantity-table .item-file-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-deep);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.quantity-table .item-file-add:hover {
  background: var(--accent-soft);
  border-color: #a8c8bc;
}
.quantity-table .item-file-add-ico {
  width: 16px;
  height: 16px;
  display: block;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E") center / contain no-repeat;
}

.drop-zone.quote-zone { background: #fcf8f1; border-color: #d8c39a; }
.drop-zone.quote-zone.drag { background: var(--gold-soft); border-color: var(--gold); }
.file-type {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  vertical-align: middle;
}
.document-file-name {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-deep, #1a5c4a);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-item .btn-sm { flex: 0 0 auto; }
.quantity-filters { display: flex; gap: 8px; margin: 0 0 10px; }
.quantity-filters .btn.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.item-files { display: grid; gap: 4px; margin-top: 8px; }
.item-file { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-file-name {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-deep);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}
.item-file-add { justify-self: start; }
.item-file-hint { font-size: 10px; }

.flash { margin-bottom: 14px; padding: 11px 14px; border-radius: 8px; font-size: 12px; }
.flash.ok { color: var(--ok); background: var(--accent-soft); border: 1px solid #bad9ce; }
.flash.err { color: var(--danger); background: var(--danger-soft); border: 1px solid #efc7c3; }
.empty { padding: 42px 20px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 3px; color: var(--ink-soft); }
.permission-note { padding: 9px 11px; color: var(--warn); background: var(--gold-soft); border-radius: 7px; font-size: 11px; }

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(14, 33, 27, .55);
  backdrop-filter: blur(6px);
}
.busy-card {
  display: grid;
  justify-items: center;
  width: min(420px, calc(100vw - 32px));
  padding: 32px 28px 26px;
  background:
    radial-gradient(180px 80px at 50% 0%, #eef7f3 0%, transparent 70%),
    #fff;
  border: 1px solid rgba(23, 107, 83, .12);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(16, 40, 32, .22);
  text-align: center;
}
.busy-ring-wrap {
  position: relative;
  width: 118px;
  height: 118px;
  margin-bottom: 16px;
}
.busy-ring {
  width: 118px;
  height: 118px;
  transform: rotate(-90deg);
}
.busy-ring-track, .busy-ring-bar {
  fill: none;
  stroke-width: 8;
}
.busy-ring-track { stroke: #e4eee9; }
.busy-ring-bar {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset .28s ease;
  filter: drop-shadow(0 0 6px rgba(23, 107, 83, .25));
}
.busy-ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.busy-pct {
  display: flex;
  align-items: baseline;
  gap: 1px;
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1;
}
.busy-pct small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.busy-check {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
}
.busy-card strong {
  font-size: 16px;
  letter-spacing: .01em;
}
.busy-step {
  min-height: 1.45em;
  max-width: 100%;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.busy-bar {
  width: 100%;
  height: 6px;
  margin-top: 16px;
  overflow: hidden;
  background: #e8efeb;
  border-radius: 999px;
}
.busy-bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #1a7a5e, #2aa37d);
  border-radius: inherit;
  transition: width .28s ease;
}
.busy-meta {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  min-height: 1.2em;
}
.busy-card small { margin-top: 14px; color: var(--muted); font-size: 11px; }
.busy-card.is-indeterminate .busy-ring { animation: spin 1s linear infinite; }
.busy-card.is-indeterminate .busy-ring-bar {
  stroke-dasharray: 72 255;
  stroke-dashoffset: 0;
  transition: none;
}
.busy-card.is-indeterminate .busy-pct,
.busy-card.is-indeterminate .busy-step,
.busy-card.is-indeterminate .busy-meta { display: none; }
.busy-card.is-complete .busy-ring-bar { stroke: var(--accent); }
@keyframes spin { to { transform: rotate(270deg); } }

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 16px; }
  .brand-copy, .role-box { display: none; }
  .nav { flex-direction: row; margin-top: 14px; overflow-x: auto; }
  .nav-item { min-width: max-content; }
  .main { padding: 20px 15px 36px; }
  .topbar { flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .steps { grid-template-columns: 1fr 1fr; }
}
