/* Documents: overview table, waiting strip, new-document and detail screens. */

.promise {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 28px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-alt); color: var(--ink-2); font-size: 0.93rem;
}
.promise span { display: inline-flex; align-items: center; gap: 8px; }
.promise svg { color: var(--accent); }
.promise .sep { width: 1px; height: 16px; background: var(--border-strong); }
.promise a { margin-left: auto; font-weight: 500; text-decoration: none; }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 1.07rem; }
.section-title span { font-weight: 400; color: var(--ink-muted); font-size: 0.93rem; }
.attention { margin-bottom: 32px; }
.waiting-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wait {
  display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .2s;
}
.wait:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.wait h3 { font-size: 1rem; font-weight: 500; line-height: 1.35; }
.wait h3 a { color: var(--ink); text-decoration: none; }
.wait h3 a:hover { text-decoration: underline; }
.who { display: flex; flex-direction: column; gap: 6px; }
.who div { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.93rem; color: var(--ink-2); }
.who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who em { font-style: normal; margin-left: auto; padding-left: 8px; color: var(--ink-muted); font-size: 0.86rem; white-space: nowrap; }
.dot { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.dot.ok { background: var(--accent); color: var(--accent-ink); }
.dot.ok svg { width: 11px; height: 11px; stroke-width: 2.4; }
.dot.viewed { border: 1.5px dashed var(--warn); background: var(--warn-bg); }
.dot.pending { border: 1.5px solid var(--border-strong); }
.wait footer {
  display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--border); font-size: 0.86rem; color: var(--ink-muted);
}
.wait footer button { margin-left: auto; }

.list-bar { display: flex; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 2px; overflow-x: auto; min-width: 0; flex: 1; scrollbar-width: none; }
.tab {
  height: 40px; padding: 0 12px; margin-bottom: -1px; min-height: 0;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; box-shadow: none;
  background: none; color: var(--ink-muted); font-weight: 500;
}
.tab:hover { background: none; color: var(--ink); border-color: transparent; border-bottom-color: var(--border-strong); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab .num { font: 0.86rem var(--font-mono); color: var(--ink-muted); }
.search {
  display: flex; align-items: center; gap: 8px; width: 280px; margin-bottom: 6px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); color: var(--ink-muted);
}
.search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search input { border: 0; background: none; box-shadow: none; padding: 0; min-height: 34px; font-size: 0.93rem; }
.search input:focus { box-shadow: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.doc-table { margin: 0; }
.doc-table td { padding: 14px 12px; }
.doc-table tbody tr { cursor: pointer; }
.doc-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-name > div { min-width: 0; }
.doc-name a { display: block; color: var(--ink); font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-name a:hover { text-decoration: underline; }
.doc-name span { display: block; font-size: 0.86rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file {
  position: relative; width: 32px; height: 40px; flex: none; display: grid; place-items: end center; padding-bottom: 4px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font: 500 8px var(--font-mono); color: var(--ink-muted);
}
.file::before {
  content: ""; position: absolute; left: 6px; right: 6px; top: 8px; height: 14px;
  background: repeating-linear-gradient(var(--border-strong) 0 1px, transparent 1px 4px);
}
.progress { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.avs { display: flex; }
.avs .av { width: 24px; height: 24px; font-size: 10px; box-shadow: 0 0 0 2px var(--surface); }
.avs .av + .av { margin-left: -3px; }
.av.signed { background: var(--accent); color: var(--accent-ink); }
.av.pending, .av.viewed { background: var(--surface); color: var(--ink-muted); box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1.5px var(--border-strong); }
.av.viewed { box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1.5px var(--warn); color: var(--warn); }
.av.more { background: var(--surface-muted); color: var(--ink-2); }
.meter { flex: 1; max-width: 72px; height: 4px; border-radius: 4px; background: var(--surface-muted); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.progress .num { font: 0.86rem var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.activity { color: var(--ink-muted); font-size: 0.93rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-table th:first-child, .doc-table td.c-name { width: 100%; max-width: 0; }
.row-act { display: flex; justify-content: flex-end; gap: 2px; }
.table-foot { display: flex; justify-content: space-between; gap: 12px; padding: 14px 12px; color: var(--ink-muted); font-size: 0.93rem; }

.empty {
  display: grid; justify-items: start; gap: 6px; padding: 40px 28px; margin-top: 20px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-alt);
}
.empty h2 { margin: 0; }
.empty p { margin: 0 0 10px; color: var(--ink-muted); max-width: 52ch; }

/* --- New document ---------------------------------------------------------- */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; border: 0; padding: 0; }
.choice label {
  display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
}
.choice label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input { margin-top: 2px; }
.choice b { display: block; color: var(--ink); }
.choice span { display: block; font-weight: 400; color: var(--ink-muted); font-size: 0.93rem; }
.drop {
  position: relative; display: grid; place-items: center; gap: 4px; padding: 28px 16px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-alt);
}
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { color: var(--ink); }
.form-card { padding: 24px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--surface); box-shadow: var(--shadow-sm); }

/* --- Detail ---------------------------------------------------------------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.panel-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel-card + .panel-card { margin-top: 16px; }
.panel-card > header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-card > header h2 { margin: 0; font-size: 1rem; }
.panel-card > header .btn, .panel-card > header button { margin-left: auto; }
.panel-body { padding: 14px 16px; }
.signer-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.signer-row:last-child { border-bottom: 0; }
.signer-row .meta { min-width: 0; flex: 1; }
.signer-row .meta b { display: block; font-weight: 500; }
.signer-row .meta span { display: block; color: var(--ink-muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signer-row .state { font-size: 0.86rem; color: var(--ink-muted); text-align: right; white-space: nowrap; }
.doc-preview {
  max-height: 560px; overflow: auto; padding: 32px 36px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: #1c1c1c; font: 0.93rem/1.65 Georgia, "Times New Roman", serif; white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.timeline { list-style: none; margin: 0; padding: 14px 16px 16px; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; font-size: 0.93rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; width: 8px; height: 8px; margin: 6px 0 0 3px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 6.5px; top: 18px; bottom: 2px; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.ok::before { background: var(--accent); }
.timeline small { display: block; overflow-wrap: anywhere; }
.timeline small { margin-top: 2px; }
.timeline small .mono { font-size: 0.82rem; }
.link-copy { display: flex; gap: 6px; margin-top: 6px; }
.link-copy input { min-height: 30px; font: 0.82rem var(--font-mono); background: var(--surface-alt); }
.trust { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--ink-muted); }
.trust span { display: flex; align-items: center; gap: 8px; }
.trust svg { color: var(--accent); width: 14px; height: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.field-grid label { margin-bottom: 8px; }

@media (max-width: 1180px) {
  .waiting-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .waiting-list .wait:nth-child(3) { display: none; }
  .col-activity { display: none; }
  .search { width: 220px; }
  .detail { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
}
@media (max-width: 900px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .promise .sep { display: none; }
  .promise a { margin-left: 0; }
  .waiting-list { grid-template-columns: minmax(0, 1fr); }
  .waiting-list .wait:nth-child(3) { display: flex; }
  .list-bar { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .search { width: auto; margin: 0; }
  .doc-table thead { display: none; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; }
  .doc-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .doc-table td { padding: 0; border: 0; }
  .doc-table td.c-name { grid-column: 1 / -1; max-width: none; width: auto; }
  .doc-table td.c-act { display: none; }
  .doc-table td.c-prog { justify-self: end; }
  .doc-table tbody tr:hover { background: transparent; }
  .progress { min-width: 0; }
  .choice { grid-template-columns: minmax(0, 1fr); }
  .form-card { padding: 16px; }
  .doc-preview { padding: 20px; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
