:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #1b1b1b;
  --accent: #c26e2c;
  --accent-dark: #8d4b1c;
  --muted: #6b6b6b;
  --border: #e2dcd4;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

code,
pre,
kbd,
samp,
svg text {
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #f7f3ed 0%, #efe7dd 55%, #e9dfd3 100%);
  color: var(--ink);
}

aside.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 180px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 16px;
  z-index: 40;
  box-shadow: 8px 0 18px rgba(27, 27, 27, 0.08);
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 4px;
}

.sidebar-subnav {
  display: grid;
  gap: 6px;
  margin-left: 10px;
  padding-left: 8px;
  border-left: 2px solid #e6ded4;
}

.sidebar-subnav button .nav-icon {
  background: #efe7dd;
}

.sidebar-subnav button {
  font-size: 14px;
  padding: 6px 8px 6px 12px;
  opacity: 0.9;
  background: #efe7dd;
  color: var(--ink);
}

.sidebar-subnav button:hover {
  opacity: 1;
  background: #f3ece4;
}

.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 14px;
  padding: 8px 10px;
}

.sidebar-nav .nav-arrow {
  margin-left: auto;
  font-size: 14px;
  opacity: 0.7;
}

.sidebar-nav .has-children[aria-expanded="true"] .nav-arrow {
  transform: rotate(90deg);
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #f1e9df;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  flex-shrink: 0;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 30;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

@media (min-width: 721px) {
  body:not(.logged-out) main {
    width: calc(100% - 180px);
    max-width: none;
    margin-left: 180px;
    margin-right: 0;
    transition: width 0.2s ease, margin-left 0.2s ease;
  }

  body:not(.logged-out).sidebar-collapsed main {
    width: 100%;
    margin-left: 0;
  }
}

.page-header {
  position: relative;
  width: 100%;
}

.app-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 72px;
  position: relative;
  width: 100%;
  text-align: center;
}

.app-brand-logo {
  width: 104px;
  height: 56px;
  object-fit: contain;
  position: absolute;
  top: 50%;
  right: calc(50% + 94px);
  transform: translateY(-50%);
}

.app-brand-text {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 0;
}

.app-brand h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.app-company-name {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

body.logged-out main {
  margin-left: auto;
  margin-right: auto;
  display: grid;
  justify-items: center;
}

header {
  margin-bottom: 8px;
  margin-top: 0;
}

header h1 {
  font-size: 18px;
  margin-bottom: 4px;
}

header p {
  margin: 0;
  color: var(--muted);
}

.page-header .header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 72px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-spacer {
  flex: 1 1 auto;
}

.title-center {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.user-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  position: absolute;
  right: 0;
  top: 0;
}

.user-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.user-actions {
  position: relative;
}

.avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f1e9df;
}

.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar-btn svg,
.avatar-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.avatar-btn.has-image img {
  display: block;
}

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.avatar-btn.has-image .avatar-fallback {
  display: none;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(27, 27, 27, 0.12);
  display: grid;
  gap: 6px;
  padding: 10px;
  min-width: 160px;
  z-index: 50;
}

.user-dropdown button {
  width: 100%;
  text-align: left;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f1e9df;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

#logout-btn {
  border: none;
  background: transparent;
  width: 62px;
  height: 62px;
}

#logout-btn svg {
  width: 54px;
  height: 44px;
  margin-top: 16px;
}

#login-card {
  max-width: 300px;
  width: min(300px, calc(100vw - 32px));
  margin: 0 auto 24px;
  padding: 14px;
}

#vendor-table,
#vendor-query-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#vendor-query-table {
  width: max-content;
  min-width: max-content;
  table-layout: fixed;
}

#vendor-query-table th { width: 15em; min-width: 15em; }
#vendor-query-table th[data-col="name"] { width: calc(15em + 36px); min-width: calc(15em + 36px); }
#vendor-query-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
#vendor-query-table tr.is-expanded td { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.vendor-query-name-cell { display: flex; min-width: 0; align-items: flex-start; gap: 6px; }
.vendor-query-detail-button { min-width: 0; flex: 1 1 auto; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.vendor-query-detail-button:hover, .vendor-query-detail-button:focus-visible { color: #0b5cab; text-decoration: underline; outline: none; }
#vendor-query-table tr.is-expanded .vendor-query-detail-button { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.vendor-query-row-expand { flex: 0 0 26px; width: 26px; min-height: 26px; padding: 0; border: 0; border-radius: 4px; background: #26322d; color: #fff; font-size: 12px; line-height: 1; }

#vendor-table th,
#vendor-table td,
#vendor-query-table th,
#vendor-query-table td,
#vendor-contact-table th,
#vendor-contact-table td,
#report-list-table th,
#report-list-table td,
#photo-report-list-table th,
#photo-report-list-table td,
#photo-preset-table th,
#photo-preset-table td {
  max-width: 40em;
  font-size: 14px;
  padding: 3px 5px;
  line-height: 1.05;
  vertical-align: top;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Vendor query rows stay one line until the user explicitly expands them. */
#vendor-query-table tbody tr:not(.is-expanded) td {
  height: 32px;
  max-height: 32px;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

#vendor-query-table tbody tr:not(.is-expanded) .vendor-query-name-cell {
  height: 26px;
  align-items: center;
  overflow: hidden;
}

#vendor-query-table tbody tr:not(.is-expanded) .vendor-query-detail-button {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#vendor-query-table tbody tr.is-expanded td {
  height: auto;
  max-height: none;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
}

#vendor-query-table tbody tr.vendor-query-detail-trigger { cursor: pointer; }
#vendor-query-table tbody tr.vendor-query-detail-trigger .vendor-query-row-expand { cursor: pointer; }

.vendor-query-column-toolbar {
  margin-bottom: 8px;
}

.vendor-query-column-picker {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.vendor-query-column-picker summary {
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.vendor-query-column-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
}

.vendor-query-column-modal-content {
  width: min(680px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  overflow: auto;
}

#vendor-query-column-modal:not(.hidden) {
  align-items: flex-start;
  justify-content: flex-start;
  padding: 72px 0 0 96px;
}

#vendor-query-column-modal .modal-header {
  cursor: move;
}

.vendor-query-column-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.vendor-query-column-options .checkbox-field {
  white-space: normal;
  align-items: flex-start;
}

.vendor-query-column-options .vendor-query-column-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
}

.vendor-query-column-label {
  min-width: 0;
}

.vendor-query-column-drag-handle {
  color: #6b7280;
  cursor: grab;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}

.vendor-query-column-item.is-hidden .vendor-query-column-drag-handle {
  color: #c5c5c5;
  cursor: not-allowed;
}

.vendor-query-column-item.dragging {
  opacity: 0.45;
}

.vendor-query-column-item.drag-over {
  background: #fff7e9;
  border-color: #d77d2b;
  box-shadow: 0 0 0 2px rgba(215, 125, 43, 0.18);
}

.vendor-query-detail-modal-content {
  --vendor-query-detail-content-size: 14px;
  position: fixed;
  inset: 8px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: var(--vendor-query-detail-content-size);
}

.modal.maximized .vendor-query-detail-modal-content {
  inset: 8px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
}

.vendor-query-detail-body {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.vendor-query-detail-section {
  display: grid;
  gap: 6px;
}

.vendor-query-detail-section h4 {
  margin: 0;
  font-size: 15px;
}

.vendor-query-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px 8px;
}

.vendor-query-detail-field {
  display: grid;
  grid-template-columns: minmax(10em, max-content) minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  min-width: 0;
  min-height: 28px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.vendor-query-detail-field.is-long {
  align-items: start;
}

.vendor-query-detail-field.is-full {
  grid-column: 1 / -1;
}

.vendor-query-detail-label {
  color: var(--muted);
  font-size: var(--vendor-query-detail-content-size);
  margin-bottom: 0;
  white-space: nowrap;
}

.vendor-query-detail-value {
  min-width: 0;
  font-size: var(--vendor-query-detail-content-size);
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  line-height: 1.3;
}

.vendor-query-detail-field.is-long .vendor-query-detail-value {
  white-space: pre-wrap;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.vendor-query-detail-textarea {
  width: 100%;
  min-height: 2.8em;
  max-height: 9.5em;
  resize: vertical;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.vendor-query-detail-source-note {
  margin: 0;
}

.vendor-query-detail-field.is-empty .vendor-query-detail-value {
  color: var(--muted);
}

.vendor-query-detail-table {
  width: max-content;
  min-width: 100%;
}

#vendor-query-detail-modal .vendor-query-detail-table td,
#vendor-query-detail-modal .vendor-query-detail-table th {
  max-width: none;
  font-size: var(--vendor-query-detail-content-size) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-template-slot {
  margin-bottom: 12px;
}

.modal-template-slot .template-panel-block {
  margin-bottom: 0;
}

.modal-template-slot .inline-list-template-panel {
  margin-top: 4px;
}

.modal-template-slot .inline-list-template-panel .report-template-header {
  display: none;
}

.modal-template-slot .inline-list-template-panel .template-export-block,
.modal-template-slot .inline-list-template-panel .template-export-preview {
  display: none;
}

#login-card form,
#login-card label {
  width: 100%;
}

#login-card h2 {
  font-size: 16px;
}

#login-card label {
  font-size: 14px;
  gap: 4px;
}

#login-card input {
  padding: 6px 8px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

#login-card .actions {
  gap: 8px;
  display: flex;
  justify-content: space-between;
}

#login-card button {
  padding: 6px 10px;
  font-size: 14px;
  width: auto;
  box-sizing: border-box;
}

#login-card .actions button {
  flex: 0 0 45%;
  max-width: 45%;
}

#login-card .actions {
  grid-template-columns: 1fr;
}

#section-home h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

.announcement-panel {
  max-width: 520px;
  margin-right: auto;
}

.announcement-panel .list,
.announcement-panel .grid-2 label,
.announcement-item {
  font-size: 14px;
}

#announcement-list {
  max-height: 520px;
  overflow-y: auto;
  min-height: 240px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffdf9;
  scrollbar-gutter: stable;
}

.header-shortcuts {
  position: fixed;
  top: 16px;
  left: 16px;
  right: auto;
  display: flex;
  gap: 8px;
  z-index: 45;
  align-items: center;
}

body:not(.sidebar-collapsed) .header-shortcuts {
  left: 16px;
}

.sidebar-toggle {
  position: static;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f1e9df;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(27, 27, 27, 0.08);
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.logged-out .sidebar-toggle {
  display: none;
}

body.logged-out .header-shortcuts {
  display: none;
}

.home-btn {
  width: 60px;
  height: 60px;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  border: none;
  box-shadow: none;
}

.home-btn svg {
  width: 100%;
  height: 100%;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 16px 30px rgba(27, 27, 27, 0.08);
}

h2 {
  margin-top: 0;
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

#section-admin .list > h3,
#section-admin .admin-permission-block > .grid-2 > .section-subtitle {
  font-size: 16px;
  line-height: 1.2;
  margin: 0 0 8px;
}

#section-admin .admin-permission-block {
  background: #fffdf7;
  border: 1px solid #ead8bd;
  border-radius: 10px;
  padding: 20px 14px 12px;
  margin: 16px 0;
}

#section-admin .admin-permission-block .actions {
  margin-bottom: 0;
}

form {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 4px;
  font-size: 14px;
}

input,
textarea,
select,
option {
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  max-width: 100%;
  box-sizing: border-box;
}

textarea.auto-grow-textarea {
  overflow-y: hidden;
}

button {
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 12px;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, background 0.15s ease;
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
}

input::file-selector-button {
  font-family: inherit;
  font-size: 14px;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button.ghost {
  background: #ddd;
  color: #222;
}

.field-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 5100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.35);
}

.confirm-dialog {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.confirm-dialog h3,
.confirm-dialog p {
  margin: 0;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.actions button {
  min-width: 80px;
}

.list {
  margin-top: 12px;
}

.list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

#project-vendor-contact-choices {
  display: grid;
  gap: 6px;
}

.project-vendor-contact-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.project-vendor-contact-heading h4 {
  margin: 0;
}

.project-vendor-contact-heading .icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.project-vendor-primary-actions {
  align-items: center;
  flex-wrap: wrap;
}

#project-vendor-create-modal .modal-content {
  width: min(1080px, 94vw);
}

.project-vendor-column-picker {
  min-width: 180px;
}

.project-vendor-column-picker #project-vendor-column-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

#project-vendor-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

#project-vendor-table th,
#project-vendor-table td {
  min-width: 60px;
  max-width: 40em;
}

.list li {
  background: #f9f6f1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.labor-block {
  background: #f9f6f1;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
}

.labor-row {
  display: grid;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.dynamic-labor-row {
  grid-template-columns: repeat(3, minmax(220px, 1fr)) auto;
}

.dynamic-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dynamic-field.full-row {
  grid-column: 1 / -2;
}

.dynamic-field-label {
  font-size: 14px;
  color: #475569;
}

.row-remove-btn {
  align-self: end;
}

.operation-field {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.operation-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.operation-field > input[type="text"] {
  width: 110px;
}

.labor-row input,
.labor-row select,
.labor-row textarea {
  font-size: 14px;
}

.labor-row button {
  background: #dddddd;
  color: #333;
}

.field-settings-list {
  display: grid;
  gap: 8px;
}

.storage-provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.storage-provider-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border, #dfd5c8);
  border-radius: 14px;
  background: #fffdf9;
}

.storage-provider-card.is-disabled {
  background: #f1f1f1;
  color: #8a8a8a;
  opacity: 0.8;
}

.storage-provider-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.storage-provider-toggle input {
  width: auto;
}

@media (max-width: 760px) {
  .storage-provider-grid {
    grid-template-columns: 1fr;
  }
}

.field-setting-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 120px auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #e7ddcf;
  border-radius: 10px;
  background: #fcfaf6;
}

.compact-inline {
  gap: 4px;
}

.field-setting-row .field-label {
  min-width: 0;
}

.compact-list {
  padding: 10px 12px;
  border: 1px solid #e7ddcf;
  border-radius: 12px;
  background: #fffdf9;
}

.project-org-form,
#project-org-form {
  display: grid;
  gap: 10px;
}

.project-org-inline {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(140px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: end;
}

.level-code-field select,
.level-code-field .searchable-select {
  width: 100%;
  min-width: 180px;
}

#project-org-table td,
#project-org-table th {
  white-space: nowrap;
}

.org-chart {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid #eadfce;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(250,247,241,0.96) 0%, rgba(255,255,255,0.96) 100%),
    repeating-linear-gradient(90deg, rgba(217,119,6,0.04) 0 1px, transparent 1px 24px);
}

.org-sections {
  display: grid;
  gap: 14px;
}

.org-section {
  position: relative;
  padding-left: 18px;
}

.org-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: #cbd5e1;
}

.org-section-1::before { background: #8b5cf6; }
.org-section-1-1::before { background: #0f766e; }
.org-section-1-2::before { background: #2563eb; }
.org-section-1-3::before { background: #9333ea; }
.org-section-2::before { background: #334155; }
.org-section-3::before { background: #475569; }
.org-section-4::before { background: #64748b; }

.org-section-label {
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.org-root {
  margin: 0 auto;
  padding: 10px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(180, 83, 9, 0.18);
  font-size: 15px;
}

.org-warning {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 14px;
}

.org-groups {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 10px;
  align-items: start;
  justify-content: start;
  position: relative;
  padding-top: 10px;
  overflow-x: auto;
}

.org-groups::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #cbd5e1 8%, #cbd5e1 92%, transparent 100%);
}

.org-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 9px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.org-group-title {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  color: #fff;
  border-radius: 9px;
  padding: 7px 9px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

.org-level-code {
  margin-left: 6px;
  font-size: 14px;
  opacity: 0.9;
}

.org-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.org-member {
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 7px 9px;
  display: grid;
  gap: 2px;
  background: #f8fafc;
  position: relative;
  min-width: 0;
}

.org-member::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d97706 0%, #f59e0b 100%);
}

.org-member strong {
  font-size: 14px;
  padding-left: 10px;
}

.org-member span {
  font-size: 14px;
  color: #475569;
  padding-left: 10px;
  line-height: 1.25;
  word-break: break-word;
}

.project-org-textarea {
  min-height: calc(1.35em * 3 + 14px);
  max-height: calc(1.35em * 3 + 14px);
  resize: vertical;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.multiline-input {
  min-height: calc(1.35em * 3 + 14px);
  max-height: none;
  resize: vertical;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.vendor-long-textarea {
  max-height: none;
  resize: vertical;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.business-scope-list {
  display: grid;
  gap: 8px;
}

.business-scope-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
  gap: 6px;
  align-items: end;
  padding: 10px;
  border: 1px solid #eadfce;
  border-radius: 12px;
  background: #fffdf9;
}

.business-scope-row input,
.business-scope-row select {
  width: 100%;
  min-width: 0;
}

.business-scope-row .remove-btn {
  min-width: 56px;
}

.hidden-file-input {
  display: none;
}

.org-chart-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.company-logo-preview {
  max-width: 220px;
  max-height: 90px;
  object-fit: contain;
  display: block;
  padding: 8px;
  border: 1px solid #e7ddcf;
  border-radius: 12px;
  background: #fff;
}

.dynamic-labor-row {
  background: #fffdf9;
  border: 1px solid #eadfce;
  border-radius: 12px;
  padding: 10px;
}

.dynamic-labor-row .searchable-select,
.dynamic-labor-row .operation-field,
.dynamic-labor-row input,
.dynamic-labor-row select {
  max-width: 100%;
}

.dynamic-labor-row .operation-field {
  padding: 6px 8px;
  border: 1px solid #e8e0d5;
  border-radius: 10px;
  background: #fff;
}

.dynamic-labor-row .row-remove-btn {
  min-width: 56px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  background: #f9f6f1;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #fff6ee;
}

.upload-file-summary {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.contract-upload-section .title-row {
  align-items: center;
  gap: 8px;
}

.contract-upload-section .title-row h3 {
  margin-right: 4px;
}

.contract-upload-section #contract-inline-summary {
  margin: 4px 0 10px;
}

.project-order-editor {
  --project-order-money-width: 16ch;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft, #faf8f4);
  font-size: 14px;
}

.project-order-editor label,
.project-order-editor input,
.project-order-editor select,
.project-order-editor textarea,
.project-order-editor button,
.project-order-editor .searchable-input {
  font-size: 14px;
}

.project-order-row {
  display: grid;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.project-order-primary-row {
  grid-template-columns:
    minmax(150px, 0.85fr)
    minmax(320px, 1.8fr)
    minmax(11ch, 13ch)
    minmax(var(--project-order-money-width), 0.75fr)
    minmax(8ch, 9ch)
    minmax(var(--project-order-money-width), 0.75fr)
    minmax(var(--project-order-money-width), 0.75fr);
}

.project-order-secondary-row {
  grid-template-columns: minmax(15ch, 18ch) minmax(15ch, 18ch) minmax(220px, 0.8fr) minmax(320px, 1.4fr);
  grid-template-areas:
    "order-date completion warranty payment"
    "remark remark remark payment";
  align-items: start;
}

.project-order-row label,
.project-order-row input,
.project-order-row select,
.project-order-row textarea {
  min-width: 0;
}

.project-order-currency-field select {
  width: 100%;
  min-width: 14ch;
}

.project-order-currency-field .searchable-select,
.project-status-field .searchable-select {
  width: 100%;
  min-width: 0;
}

.project-order-tax-rate-field input {
  width: 100%;
  min-width: 8ch;
}

.project-order-field-money input {
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.project-order-date-field {
  grid-area: order-date;
}

.project-order-completion-field {
  grid-area: completion;
}

.project-order-warranty-field {
  grid-area: warranty;
}

.project-order-payment-field {
  grid-area: payment;
}

.project-order-remark-field {
  grid-area: remark;
}

.project-order-field-money input[readonly] {
  background: #f6f1e9;
}

.project-order-remark-field textarea {
  min-height: 70px;
  resize: vertical;
}

.project-order-attachment-row {
  display: grid;
  grid-template-columns: minmax(260px, 0.6fr) minmax(420px, 1.4fr);
  gap: 12px;
  align-items: start;
  padding-top: 12px;
  margin-bottom: 12px;
  border-top: 1px solid var(--border);
}

.project-order-file-picker input[type="file"] {
  width: 100%;
  font-size: 14px;
}

.project-order-file-picker input[type="file"]::file-selector-button {
  font-size: 14px;
}

.project-order-attachment-list {
  display: grid;
  gap: 8px;
}

@media (max-width: 1200px) {
  .project-order-editor {
    --project-order-money-width: 16ch;
  }

  .project-order-primary-row {
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  }

  .project-order-secondary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "order-date completion"
      "remark remark"
      "warranty payment";
  }

  .project-order-attachment-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .project-order-secondary-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "order-date"
      "remark"
      "completion"
      "warranty"
      "payment";
  }
}

.project-order-attachment-list:empty {
  display: none;
}

.project-order-attachment-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(11ch, 14ch) minmax(160px, 0.8fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.project-order-attachment-item input,
.project-order-attachment-item select,
.project-order-attachment-item button {
  font-size: 14px;
}

.project-order-attachment-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-order-attachment-other[hidden] {
  display: none;
}

.project-order-existing-title {
  grid-column: 1 / -1;
  margin: 2px 0;
  font-size: 14px;
  font-weight: 700;
}

#contract-existing-attachments {
  grid-column: 1 / -1;
}

.contract-attachment-links {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.contract-attachment-link {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

#contract-table {
  min-width: 1880px;
}

#contract-list-modal.maximized .modal-content {
  display: flex;
  flex-direction: column;
}

#contract-list-modal.maximized .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#contract-table th,
#contract-table td {
  font-size: 14px;
}

.table-link-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  justify-content: flex-start;
  font: inherit;
  cursor: pointer;
}

.table-link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.project-form-actions {
  margin-top: 12px;
}

.filter-action-row {
  display: flex;
  align-items: end;
  gap: 10px;
  justify-content: space-between;
}

.filter-field {
  flex: 1 1 0;
  min-width: 0;
}

.filter-field input {
  width: 100%;
}

.inline-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.project-permission-toolbar {
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.project-permission-helper {
  margin: 0 0 0 auto;
  flex: 1 1 320px;
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
}

.upload-file-summary strong {
  color: var(--text);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

#project-table {
  min-width: 1820px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
  position: relative;
  line-height: 1.2;
  font-size: 14px;
}

#project-table th,
#project-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table th {
  background: #f7f1ea;
  font-weight: 600;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #f7f1ea;
  box-shadow: inset 0 -1px 0 var(--border);
}

.table thead tr + tr th {
  top: 31px;
  z-index: 5;
}

.table a {
  color: var(--accent-dark);
  text-decoration: none;
}

.table a:hover {
  text-decoration: underline;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.sort-icon {
  margin-left: 6px;
  font-size: 14px;
  color: #6f6153;
  display: inline-block;
  min-width: 12px;
  text-align: center;
  letter-spacing: 1px;
}

.table th.sortable.active .sort-icon {
  color: var(--accent-dark);
  font-weight: 700;
}

.table th.sortable:hover .sort-icon {
  color: var(--accent-dark);
}

.table .col-check {
  width: 40px;
}

.table .col-code {
  width: 120px;
  white-space: nowrap;
}

.table .col-category {
  width: 90px;
  white-space: nowrap;
}

.table .col-name {
  width: 30ch;
}

.table .col-owner {
  width: 30ch;
}

.table .col-tax {
  width: 110px;
  white-space: nowrap;
}

.table .col-taxaddr,
.table .col-site {
  min-width: 200px;
}

.table .col-manager {
  width: 120px;
  white-space: nowrap;
}

.table .col-status {
  width: 90px;
  text-align: center;
}

.table td.col-status {
  text-align: center;
}

.table .col-vname {
  width: 26ch;
}

.table .col-vshort {
  width: 18ch;
}

.table .col-vowner {
  width: 14ch;
}

.table .col-vphone {
  width: 16ch;
}

.table .col-vaddr {
  min-width: 24ch;
}

.table .col-vmail {
  width: 22ch;
}

.table .col-vweb {
  width: 22ch;
}

.table .col-vcontact {
  min-width: 26ch;
  white-space: normal;
  word-break: break-word;
}

.table .col-vremark {
  min-width: 18ch;
}

.table .col-vscope {
  min-width: 22ch;
}

.table .col-vproduct {
  min-width: 22ch;
}

.table .col-actions {
  width: 170px;
  text-align: center;
}

.table td.col-actions {
  text-align: center;
}

#vendor-table .col-check {
  width: 2.5ch;
  min-width: 2.5ch;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
}

#vendor-table .col-actions {
  width: calc(6em + 0.5ch);
  min-width: calc(6em + 0.5ch);
  padding-left: 0.25ch;
  padding-right: 0.25ch;
}

#vendor-table td.col-actions .small-btn {
  margin-left: 0;
  margin-right: 0;
}

#project-table td.col-actions {
  white-space: normal;
}

#project-table td.col-actions .small-btn {
  margin: 2px;
}

.table.compact th,
.table.compact td {
  padding: 4px 5px;
  line-height: 1.05;
  font-size: 14px;
}

.vendor-query-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}

#section-vendor-query.maximized {
  position: fixed;
  inset: 8px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
}

#section-vendor-query.maximized .vendor-query-wrap {
  flex: 1 1 auto;
  max-height: none;
}

.table.compact th {
  font-weight: 600;
}

.table.compact th .sort-icon {
  font-size: 14px;
}

.small-btn {
  padding: 4px 8px;
  font-size: 14px;
  border-radius: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(700px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

#project-vendor-modal .modal-content {
  width: min(900px, 94vw);
}

#project-workflow-modal .modal-content {
  position: fixed;
  inset: 12px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  transform: none;
}

#project-workflow-modal .workflow-editor {
  flex: 1 1 auto;
  overflow: auto;
}

#section-workflow-management #company-workflow-editor {
  display: grid;
  gap: 16px;
}

#section-workflow-management #company-workflow-editor > .workflow-card {
  margin: 0;
  padding: 14px;
  border: 1px solid #d8cabc;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(50 38 24 / 8%);
}

#staff-list-modal .modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  resize: both;
  overflow: auto;
  min-width: 520px;
  min-height: 260px;
  max-width: 96vw;
  max-height: 92vh;
}

.list-window-modal .modal-content,
#project-list-modal .modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(1100px, 94vw);
  max-width: 96vw;
  max-height: 88vh;
  transform: translate(-50%, -50%);
}

.list-window-modal.maximized .modal-content,
#project-list-modal.maximized .modal-content,
#report-field-settings-modal.maximized .modal-content {
  inset: 12px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform: none;
}

.list-window-modal.maximized .table-wrap,
#project-list-modal.maximized .table-wrap {
  max-height: calc(100vh - 190px);
}

#report-field-settings-modal.maximized .modal-content {
  display: flex;
  flex-direction: column;
}

#report-field-settings-modal.maximized form {
  overflow: auto;
  min-height: 0;
}

#staff-list-modal .modal-header,
.list-window-modal .modal-header {
  cursor: move;
  user-select: none;
  margin-bottom: 6px;
}

#project-list-modal .modal-header {
  cursor: move;
  user-select: none;
}

.list-window-modal.maximized .modal-header,
#project-list-modal.maximized .modal-header {
  cursor: default;
}

#account-list-modal .modal-content {
  width: min(1180px, 94vw);
  height: min(640px, 78vh);
  min-width: min(680px, 90vw);
  min-height: 320px;
  resize: both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#account-list-modal .search-row {
  flex: 0 0 auto;
}

#account-list-modal .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#account-list-modal.maximized .modal-content {
  resize: none;
}

#staff-list-modal .search-row {
  margin-bottom: 4px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.window-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.window-control-btn {
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #334155;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.window-control-btn:hover {
  background: #e2e8f0;
}

.window-control-btn.close:hover {
  background: #dc2626;
  color: #fff;
}

.contact-view-list {
  display: grid;
  gap: 8px;
}

.contact-view-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.4;
  background: #faf7f2;
}

.contact-view-item strong {
  display: inline-block;
  margin-right: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-dark);
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.link-btn:hover {
  text-decoration: underline;
}

.helper-text {
  margin: 6px 0 10px;
  font-size: 14px;
  color: #7b6b5c;
}

.helper-text.warning {
  color: #b3562a;
}

.account-field-hint-slot {
  display: block;
  height: 30px;
  padding-top: 2px;
  box-sizing: border-box;
  overflow: hidden;
}

.account-field-hint-slot .helper-text {
  display: block;
  max-width: 100%;
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  white-space: normal;
  max-height: 28px;
  overflow: hidden;
}

.helper-text.ok {
  color: #2f6b3b;
}

.password-field-hint {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.4;
  color: #6f6257;
}

.project-field-hint {
  display: block;
  margin: 4px 0 0;
  font-size: 14px;
}

.mapping-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #faf6f1;
  display: grid;
  gap: 8px;
}

.mapping-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mapping-rows {
  display: grid;
  gap: 6px;
}

.mapping-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  align-items: start;
}

.mapping-row.unmapped {
  background: #fff2e9;
  border: 1px dashed #d28a63;
  border-radius: 8px;
  padding: 6px;
}

.mapping-right {
  display: grid;
  gap: 6px;
  align-content: start;
}

.mapping-preview {
  font-size: 14px;
  color: #7b6b5c;
  min-height: 16px;
  line-height: 1.4;
  white-space: normal;
}

.mapping-action-note {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #efe4d8;
  color: #6f5b49;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.mapping-action-note.is-custom {
  background: #fff0dc;
  color: #9a612e;
}

.mapping-action-note.is-empty {
  background: #f4ece5;
  color: #8e7c6f;
}

.org-mapping-panel {
  margin-top: 8px;
}

.mapping-row-header {
  font-size: 14px;
  color: #6f6153;
  font-weight: 600;
}

.mapping-col-title {
  padding: 0 2px;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 720px) {
  .mapping-row {
    grid-template-columns: 1fr;
  }
  .mapping-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-only.hidden {
  display: none;
}

.announcement-item {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
}

.announcement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.announcement-title {
  font-weight: 600;
  text-align: left;
}

.announcement-title.link-button {
  text-decoration: none;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #3c2e25;
  text-align: left;
  justify-content: flex-start;
}

.announcement-title.link-button:hover,
.announcement-title.link-button:active {
  background: transparent;
  transform: none;
}

.announcement-title-static {
  color: #3c2e25;
}

.announcement-admin-row {
  display: grid;
  grid-template-columns: 90px 120px 1fr 120px 70px 90px 70px;
  gap: 6px;
  align-items: center;
  font-size: 14px;
}

.announcement-editor-row {
  display: grid;
  grid-template-columns: 130px 140px 140px 220px 90px 140px;
  gap: 6px;
  align-items: end;
  font-size: 14px;
}

.announcement-subject-row,
.announcement-content {
  margin-top: 6px;
}

.announcement-editor-row input,
.announcement-editor-row select {
  width: 100%;
}

.announcement-category-settings-content {
  width: min(560px, calc(100vw - 32px));
}

.announcement-category-option-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.announcement-category-option-table-wrap {
  max-height: min(420px, 55vh);
  overflow-y: auto;
}

#announcement-category-option-list td:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 150px;
}

.announcement-subject-row input,
.announcement-content textarea {
  width: 100%;
}

.announcement-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.4;
  color: #5b4a3d;
  margin-top: 4px;
  padding-left: 2px;
}

.announcement-file-row {
  margin-top: 6px;
}

.announcement-file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.announcement-file-list,
.announcement-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
}

.announcement-file-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.announcement-meta .has-detail {
  color: #2f6f3e;
  border-color: #bfd8c4;
  background: #eef7f0;
}

.announcement-meta .no-detail {
  color: #8a6a4b;
}

.announcement-file-remove {
  min-width: auto;
  padding: 0 6px;
  height: 24px;
}

#announcement-list-modal .modal-content {
  width: min(1120px, 96vw);
  max-height: 88vh;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  resize: both;
  overflow: hidden;
  min-width: 760px;
  min-height: 320px;
}

#announcement-list-modal .table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(88vh - 140px);
  border: 1px solid var(--border);
  border-radius: 10px;
}

#announcement-list-modal .modal-header {
  cursor: move;
}

#announcement-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#announcement-table th,
#announcement-table td {
  white-space: nowrap;
  font-size: 14px;
  padding: 3px 5px;
  line-height: 1.05;
}

.announcement-editor-row .inline {
  margin-top: 0;
}

.status-field select {
  max-width: 140px;
}

.short-field input {
  width: 20ch;
  max-width: 100%;
}

.owner-field input {
  width: 10ch;
  max-width: 100%;
}

.vendor-inline {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 20ch 10ch;
  gap: 12px;
  align-items: end;
}

.vendor-procurement-form {
  display: grid;
  gap: 12px;
}

#section-home {
  display: grid;
  grid-template-columns: minmax(560px, 760px) minmax(300px, 360px);
  gap: 24px;
  align-items: start;
  justify-content: center;
  width: min(100%, 1180px);
  margin-inline: auto;
}

#section-home > h2 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

#section-home > .announcement-panel {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.home-alert-grid {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 0;
}

.home-alert-heading {
  margin: 0 0 2px;
  padding-left: 2px;
  font-size: 16px;
  line-height: 1.2;
  color: #0f3f56;
}

.home-alert-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  justify-items: start;
  text-align: left;
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e1ea;
  border-left: 6px solid #0891b2;
  color: #0f3f56;
  padding: 8px 10px;
  min-height: 54px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.home-alert-card strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 22px;
  line-height: 1;
  color: #7c2d12;
}

.home-alert-label {
  font-weight: 700;
  line-height: 1.25;
}

.home-alert-card .muted {
  font-size: 14px;
  line-height: 1.35;
  color: #475569;
}

#home-report-intake-projects,
#home-report-approval-card .muted {
  display: block;
  max-height: 58px;
  overflow: auto;
}

#home-vendor-intake-card {
  border-left-color: #f97316;
}

#home-report-intake-card {
  border-left-color: #0ea5e9;
}

#home-report-approval-card {
  border-left-color: #16a34a;
}

.vendor-intake-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(420px, 1.5fr);
  gap: 12px;
  align-items: start;
}

.vendor-intake-list,
.vendor-intake-detail {
  max-height: clamp(420px, 66vh, 760px);
  overflow: auto;
}

.vendor-intake-card {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.vendor-intake-card.active {
  border-color: #2563eb;
  background: #eff6ff;
}

.vendor-intake-fields {
  display: grid;
  gap: 14px;
}

.vendor-intake-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vendor-intake-fieldset.vendor-intake-company-v1 {
  grid-template-columns: minmax(280px, 2fr) minmax(150px, 1fr) minmax(140px, .8fr);
}

.vendor-intake-fieldset.vendor-intake-company-v2 {
  grid-template-columns: minmax(260px, 2fr) minmax(150px, 1fr) minmax(140px, .8fr) minmax(140px, .8fr);
}

.vendor-intake-fieldset.vendor-intake-payment-v1 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.vendor-intake-fieldset.vendor-intake-payment-v2 {
  grid-template-columns: minmax(160px, 1.25fr) minmax(90px, .45fr) minmax(160px, 1.25fr) minmax(90px, .45fr) minmax(160px, 1.25fr) minmax(160px, 1.25fr);
}

.vendor-intake-fieldset.vendor-intake-cheque-v2 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.vendor-intake-cheque-v2 .vendor-intake-same-address {
  grid-column: span 1;
}

.vendor-intake-cheque-v2 .vendor-intake-cheque-address {
  grid-column: span 3;
}

.vendor-intake-fieldset.vendor-intake-contact-layout {
  grid-template-columns: minmax(140px, 1fr) minmax(150px, 1fr) minmax(90px, .55fr) minmax(140px, .9fr) minmax(240px, 1.7fr);
}

.vendor-intake-fieldset.vendor-intake-submitter-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .vendor-intake-fieldset.vendor-intake-company-v1,
  .vendor-intake-fieldset.vendor-intake-company-v2,
  .vendor-intake-fieldset.vendor-intake-payment-v1,
  .vendor-intake-fieldset.vendor-intake-payment-v2,
  .vendor-intake-fieldset.vendor-intake-cheque-v2,
  .vendor-intake-fieldset.vendor-intake-contact-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vendor-intake-cheque-v2 .vendor-intake-cheque-address {
    grid-column: span 1;
  }
}

.vendor-intake-fieldset legend {
  grid-column: 1 / -1;
  font-weight: 700;
  color: #111827;
  margin-bottom: 2px;
}

.vendor-intake-field {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.vendor-intake-field.full {
  grid-column: 1 / -1;
}

.vendor-intake-field span {
  display: block;
  color: #64748b;
  font-size: 14px;
  margin-bottom: 4px;
}

.vendor-procurement-row {
  display: grid;
  gap: 12px;
  align-items: end;
  min-width: 0;
}

.vendor-procurement-row-3 {
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(160px, 1fr));
}

.vendor-contact-line {
  grid-template-columns: minmax(18ch, 20ch) minmax(18ch, 20ch) minmax(260px, 1.4fr) minmax(220px, 1.2fr);
}

.vendor-intake-public-link-row {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: #f4f7f2;
}

.vendor-intake-public-link-row a {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.vendor-intake-public-link-row .helper-text {
  margin: 0;
  color: #28733f;
  font-weight: 700;
}

.vendor-intake-email-routing-status {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.vendor-intake-email-routing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.vendor-intake-email-routing-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.vendor-intake-email-routing-row[data-status="verified"] strong {
  color: var(--success, #246b3b);
}

.vendor-intake-email-routing-row[data-status="pending"] strong,
.vendor-intake-email-routing-status.warning {
  color: var(--warning-text, #8a4b08);
}

.vendor-contact-line .field-address {
  min-width: 0;
}

.vendor-contact-line .field-website {
  min-width: 0;
}

.vendor-payment-line {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.vendor-procurement-row-top {
  grid-template-columns: minmax(280px, 1fr) minmax(140px, 14ch) minmax(140px, 14ch) minmax(132px, 12ch) minmax(132px, 12ch);
}

.vendor-intake-url-settings {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 10px 14px;
  margin-bottom: 8px;
}

.vendor-intake-url-settings .actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

@media (max-width: 760px) {
  .vendor-intake-url-settings {
    grid-template-columns: 1fr;
  }
}

#vendor-capital-amount {
  width: 12ch;
}

.vendor-procurement-row-meta {
  grid-template-columns: minmax(132px, 160px) minmax(140px, 180px) minmax(160px, 1fr);
}

.vendor-card-upload-field {
  display: grid;
  gap: 8px;
}

.vendor-card-upload-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.vendor-card-upload-actions input[type="file"] {
  min-width: min(100%, 320px);
  max-width: 100%;
}

.vendor-card-status {
  display: grid;
  gap: 6px;
}

.vendor-card-preview-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}

.vendor-card-preview-card {
  display: grid;
  align-content: start;
  gap: 6px;
  width: min(100%, 320px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.vendor-card-preview-media {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.58 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f7f7;
}

.vendor-card-preview-image,
.vendor-card-preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.vendor-card-preview-image {
  object-fit: contain;
  cursor: pointer;
}

.vendor-card-preview-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.vendor-card-preview-delete {
  justify-self: start;
}

.vendor-card-preview-error {
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.vendor-procurement-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vendor-procurement-row-qualification {
  grid-template-columns: max-content 12ch minmax(190px, 220px) minmax(240px, 1fr);
  column-gap: 2ch;
}

.vendor-qualified-toggle > span {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 8px;
}

.vendor-qualified-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

#vendor-supplier-code {
  width: 12ch;
}

#vendor-evaluation-note {
  min-height: 42px;
  resize: vertical;
}

.qualified-vendor-modal-content {
  width: min(96vw, 1600px);
}

#qualified-vendor-modal.maximized .qualified-vendor-modal-content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 24px);
  overflow: hidden;
}

#qualified-vendor-modal.maximized .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.qualified-roster-template-bar,
.qualified-assessment-template-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(190px, auto) auto auto minmax(160px, auto);
  gap: 10px;
  align-items: end;
  margin: 8px 0;
}

.qualified-roster-template-bar .file-button,
.qualified-assessment-template-bar .file-button {
  margin: 0;
}

.qualified-roster-template-bar .file-button input,
.qualified-assessment-template-bar .file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.qualified-vendor-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.qualified-vendor-table th,
.qualified-vendor-table td {
  min-width: 60px;
}

.qualified-vendor-table th .resize-handle {
  border-right: 2px solid rgba(112, 92, 72, 0.35);
}

.qualified-vendor-table td:nth-child(5) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-overflow: clip;
  vertical-align: top;
}

.qualified-vendor-table td:nth-child(9) {
  padding-top: 2px;
  padding-bottom: 2px;
  vertical-align: middle;
}

.qualified-vendor-table select {
  width: 100%;
  min-width: 110px;
  min-height: 30px;
  height: 30px;
  padding: 3px 28px 3px 8px;
  line-height: 1.2;
}

.qualified-roster-guidance {
  display: grid;
  gap: 2px;
  margin: 4px 0 8px;
}

.qualified-roster-guidance .helper-text {
  margin: 0;
  line-height: 1.35;
}

.qualified-roster-placeholders {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  margin-top: 6px;
  padding: 8px 10px;
}

.qualified-roster-placeholders summary {
  cursor: pointer;
  font-weight: 700;
}

.placeholder-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 4px 18px;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
}

.placeholder-row {
  display: grid;
  grid-template-columns: minmax(9em, max-content) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  min-width: 0;
}

.placeholder-row code {
  color: var(--accent);
  font-size: 1rem;
  white-space: nowrap;
}

.placeholder-row span {
  min-width: 0;
  color: var(--muted);
}

.qualified-vendor-search-row {
  display: grid;
  grid-template-columns: minmax(320px, 720px) auto;
  align-items: end;
  gap: 12px;
  margin: 10px 0;
}

.qualified-vendor-search-row label {
  min-width: 0;
}

.qualified-vendor-search-row input {
  width: 100%;
}

.qualified-vendor-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.qualified-vendor-search-actions button {
  width: auto;
  max-width: 100%;
  white-space: nowrap;
}

.qualified-vendor-search-status {
  grid-column: 1 / -1;
  margin: -4px 0 0;
}

.qualified-vendor-selection {
  width: 4.5rem;
  text-align: center;
}

.qualified-vendor-selection input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.qualified-vendor-file-type {
  flex: 0 0 auto;
  font-weight: 600;
  white-space: nowrap;
}

.qualified-vendor-file-link {
  overflow-wrap: anywhere;
}

.qualified-vendor-file-remove {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.qualified-vendor-file {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.qualified-vendor-empty {
  padding: 28px 12px;
  text-align: center;
}

.vendor-procurement-form .field-10ch {
  min-width: 0;
}

.vendor-procurement-form .field-8ch {
  min-width: 0;
}

.vendor-procurement-form .field-wide {
  grid-column: span 1;
}

.vendor-procurement-form .field-short {
  max-width: 180px;
}

.vendor-procurement-form .field-full {
  grid-column: 1 / -1;
}

.vendor-procurement-form label,
.vendor-procurement-form input,
.vendor-procurement-form textarea,
.vendor-procurement-form select {
  min-width: 0;
}

.vendor-detail-row {
  display: grid;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.vendor-detail-row-brand {
  grid-template-columns: minmax(160px, 1.25fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(120px, 140px) auto;
}

.vendor-detail-row-contact {
  grid-template-columns: minmax(10ch, 1fr) minmax(8ch, 0.8fr) minmax(14ch, 1fr) minmax(6ch, 0.5fr) minmax(140px, 1fr) minmax(180px, 1.2fr) minmax(120px, 1fr) auto;
}

.vendor-detail-header {
  display: grid;
  gap: 8px;
  margin: 0 0 4px;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}

#vendor-brand-rows .vendor-detail-header {
  grid-template-columns: minmax(160px, 1.25fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(120px, 140px);
}

#vendor-contact-simple-rows .vendor-detail-header {
  grid-template-columns: minmax(10ch, 1fr) minmax(8ch, 0.8fr) minmax(14ch, 1fr) minmax(6ch, 0.5fr) minmax(140px, 1fr) minmax(180px, 1.2fr) minmax(120px, 1fr);
}

.vendor-detail-row input,
.vendor-detail-row select,
.vendor-detail-table input,
.vendor-detail-table select {
  width: 100%;
}

.vendor-detail-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e6ded1;
  border-radius: 8px;
  background: #fffdfa;
}

.vendor-detail-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}

.vendor-detail-table-brand {
  min-width: 760px;
}

.vendor-detail-table-contact th:nth-child(5),
.vendor-detail-table-contact td:nth-child(5) {
  width: 72px;
}

.vendor-detail-table-contact th:nth-child(7),
.vendor-detail-table-contact td:nth-child(7) {
  width: 220px;
}

.vendor-detail-table th,
.vendor-detail-table td {
  padding: 8px;
  border-bottom: 1px solid #eadfce;
  vertical-align: middle;
  text-align: left;
}

.vendor-detail-table th {
  background: #f4ede2;
  color: #3d2f1f;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.vendor-detail-table td {
  color: #1f2933;
  font-size: 14px;
  word-break: break-word;
}

.vendor-detail-table .vendor-detail-select-col {
  width: 42px;
  text-align: center;
}

.vendor-detail-table .vendor-detail-row-check {
  width: 16px;
  height: 16px;
  margin: 0 auto;
}

.vendor-detail-edit-link {
  font-size: 14px;
  line-height: 1.45;
}

.vendor-detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.vendor-detail-table .vendor-detail-editor,
.vendor-detail-table .vendor-detail-editor-brand,
.vendor-detail-table .vendor-detail-editor-contact {
  display: table-row;
  margin-bottom: 0;
}

.vendor-detail-table .staff-structured-actions {
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.vendor-detail-inline-actions {
  margin-top: 6px;
}

.vendor-detail-inline-actions .small-btn {
  padding: 4px 8px;
  min-height: 28px;
}

.vendor-detail-actions {
  justify-content: flex-start;
  width: 100%;
  overflow: visible;
}

.vendor-detail-actions button {
  max-width: 100%;
  white-space: normal;
}

.vendor-detail-editor {
  display: grid;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.vendor-detail-editor-brand {
  grid-template-columns: minmax(160px, 1.25fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(120px, 140px);
}

.vendor-detail-editor-contact {
  grid-template-columns: minmax(10ch, 1fr) minmax(8ch, 0.8fr) minmax(14ch, 1fr) minmax(6ch, 0.5fr) minmax(140px, 1fr) minmax(180px, 1.2fr) minmax(120px, 1fr);
}

.vendor-contact-modal-actions {
  margin-bottom: 8px;
}

.vendor-contact-edit-table input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  font-size: 14px;
}

.vendor-contact-edit-table th[data-col="contact_ext"] {
  width: 72px;
  min-width: 72px;
}

.vendor-contact-edit-table th[data-col="contact_mail"] {
  width: 220px;
  min-width: 220px;
}

.vendor-detail-item-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.vendor-detail-item {
  align-items: center;
}

@media (max-width: 1180px) {
  .vendor-procurement-row-top {
    grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(132px, 1fr));
  }
}

.qualified-template-modal-content {
  width: min(980px, 94vw);
  max-height: min(760px, 88vh);
}

.qualified-vendor-assessment-overdue {
  color: #9b1c1c;
  font-weight: 700;
  margin-bottom: 6px;
}

.qualified-vendor-assessment-current {
  color: #176b35;
  margin-bottom: 6px;
}

.vendor-assessment-modal-content {
  width: min(760px, calc(100vw - 24px));
}

.vendor-assessment-list-modal-content {
  width: min(1580px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
}

#vendor-assessment-completed-modal.maximized .vendor-assessment-list-modal-content {
  position: fixed;
  inset: 12px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  overflow: hidden;
}

.vendor-assessment-list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(64vh, 720px);
  overflow: auto;
}

#vendor-assessment-completed-modal.maximized .vendor-assessment-list-wrap {
  max-height: none;
}

.vendor-assessment-completed-search-row {
  flex: 0 0 auto;
}

.vendor-assessment-completed-search-row label,
.vendor-assessment-completed-search-row input {
  width: min(100%, 420px);
}

.vendor-assessment-list-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.vendor-assessment-list-table th,
.vendor-assessment-list-table td {
  font-size: 14px;
  padding: 4px 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.qualified-vendor-table th,
.qualified-vendor-table td {
  font-size: 14px;
}

.vendor-assessment-list-table input,
.vendor-assessment-list-table textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.vendor-assessment-list-table input[type="number"] {
  min-width: 0;
}

.vendor-assessment-list-table textarea {
  min-height: 0;
  resize: vertical;
  white-space: pre-wrap;
}

.vendor-assessment-list-table td:nth-child(7) {
  white-space: normal;
}

.vendor-assessment-total,
.vendor-assessment-grade {
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .vendor-procurement-row-top,
  .vendor-procurement-row-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.contact-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.contact-row input {
  padding: 6px 8px;
  font-size: 14px;
}

.contact-row .remove-btn {
  grid-column: 1 / -1;
  justify-self: flex-start;
}

.report-meta {
  align-items: end;
}

.report-meta-inline {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 220px) minmax(110px, 140px);
  column-gap: 12px;
  row-gap: 12px;
  align-items: end;
}

.report-meta-inline label {
  min-width: 0;
}

.report-meta-inline input,
.report-meta-inline select,
.report-meta-inline .searchable {
  width: 100%;
  min-width: 0;
}

.report-date input {
  width: 100%;
  max-width: 100%;
}

.report-meta-inline .report-date {
  min-width: 0;
}

.report-meta-inline .weather-field {
  min-width: 0;
  margin-left: 0;
}

.report-meta-inline .weather-field input,
.report-meta-inline .weather-field select {
  width: 100%;
  max-width: 100%;
}

.report-workflow-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
}

.status-badge.report-draft {
  background: #f1e9df;
  color: #6b4f32;
}

.status-badge.report-submitted {
  background: #e8f0fc;
  color: #2456a6;
}

.status-badge.report-approved {
  background: #e7f3e9;
  color: #2f5f3a;
}

.status-badge.report-rejected {
  background: #fce8e8;
  color: #a13b3b;
}

.date-clear-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 4px;
  align-items: center;
}

@media (max-width: 720px) {
  .report-meta-inline {
    grid-template-columns: 1fr;
  }

  .report-entry-editor {
    grid-template-columns: 1fr;
  }

  .inspection-draft-grid,
  .inspection-module-grid {
    grid-template-columns: 1fr;
  }

  .dynamic-labor-row,
  .field-setting-row {
    grid-template-columns: 1fr;
  }

  .project-org-inline {
    grid-template-columns: 1fr;
  }

  .dynamic-field.full-row {
    grid-column: auto;
  }

  #project-org-table td,
  #project-org-table th {
    white-space: normal;
  }
}

.announcement-admin-row input[type="text"],
.announcement-admin-row input[type="date"] {
  width: 100%;
}

.announcement-admin-row textarea {
  width: 100%;
  min-height: 60px;
}

.badge-muted {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efe7dd;
  font-size: 14px;
}

.table .col-contract {
  min-width: 180px;
}

.table th .resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
}

.table th.resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing-table-column {
  cursor: col-resize;
  user-select: none;
}

.table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table td .file-links {
  white-space: normal;
}

.file-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1e9df;
  color: var(--ink);
  font-size: 14px;
}

.status-badge.ok {
  background: #e7f3e9;
  color: #2f5f3a;
}

.status-badge.inactive {
  background: #fce8e8;
  color: #a13b3b;
}

.contact-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.contact-row input {
  padding: 6px 8px;
  font-size: 14px;
}

.contact-row .remove-btn {
  grid-column: 1 / -1;
  justify-self: flex-start;
  background: #dddddd;
  color: #333;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.inline {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.project-top-row {
  display: grid;
  grid-template-columns: minmax(12ch, 15ch) minmax(20ch, 1fr) minmax(16ch, 1fr) 190px minmax(16ch, 20ch);
  gap: 8px;
  align-items: end;
}

.project-owner-row {
  display: flex;
  gap: 4px;
  align-items: start;
}

.project-owner-row > label {
  min-width: 0;
  margin: 0;
}

.project-owner-row > label:first-child {
  flex: 0.75 1 0;
}

.project-owner-row > .project-tax-id-field {
  flex: 0 0 16ch;
  margin-right: -2px;
}

.project-owner-row > label:last-child {
  flex: 1 1 0;
}

.project-manager-row {
  display: grid;
  grid-template-columns: minmax(14ch, 18ch) minmax(14ch, 18ch) minmax(20ch, 1fr);
  gap: 8px;
  align-items: end;
}

.project-manager-row > label {
  min-width: 0;
  margin: 0;
}

.project-manager-row input,
.project-manager-row select,
.project-manager-row .searchable-select,
.project-manager-row .searchable-row,
.project-manager-row .searchable-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.project-owner-row input,
.project-owner-row .searchable-select,
.project-owner-row .searchable-row,
.project-owner-row .searchable-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.project-code-field,
.project-category-field,
.project-name-field,
.project-total-field,
.project-status-field {
  margin: 0;
  min-width: 0;
}

.project-code-field input,
.project-category-field select,
.project-name-field input,
.project-total-field input,
.project-status-field select,
.project-top-row .searchable-select,
.project-top-row .searchable-row,
.project-top-row .searchable-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.project-status-field select {
  width: 100%;
  max-width: none;
}

.project-total-field input {
  width: 190px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #f6f1e9;
}

.project-tax-id-field input {
  width: 16ch;
  max-width: 100%;
}

.full-span {
  grid-column: 1 / -1;
}

.section-subtitle {
  margin: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.account-core-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(110px, 0.7fr) minmax(220px, 1.4fr) minmax(220px, 1.3fr);
  gap: 8px;
  align-items: start;
}

.account-core-row > label {
  min-width: 0;
}

.account-core-row input,
.account-core-row select {
  width: 100%;
  min-width: 0;
}

.account-role-status-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.8fr);
  gap: 8px;
  align-items: end;
}

.account-role-status-row > label {
  min-width: 0;
}

.account-site-access {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin: 12px 0;
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdf9;
}

.feature-permission-system-tabs {
  margin: 8px 0 14px;
}

.account-site-access legend {
  padding: 0 6px;
  font-weight: 600;
}

.account-site-access label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.account-site-access input {
  width: auto;
}

.account-password-row {
  display: contents;
}

.account-password-box {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f6f0e8;
  min-width: 260px;
  height: 39px;
  box-sizing: border-box;
}

.account-password-field {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.account-password-field > span {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

#account-password {
  background: #ece7de;
  color: #6b6258;
  height: 27px;
}

#reset-account-password {
  white-space: nowrap;
  padding-inline: 10px;
}

.compact-grid {
  align-items: end;
}

.template-panel-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
  background: #fbf8f3;
}

.report-template-header {
  margin-bottom: 4px;
}

.vendor-template-panel > summary {
  cursor: pointer;
  display: list-item;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.vendor-template-panel:not([open]) {
  padding-block: 10px;
}

.vendor-template-panel[open] > summary {
  margin-bottom: 10px;
}

.vendor-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: end;
  max-width: 100%;
  overflow: hidden;
}

.vendor-template-row label {
  min-width: 0;
}

.vendor-template-row select {
  width: 100%;
}

.vendor-template-row .inline-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.vendor-template-row .file-inline {
  margin: 0;
  max-width: 100%;
  white-space: nowrap;
}

@media (max-width: 780px) {
  .vendor-template-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .vendor-template-row .inline-actions {
    justify-content: flex-start;
  }

  .vendor-template-row .inline-actions > button,
  .vendor-template-row .inline-actions > .file-inline {
    flex: 0 1 auto;
    max-width: 100%;
  }
}

.search-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 6px;
}

.search-row label {
  flex: 1 1 auto;
}

.search-row button {
  margin-bottom: 2px;
}

#vendor-search-clear {
  width: 48px;
  min-width: 48px;
  padding-inline: 0;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 2px;
  background: #fff;
}

.search-input-wrap {
  position: relative;
  min-width: 260px;
  width: 100%;
}

.search-input-wrap input {
  width: 100%;
  padding-right: 34px;
  box-sizing: border-box;
}

.search-clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  background: #ddd;
  color: #333;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.search-clear-btn:hover,
.search-clear-btn:active {
  transform: translateY(-50%);
}

#login-form .search-input-wrap {
  min-width: 0;
}

#login-form .search-clear-btn {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  margin: 0;
  border: 0;
  font-size: 18px;
  line-height: 1;
  right: 6px;
  background: #d9d9d9;
  transition: background 0.15s ease, color 0.15s ease;
}

#login-form .search-clear-btn:hover,
#login-form .search-clear-btn:active {
  transform: translateY(-50%);
  background: #cfcfcf;
}

.searchable-select {
  display: grid;
  gap: 6px;
  font-size: 14px;
  position: relative;
  min-width: 0;
}

#section-admin .title-row button {
  font-size: 14px;
}


.searchable-hidden-select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
}

.searchable-row {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.searchable-input {
  flex: 1 1 auto;
  min-width: 0;
}

.clear-btn,
.drop-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f1e9df;
  color: var(--ink);
  cursor: pointer;
}

.clear-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.searchable-select.no-clear .clear-btn {
  display: none;
}

.searchable-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 90;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  max-height: 220px;
  overflow: auto;
}

.searchable-list.open {
  display: block;
}

.searchable-item {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  text-align: left;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
}

.searchable-item:hover,
.searchable-item.active {
  background: #f1e9df;
}

.searchable-empty {
  padding: 6px 8px;
  color: var(--muted);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.staff-contact-row {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.staff-emergency-row {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.staff-family-editor {
  display: grid;
  min-width: 0;
}

.staff-family-editor > label {
  display: grid;
  gap: 6px;
}

.staff-skills-row label {
  display: grid;
  gap: 6px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
}

.staff-skills-row textarea {
  height: 42px;
  min-height: 42px;
  resize: vertical;
}

.staff-address-field {
  grid-column: span 2;
}

.staff-textarea-row {
  align-items: start;
}

.staff-structured-field {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  font-weight: 600;
}

.staff-structured-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  align-items: end;
}

.staff-structured-inputs label {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.staff-structured-inputs button {
  width: fit-content;
  min-width: max-content;
}

.staff-structured-action-group {
  display: flex;
  gap: 4px;
  align-items: end;
  justify-content: flex-start;
  justify-self: start;
  width: max-content;
  max-width: 100%;
}

.staff-structured-action-group button {
  flex: 0 0 auto;
}

#staff-media-grid .staff-structured-inputs {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
  margin-bottom: 8px;
  overflow: visible;
}

#staff-media-grid .staff-structured-inputs input {
  width: 100%;
  min-height: 38px;
}

.staff-work-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  align-items: end;
}

.staff-work-inputs label {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.staff-work-inputs label input,
.staff-work-inputs label textarea {
  width: 100%;
}

.staff-work-inputs label textarea {
  min-height: 78px;
  resize: vertical;
}

.staff-work-action-group {
  grid-column: 1 / -1;
}

.report-entry-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 8px;
  align-items: end;
  margin-bottom: 8px;
}

#labor-list,
#tomorrow-labor-list,
.integration-work-list {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.dynamic-labor-row,
.integration-work-row.integration-work-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  cursor: pointer;
}

.dynamic-labor-row:hover,
.dynamic-labor-row:focus-visible,
.integration-work-row.integration-work-summary:hover,
.integration-work-row.integration-work-summary:focus-visible {
  border-color: #c97a2b;
  background: #fff8ec;
  outline: none;
}

.integration-work-editor {
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.report-entry-editor .dynamic-field {
  min-width: 0;
}

.report-entry-editor .dynamic-field[data-key="vendor_name"],
.report-entry-editor .dynamic-field[data-key="trade_name"],
.report-entry-editor .dynamic-field[data-key="vendor_work_summary"] {
  grid-column: span 2;
}

.report-entry-editor .dynamic-field[data-key="worker_count"] input {
  width: 10ch;
  min-width: 10ch;
  max-width: 100%;
}

.report-entry-editor .dynamic-field[data-key="planned_time_text"] input {
  min-width: 12ch;
}

.report-entry-editor .dynamic-field[data-key="trade_name"] .searchable-select,
.report-entry-editor .dynamic-field[data-key="area_text"] .searchable-select,
.report-entry-editor .dynamic-field[data-key="trade_name"] input,
.report-entry-editor .dynamic-field[data-key="area_text"] input {
  min-width: 12ch;
}

.report-entry-editor .searchable-select,
.report-entry-editor .searchable-row,
.report-entry-editor .searchable-input,
.report-entry-editor .operation-field,
.report-entry-editor .operation-field > input[type="text"],
.trade-multi-field,
.trade-multi-field > input[type="text"] {
  min-width: 0;
  width: 100%;
}

.trade-multi-field {
  display: grid;
  gap: 6px;
}

.inspection-draft-grid {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(220px, 1fr) minmax(220px, 1.2fr);
  gap: 10px 8px;
  align-items: start;
}

.inspection-draft-grid .searchable-select,
.inspection-draft-grid .searchable-row,
.inspection-draft-grid .searchable-input,
.inspection-draft-grid input,
.inspection-draft-grid select,
.inspection-draft-grid textarea {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.inspection-draft-grid.module {
  margin-bottom: 8px;
}

.inspection-draft-grid .span-2 {
  grid-column: span 2;
}

.inspection-draft-grid .span-4 {
  grid-column: 1 / -1;
}

.inspection-module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.compact-actions {
  margin-top: 8px;
}

.inspection-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.inspection-file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e8e0d5;
  border-radius: 8px;
  background: #fff;
}

.report-setup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.labor-block > .report-setup-actions {
  display: none;
}

#labor-list,
#tomorrow-labor-list,
#management-labor-list {
  display: grid;
  gap: 6px;
  min-height: 42px;
  max-height: 420px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-vendor-group {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e4dbcf;
  border-radius: 10px;
  background: #fbf8f3;
}

.report-vendor-group-header {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.report-vendor-group-title {
  font-weight: 700;
}

.report-vendor-item-list {
  display: grid;
  gap: 6px;
}

.searchable-multi-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.searchable-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efe6da;
  font-size: 14px;
  line-height: 1.4;
}

.report-option-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.report-option-tabs .active {
  background: #d68a34;
  color: #fff;
  border-color: #d68a34;
}

.report-option-panel {
  display: grid;
  gap: 12px;
}

.option-group-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbf8f3;
}

.option-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.option-checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 10px;
}

.option-checkbox-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.report-summary-chart {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.report-summary-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 3fr) 64px;
  gap: 8px;
  align-items: center;
}

.report-summary-bar-track {
  height: 14px;
  border-radius: 999px;
  background: #efe8df;
  overflow: hidden;
}

.report-summary-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d68a34, #e9b05f);
}

.report-summary-toolbar > label {
  min-width: 0;
}

.report-row-fields-hidden {
  display: none;
}

.staff-work-project-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 6px;
  grid-column: 1 / -1;
}

.staff-work-project-list {
  grid-column: 1 / -1;
}

.staff-cert-uploaded-list {
  margin-top: 2px;
}

.staff-cert-uploaded-list h3 {
  font-size: 16px;
  margin: 0 0 6px;
}

#staff-cert-list,
.staff-cert-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}

.cert-card {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  width: fit-content;
  max-width: 220px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.cert-image-card {
  overflow: hidden;
}

.cert-card-overlay-btn {
  position: absolute;
  z-index: 2;
  min-height: 0;
  padding: 3px 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
}

.cert-card-rotate-btn {
  top: 10px;
  left: 10px;
}

.cert-card-delete-btn {
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  font-weight: 700;
}

.cert-card.is-cert-detail-edit-target {
  border: 3px solid #222;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 0 0 6px rgba(198, 102, 34, 0.45);
}

.cert-preview-img {
  display: block;
  width: min(100%, 180px);
  height: auto;
  max-width: 180px;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f7f7;
  cursor: pointer;
  transform-origin: center;
  transition: transform 0.15s ease;
}

.cert-card-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.cert-card-actions {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  align-items: center;
  width: max-content;
  max-width: 100%;
}

.cert-card-action-btn {
  min-height: 0;
  padding: 3px 5px;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.cert-file-box {
  min-height: 96px;
  border: 1px dashed var(--line);
  background: #f9f6f1;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  word-break: break-all;
}

#add-staff-work {
  grid-column: 1 / -1;
  justify-self: start;
}

.staff-structured-inputs input {
  min-width: 0;
}

.compact-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.compact-field input {
  width: 100%;
}

.staff-structured-list {
  display: grid;
  gap: 0;
  min-height: 42px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 400;
}

.staff-certificate-search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto auto auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.staff-certificate-editor {
  --staff-certificate-compact-width: calc(10ch + 32px);
  --staff-certificate-employee-width: calc(18ch + 76px);
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft, #faf8f4);
}

.staff-certificate-editor-grid {
  display: grid;
  grid-template-columns: minmax(var(--staff-certificate-employee-width), var(--staff-certificate-employee-width)) minmax(220px, 1.15fr) minmax(220px, 1.15fr) minmax(var(--staff-certificate-compact-width), var(--staff-certificate-compact-width)) minmax(var(--staff-certificate-compact-width), var(--staff-certificate-compact-width)) minmax(var(--staff-certificate-compact-width), var(--staff-certificate-compact-width)) minmax(220px, 0.8fr);
  gap: 10px;
  align-items: end;
  padding-bottom: 30px;
}

.staff-certificate-editor-grid label,
.staff-certificate-editor-grid input,
.staff-certificate-editor-grid select {
  min-width: 0;
}

.staff-certificate-editor-grid .searchable-select,
.staff-structured-inputs .searchable-select {
  width: 100%;
  min-width: 0;
}

.certificate-option-warning {
  display: block;
  color: #9a4f10;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
}

.certificate-option-warning-field {
  position: relative;
}

.certificate-option-warning-field > .certificate-option-warning {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1;
  width: max(220px, 100%);
}

#staff-media-grid .staff-structured-inputs {
  padding-bottom: 28px;
}

.certificate-option-summary-warning {
  display: block;
  margin: 2px 0 8px;
  color: #9a4f10;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.staff-certificate-option-table-wrap {
  max-height: min(55vh, 520px);
  overflow: auto;
}

.staff-certificate-option-table {
  width: 100%;
}

.staff-certificate-option-table th:last-child,
.staff-certificate-option-table td:last-child {
  width: 132px;
  white-space: nowrap;
}

.staff-certificate-option-table td:last-child {
  display: flex;
  gap: 6px;
}

.staff-certificate-field-10ch input,
.staff-certificate-field-10ch select {
  width: var(--staff-certificate-compact-width);
}

#staff-certificate-staff-field select,
#staff-certificate-staff-field .searchable-select,
#staff-certificate-staff-field .searchable-row,
#staff-certificate-staff-field .searchable-input {
  width: var(--staff-certificate-employee-width);
}

.staff-certificate-field-file input[type="file"] {
  width: min(100%, 28ch);
}

.staff-certificate-field-file .helper-text {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.staff-certificate-editor .actions {
  justify-content: flex-start;
}

.staff-certificate-editor .actions button {
  width: auto;
  min-width: max-content;
  flex: 0 0 auto;
}

.staff-certificate-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: 18px;
  align-items: start;
}

.staff-certificate-list-wrap {
  min-width: 0;
  overflow: auto;
}

#staff-certificate-table {
  width: max-content;
  min-width: 100%;
}

.staff-certificate-summary-panel {
  max-height: 620px;
  min-width: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.staff-certificate-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.staff-certificate-summary-header h3 {
  margin: 0;
}

#staff-certificate-summary-table {
  table-layout: fixed;
}

.staff-certificate-summary-modal-content {
  width: min(760px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 32px));
  min-width: 420px;
  min-height: 320px;
  max-width: none;
  max-height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
}

.staff-certificate-summary-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#staff-certificate-summary-modal-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.staff-certificate-summary-count {
  font-weight: 700;
}

.staff-certificate-summary-panel tr.active-summary-filter td {
  background: #fff7e9;
}

.staff-certificate-preview-modal-content {
  width: min(960px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
  min-width: 420px;
  min-height: 320px;
  max-width: none;
  max-height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
}

.staff-certificate-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.staff-certificate-preview-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  margin: 0 auto;
  object-fit: contain;
}

.staff-certificate-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.staff-certificate-preview-download {
  margin-top: 10px;
}

.staff-certificate-action-btn {
  min-height: 0;
  padding: 3px 5px;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.certificate-expired {
  color: #a33a2b;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .staff-certificate-search-row,
  .staff-certificate-dashboard {
    grid-template-columns: 1fr;
  }

  .staff-certificate-editor-grid {
    grid-template-columns: 1fr;
  }

  .staff-certificate-field-10ch input,
  .staff-certificate-field-10ch select,
  .staff-certificate-field-file input[type="file"] {
    width: 100%;
  }
}

.staff-structured-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9f6f1;
}

.staff-structured-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.staff-work-item {
  position: relative;
  display: block;
  padding-right: 86px;
  min-height: 40px;
}

.staff-work-item .staff-structured-text {
  white-space: pre-line;
}

.staff-work-item .staff-structured-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  gap: 3px;
  flex-wrap: nowrap;
}

#staff-cert-detail-list .staff-structured-actions {
  gap: 3px;
  flex-wrap: nowrap;
}

.staff-work-item .staff-structured-actions .small-btn,
#staff-family-list .staff-structured-actions .small-btn,
#staff-cert-detail-list .staff-structured-actions .small-btn {
  min-height: 0;
  padding: 3px 5px;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.staff-cert-detail-file-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

#staff-cert-detail-list .staff-structured-item.cert-card {
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: start;
}

#staff-cert-detail-list .cert-preview-img {
  width: 96px;
  height: auto;
  max-height: 120px;
}

.staff-structured-text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-line;
}

.staff-template-import {
  display: grid;
  gap: 6px;
  align-content: end;
}

.staff-profile-layout {
  display: grid;
  grid-template-columns: minmax(160px, 200px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  max-width: 100%;
  min-width: 0;
}

.staff-profile-fields {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.staff-profile-fields > *,
#section-staff label {
  min-width: 0;
}

#staff-media-grid {
  align-items: stretch;
  grid-template-columns: 1fr;
}

#section-staff input,
#section-staff textarea,
#section-staff select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.staff-prehire .inline-suffix {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.staff-prehire input {
  width: 60px;
  min-width: 60px;
  padding-left: 8px;
  padding-right: 8px;
}

.staff-birthday {
  width: 120px;
  min-width: 120px;
}

.staff-core-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  align-items: end;
}

.staff-core-row > label,
.staff-core-row > .staff-prehire {
  min-width: 0;
}

.staff-core-row label {
  align-content: start;
}

.staff-core-row input {
  width: 100%;
}

.staff-core-row .date-small {
  width: 100%;
  min-width: 0;
}

.staff-core-row #staff-hire-date {
  width: 100%;
  min-width: 0;
}

.staff-core-row .staff-prehire {
  align-self: end;
  width: 100%;
  min-width: 0;
}

.staff-core-row .staff-prehire span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.staff-core-row #staff-title {
  min-width: 0;
}

.staff-photo-card {
  display: grid;
  gap: 6px;
  align-content: start;
  grid-row: span 1;
  min-width: 0;
}

.staff-photo-card input[type="file"] {
  width: 100%;
  min-width: 0;
}

.staff-photo-preview {
  min-height: 0;
  display: grid;
  gap: 6px;
  align-content: start;
  margin: 0;
  overflow: visible;
}

.staff-photo-img {
  display: block;
  width: min(100%, 194px);
  height: auto;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  transform-origin: center;
  transition: transform 0.15s ease;
}

.image-rotation-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-size: 14px;
}

.image-rotation-toolbar {
  flex: 0 0 100%;
  width: 100%;
  grid-column: 1 / -1;
  margin: 0 0 4px;
}

.image-rotation-toolbar button {
  width: auto;
  min-width: max-content;
  flex: 0 0 auto;
  padding-inline: 8px;
}

.image-rotation-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.staff-profile-layout .staff-photo-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: nowrap;
}

#section-staff .checkbox-field input[type="checkbox"] {
  width: auto;
  min-width: auto;
  flex: 0 0 auto;
}

.staff-active-cell {
  text-align: center;
}

.staff-active-toggle {
  width: auto;
}

.staff-list-date-input {
  width: 110px;
  min-width: 110px;
  padding: 4px 6px;
}

.staff-ppt-picker .picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-selection {
  flex: 1 1 auto;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  line-height: 1.4;
}

.template-export-preview {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.65);
  white-space: pre-wrap;
}

.staff-ppt-template-row {
  margin-top: 6px;
}

.template-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-row select {
  flex: 1 1 auto;
}

.template-source-path {
  margin-top: 4px;
  font-size: 14px;
  word-break: break-all;
}

#staff-table {
  width: max-content;
  min-width: 2000px;
}

#staff-table th,
#staff-table td {
  max-width: 40em;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  vertical-align: top;
}

#staff-media-grid .staff-media-col {
  display: grid;
  grid-template-rows: auto;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

#staff-media-grid .media-label {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  margin: 0;
}

#section-staff .date-small {
  width: 104px;
  max-width: 104px;
}

#staff-media-grid input[type="file"] {
  min-height: 38px;
}

#staff-media-grid .list {
  margin-top: 6px;
  overflow: visible;
}

#staff-file-hint {
  min-height: 116px;
  display: block;
  overflow: visible;
}

.staff-profile-layout #staff-file-hint {
  min-height: 206px;
}

#staff-cert-list,
.staff-cert-list,
#staff-file-hint {
  font-size: 14px;
  line-height: 1.4;
}

#staff-media-grid .list h3 {
  font-size: 16px;
  line-height: 1.2;
  margin: 0 0 6px;
}

#staff-file-hint {
  margin: 0;
}

.staff-photo-preview-card {
  position: relative;
}

.staff-profile-layout .photo-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.staff-file-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.staff-file-name {
  display: inline-block;
  cursor: pointer;
  text-decoration: underline;
}

.cert-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cert-delete {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f1f1f1;
  cursor: pointer;
  font-size: 14px;
  line-height: 18px;
  padding: 0;
}

.cert-name {
  cursor: pointer;
  text-decoration: underline;
}

.photo-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-delete {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f1f1f1;
  cursor: pointer;
  font-size: 14px;
  line-height: 18px;
  padding: 0;
}

.editor-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.photo-quick {
  background: #f9f6f1;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.span-2 {
  grid-column: span 2;
}

#pptx-preview {
  width: 100%;
  height: 260px;
  border: 1px solid var(--border);
  background: #fff;
}

#layout-rules {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.layout-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f9f6f1;
}

.layout-item .row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.preset-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#preset-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

#photo-preset-table input,
#photo-preset-table textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#photo-preset-table td:first-child + td {
  display: grid;
  gap: 6px;
}

.preset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.preview-rect {
  fill: rgba(194, 110, 44, 0.08);
  stroke: #c26e2c;
  stroke-width: 0.05;
  cursor: move;
}

.preview-handle {
  fill: #c26e2c;
  cursor: nwse-resize;
}

.muted {
  color: var(--muted);
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.permission-note {
  margin: 8px 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff2cc;
  color: #7a5200;
  border: 1px solid #f0d58a;
  font-size: 14px;
}

.view-only button[data-view-disabled='1'] {
  opacity: 0.5;
  cursor: not-allowed;
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}

#feature-permission-table select {
  min-width: 88px;
}

#feature-permission-list-modal .modal-content {
  width: min(1120px, 96vw);
  max-height: 88vh;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  resize: both;
  overflow: hidden;
}

#channel-binding-modal .modal-content {
  width: min(1120px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

#channel-binding-modal .searchable-list {
  z-index: 2010;
}

.line-binding-review-panel {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf3;
}

.line-binding-review-panel h4 {
  margin: 0;
}

.line-binding-request-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.line-binding-request-list > li {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.channel-ai-data-sources {
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.channel-binding-editor-panel {
  padding: 14px;
  border: 1px solid #ead8bd;
  border-radius: 12px;
  background: #fff8e8;
}

.channel-binding-editor-panel > .compact-grid {
  margin-top: 0;
}

.channel-ai-data-source-list {
  display: grid;
  gap: 8px;
}

.channel-ai-data-source-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(170px, 1fr) minmax(220px, 1.4fr) minmax(128px, auto) auto;
  gap: 8px;
  align-items: center;
}

.channel-ai-data-source-summary {
  white-space: pre-line;
}

#feature-permission-list-modal .table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(88vh - 140px);
  border: 1px solid var(--border);
  border-radius: 10px;
}

#feature-permission-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

#feature-permission-table th,
#feature-permission-table td {
  white-space: nowrap;
  font-size: 14px;
  padding: 3px 5px;
  line-height: 1.05;
}

#feature-permission-table thead th {
  position: sticky;
  background: #f7f1ea;
  box-shadow: inset 0 -1px 0 var(--border);
  box-sizing: border-box;
}

#feature-permission-table thead tr:first-child th {
  top: 0;
  z-index: 7;
  height: 28px;
  min-height: 28px;
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1;
  vertical-align: middle;
}

#feature-permission-table thead tr:nth-child(2) th {
  top: 28px;
  z-index: 6;
  height: 28px;
  min-height: 28px;
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1;
  vertical-align: middle;
}

#feature-permission-table th:first-child,
#feature-permission-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}

#feature-permission-table th:first-child {
  background: #f7f1ea;
  z-index: 8;
}

.permission-group-header {
  text-align: center;
}

.permission-group-toggle {
  font-weight: 600;
  text-decoration: none;
}

#feature-permission-table .link-button {
  font-size: 14px;
  white-space: nowrap;
}

#feature-permission-table select {
  min-width: 74px;
  font-size: 14px;
  padding: 2px 18px 2px 6px;
  height: 28px;
}

.feature-permission-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 84px;
}

.feature-permission-cell select {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  text-align-last: left;
  padding-left: 6px;
}

#project-permission-table td,
#project-feature-permission-editor-table td {
  text-align: left !important;
}

#project-permission-table select,
#project-feature-permission-editor-table select {
  display: block;
  width: 100%;
  text-align: left !important;
  text-align-last: left !important;
  -moz-text-align-last: left !important;
  justify-content: flex-start;
  padding-left: 6px;
  direction: ltr;
}

#project-permission-table select option,
#project-feature-permission-editor-table select option {
  text-align: left !important;
  direction: ltr;
}

.feature-permission-cell select.scope-select:disabled {
  opacity: 0.55;
}

#feature-permission-list-modal .modal-header,
#feature-permission-list-modal .search-row {
  flex-shrink: 0;
}

#feature-permission-list-modal .feature-permission-list-note {
  flex-shrink: 0;
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.4;
}

#feature-permission-list-modal .modal-header {
  cursor: move;
}

#member-list-modal .modal-content {
  width: min(1120px, 96vw);
  max-height: 88vh;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  resize: both;
  overflow: hidden;
  min-width: 760px;
  min-height: 320px;
}

#member-list-modal .table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(88vh - 140px);
  border: 1px solid var(--border);
  border-radius: 10px;
}

#member-list-modal .modal-header,
#member-list-modal .search-row {
  flex-shrink: 0;
}

#member-list-modal .modal-header {
  cursor: move;
}

#project-permission-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

#project-permission-table thead th {
  position: sticky;
  background: #f7f1ea;
  box-shadow: inset 0 -1px 0 var(--border);
  box-sizing: border-box;
}

#project-permission-table thead tr:first-child th {
  top: 0;
  z-index: 7;
  height: 28px;
  min-height: 28px;
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1;
  vertical-align: middle;
}

#project-permission-table thead tr:nth-child(2) th {
  top: 28px;
  z-index: 6;
  height: 28px;
  min-height: 28px;
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1;
  vertical-align: middle;
}

#project-permission-table th,
#project-permission-table td {
  white-space: nowrap;
  font-size: 14px;
  padding: 3px 5px;
  line-height: 1.05;
}

#project-permission-table td:first-child,
#project-permission-table td:nth-child(2),
#project-permission-table td:nth-child(3),
#project-permission-table td:nth-child(4),
#project-permission-table th.sticky-col {
  position: sticky;
  background: #fff;
  z-index: 2;
}

#project-permission-table th.sticky-col:first-child,
#project-permission-table td:first-child {
  left: 0;
  width: 60px;
  min-width: 60px;
}

#project-permission-table th.sticky-col:nth-child(2),
#project-permission-table td:nth-child(2) {
  left: 60px;
  width: 96px;
  min-width: 96px;
}

#project-permission-table th.sticky-col:nth-child(3),
#project-permission-table td:nth-child(3) {
  left: 156px;
  width: 110px;
  min-width: 110px;
}

#project-permission-table th.sticky-col:nth-child(4),
#project-permission-table td:nth-child(4) {
  left: 266px;
  width: 100px;
  min-width: 100px;
}

#project-permission-table th.sticky-col {
  background: #f7f1ea;
  z-index: 8;
  top: 0;
  height: 56px;
  min-height: 56px;
  vertical-align: middle;
}

#project-permission-table th.project-group-header,
#project-permission-table th.project-sub-header {
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

#project-permission-table th.project-group-header {
  min-height: 28px;
}

#project-permission-table th.project-sub-header {
  min-height: 28px;
}

#project-permission-table .link-button {
  font-size: 14px;
  white-space: nowrap;
}

#project-permission-table .feature-permission-cell {
  min-width: 84px;
}

#feature-permission-preset-modal .modal-content,
#audit-list-modal .modal-content {
  width: min(960px, 94vw);
  max-height: 88vh;
  overflow: auto;
}

#audit-list-modal .audit-scope-note {
  margin-top: 0;
  font-size: 14px;
  line-height: 1.5;
}

#audit-list-modal .audit-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr) minmax(170px, 0.8fr) minmax(170px, 0.8fr);
  gap: 10px;
  align-items: end;
}

#audit-list-modal .audit-filter-grid > label {
  min-width: 0;
}

#audit-list-modal .audit-maintenance {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#audit-list-modal .audit-maintenance > label:first-child {
  min-width: 190px;
}

#audit-list-modal .audit-backup-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
}

#audit-list-modal .audit-backup-confirm input {
  width: 18px;
  height: 18px;
  margin: 0;
}

#audit-list-modal .audit-maintenance .helper-text {
  flex-basis: 100%;
  margin: 0;
  font-size: 14px;
}

#member-list-modal.admin-fullscreen-modal .modal-content,
#account-list-modal.admin-fullscreen-modal .modal-content,
#staff-list-modal.admin-fullscreen-modal .modal-content,
#feature-permission-list-modal.admin-fullscreen-modal .modal-content,
#feature-permission-preset-modal.admin-fullscreen-modal .modal-content,
#channel-binding-modal.admin-fullscreen-modal .modal-content,
#audit-list-modal.admin-fullscreen-modal .modal-content {
  position: fixed;
  inset: 12px;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  transform: none;
  resize: none;
  overflow: auto;
}

#member-list-modal.admin-fullscreen-modal .modal-content,
#account-list-modal.admin-fullscreen-modal .modal-content,
#staff-list-modal.admin-fullscreen-modal .modal-content,
#feature-permission-list-modal.admin-fullscreen-modal .modal-content,
#feature-permission-preset-modal.admin-fullscreen-modal .modal-content,
#audit-list-modal.admin-fullscreen-modal .modal-content {
  display: flex;
  flex-direction: column;
}

#member-list-modal.admin-fullscreen-modal .table-wrap,
#account-list-modal.admin-fullscreen-modal .table-wrap,
#staff-list-modal.admin-fullscreen-modal .table-wrap,
#feature-permission-list-modal.admin-fullscreen-modal .table-wrap,
#feature-permission-preset-modal.admin-fullscreen-modal .table-wrap,
#audit-list-modal.admin-fullscreen-modal .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.admin-fullscreen-modal .modal-header {
  flex: 0 0 auto;
  cursor: default;
}

#audit-list-modal .audit-maintenance {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#audit-list-modal .audit-maintenance > label:first-child {
  min-width: 190px;
}

#audit-list-modal .audit-backup-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
}

#audit-list-modal .audit-backup-confirm input {
  width: 18px;
  height: 18px;
  margin: 0;
}

#audit-list-modal .audit-maintenance .helper-text {
  flex-basis: 100%;
  margin: 0;
  font-size: 14px;
}

#audit-table td:nth-child(5) {
  white-space: normal;
  word-break: break-word;
}

#audit-list-modal .table-wrap {
  overflow: auto;
}

#audit-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

#audit-table th,
#audit-table td {
  min-width: 60px;
}

.feature-permission-preset-name {
  font-weight: 700;
  text-align: left;
}

.feature-permission-preset-editor-panel,
.feature-permission-preset-library {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.feature-permission-preset-editor-panel {
  display: block;
  min-height: 0;
  padding: 0;
}

.feature-permission-preset-library {
  display: block;
  min-height: 0;
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.feature-permission-preset-editor-panel .compact-title-row,
.feature-permission-preset-library .compact-title-row {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.feature-permission-preset-editor-panel h4,
.feature-permission-preset-library h4 {
  margin: 0;
}

.feature-permission-preset-actions {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.feature-permission-preset-editor-table-wrap {
  display: block;
  flex: none;
  min-height: 0;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

#feature-permission-preset-editor-table {
  width: 100%;
  min-width: 680px;
  table-layout: fixed;
}

#feature-permission-preset-editor-table th:first-child {
  width: 42%;
}

#feature-permission-preset-editor-table th:nth-child(2),
#feature-permission-preset-editor-table th:nth-child(3) {
  width: 29%;
}

.feature-permission-preset-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: visible;
  align-content: start;
}

.feature-permission-preset-card {
  min-width: 0;
  align-self: start;
  border: 1px solid #e4d3be;
  border-radius: 10px;
  background: #fff8e8;
  overflow: hidden;
}

.feature-permission-preset-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 9px 10px;
}

.feature-permission-preset-card-header .feature-permission-preset-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.feature-permission-preset-summary-toggle {
  flex: 0 0 auto;
  min-width: 38px;
  padding: 6px 10px;
}

.feature-permission-preset-summary {
  padding: 10px 12px 12px;
  border-top: 1px solid #ead8bd;
  background: #fffdf9;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.55;
}

.feature-permission-preset-empty {
  grid-column: 1 / -1;
  padding: 16px;
  text-align: center;
}

#feature-permission-preset-modal.admin-fullscreen-modal .modal-content {
  display: block;
  overflow-y: auto;
}

#feature-permission-preset-modal.admin-fullscreen-modal .feature-permission-preset-editor-panel,
#feature-permission-preset-modal.admin-fullscreen-modal .feature-permission-preset-library {
  display: block;
  flex: none;
  height: auto;
  min-height: 0;
  overflow: visible;
}

#feature-permission-preset-modal.admin-fullscreen-modal .feature-permission-preset-editor-table-wrap {
  display: block;
  flex: none;
  height: auto;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

#feature-permission-preset-editor-table .feature-permission-preset-group-row td {
  background: #f4eee7;
  font-weight: 700;
}

#feature-permission-preset-editor-table .feature-permission-preset-child-row td:first-child {
  padding-left: 32px;
}

@media (max-width: 980px) {
  .feature-permission-preset-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .feature-permission-preset-editor-panel {
    min-height: 0;
  }

  .feature-permission-preset-library {
    min-height: 0;
  }

  .feature-permission-preset-card-grid {
    grid-template-columns: 1fr;
  }
}

.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.integration-review-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.65fr) minmax(520px, 1.85fr);
  gap: 16px;
  align-items: start;
}

.integration-review-list,
.integration-review-detail {
  height: clamp(480px, 70vh, 860px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.integration-review-list > h3,
.integration-review-detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-top: 0;
  padding: 4px 0 10px;
  background: #fff;
}

.integration-review-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.integration-review-detail-header h3 {
  margin: 0;
}

.integration-review-detail.is-floating {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(1120px, 94vw);
  height: min(820px, 90vh);
  min-width: min(680px, 90vw);
  min-height: 380px;
  max-width: 96vw;
  max-height: 94vh;
  transform: translate(-50%, -50%);
  z-index: 5000;
  resize: both;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 20px;
  border: 1px solid #d8c7b4;
  border-radius: 16px;
  background: #fffdf9;
  background-clip: padding-box;
  opacity: 1;
  isolation: isolate;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.28);
}

.integration-review-detail.is-floating .integration-review-detail-header {
  cursor: move;
  user-select: none;
  margin: -16px -18px 14px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  background: #fffdf9;
}

.integration-floating-resize-handle {
  display: none;
}

.integration-review-detail.is-floating .integration-floating-resize-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 5;
  display: block;
  width: 24px;
  height: 24px;
  border: 0;
  border-right: 4px solid var(--accent);
  border-bottom: 4px solid var(--accent);
  border-radius: 0 0 10px 0;
  cursor: nwse-resize;
  touch-action: none;
}

body.is-resizing-integration-detail {
  cursor: nwse-resize;
  user-select: none;
}

.integration-review-filter-grid {
  align-items: start;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.15fr) minmax(240px, 1fr);
  margin-top: 12px;
}

.integration-review-filter-grid > label {
  display: grid;
  align-content: start;
  align-self: start;
  min-height: 86px;
}

.integration-status-help {
  display: block;
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.35;
}

.integration-review-items {
  display: grid;
  gap: 10px;
}

.integration-review-card {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--border);
  background: #fffdf8;
  color: var(--text);
  border-radius: 14px;
  padding: 9px 10px;
  box-shadow: none;
  font-size: 14px;
}

.integration-card-head strong {
  font-size: 14px;
  line-height: 1.3;
}

.integration-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.integration-card-toggle {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
}

.integration-card-toggle:hover {
  background: #f1e9df;
}

.integration-review-card.active {
  border-color: var(--primary);
  background: #fff7e5;
}

.integration-status {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e7f5ef;
  color: #176a47;
  font-size: 14px;
  font-weight: 700;
}

.integration-meta {
  color: var(--muted);
  font-size: 14px;
}

.integration-raw-content {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 2px 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-family: inherit;
  cursor: text;
  user-select: text;
}

.integration-review-detail textarea {
  resize: vertical;
}

.integration-preview {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.integration-preview a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.integration-preview img {
  display: block;
  width: 180px;
  max-width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f5efe6;
}

.integration-preview-missing {
  display: grid;
  place-items: center;
  width: 180px;
  max-width: 100%;
  min-height: 88px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #fff7e9;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 10px;
}

.integration-file-name {
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.integration-path {
  display: block;
  max-width: 260px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  color: var(--muted);
}

.integration-ocr {
  margin: 0;
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
  font-family: inherit;
  font-size: 14px;
  background: #fff7e9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.integration-work-block {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
}

.integration-work-block h4 {
  margin: 0;
  font-size: 15px;
}

.integration-work-list {
  display: grid;
  gap: 8px;
}

.integration-work-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.integration-work-row .dynamic-field,
.integration-work-row .searchable-select,
.integration-work-row .searchable-row,
.integration-work-row .searchable-input,
.integration-work-row .operation-field,
.integration-work-row input,
.integration-work-row select,
.integration-work-row textarea {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.integration-work-row .dynamic-field[data-key="vendor_work_summary"],
.integration-work-row .dynamic-field.full-row {
  grid-column: 1 / -1;
}

.integration-work-row .dynamic-field[data-key="worker_count"] input {
  min-width: 10ch;
}

.integration-work-remove {
  justify-self: end;
}

.integration-photo-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 8px;
  min-width: 360px;
}

.integration-photo-fields label {
  font-size: 14px;
}

.integration-photo-fields input,
.integration-photo-fields textarea {
  font-size: 14px;
}

.mt-12 {
  margin-top: 12px;
}

.segmented-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff7e9;
}

.segmented-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
}

.segmented-tabs button.active {
  background: var(--accent);
  color: #fff;
}

.cloud-management-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  margin-top: 12px;
}

.cloud-management-tabs button {
  width: 100%;
  min-height: 42px;
  white-space: normal;
  line-height: 1.35;
}

.cloud-management-panel {
  min-width: 0;
  padding-top: 16px;
}

.cloud-management-panel > .list:first-child {
  margin-top: 0;
}

.cloud-ai-management-actions {
  justify-content: flex-start;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .cloud-management-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .cloud-management-tabs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 28px;
  }

  .staff-core-row {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 820px) {
  #audit-list-modal .audit-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  #audit-list-modal .audit-filter-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #section-home {
    grid-template-columns: 1fr;
  }

  #section-home > h2,
  #section-home > .announcement-panel,
  #section-home > .home-alert-grid {
    grid-column: 1;
    grid-row: auto;
  }

  .page-header {
    padding-top: 56px;
  }

  aside.sidebar {
    width: min(74vw, 300px);
    max-width: 300px;
    padding: 16px 12px;
    z-index: 3500;
    overflow-y: auto;
  }

  .sidebar-header {
    align-items: center;
    gap: 10px;
  }

  .sidebar-title {
    flex: 1 1 auto;
  }

  .sidebar-actions {
    flex: 0 0 auto;
  }

  .sidebar-header .home-btn,
  .sidebar-header .ghost {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
  }

  .sidebar-header .home-btn svg {
    width: 32px;
    height: 32px;
  }

  .sidebar-nav {
    gap: 8px;
    padding-right: 0;
  }

  .sidebar-nav button {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 8px 10px;
  }

  .sidebar-nav button .nav-icon {
    justify-self: start;
  }

  .sidebar-nav button .nav-label {
    justify-self: start;
    min-width: 0;
    text-align: left;
    line-height: 1.25;
  }

  .sidebar-nav .nav-arrow {
    justify-self: end;
    margin-left: 0;
  }

  aside.sidebar:not(.hidden):not(.collapsed) {
    transform: translateX(0);
  }

  aside.sidebar.hidden,
  aside.sidebar.collapsed {
    transform: translateX(-100%);
  }

  main {
    margin-left: 0;
  }

  body.sidebar-collapsed main {
    margin-left: 0;
  }

  .page-header .header-top {
    flex-direction: column;
    align-items: center;
  }

  .app-brand {
    width: 100%;
    justify-content: center;
    gap: 12px;
    text-align: center;
  }

  .app-brand-logo {
    width: 82px;
    height: 44px;
    right: calc(50% + 82px);
  }

  .app-brand h1 {
    font-size: 24px;
  }

  .app-company-name {
    font-size: 14px;
  }

  .title-row {
    width: 100%;
    justify-content: space-between;
  }

  .user-bar {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    position: relative;
    right: auto;
    top: auto;
    z-index: 3600;
  }

  .user-profile {
    align-items: flex-start;
  }

  .user-actions {
    z-index: 3700;
  }

  .user-dropdown {
    left: 0;
    right: auto;
    z-index: 3800;
  }

  .sidebar-overlay.hidden {
    display: none;
  }

  .sidebar-overlay {
    z-index: 3400;
  }

  main {
    padding: 24px 14px 40px;
  }

  .card {
    padding: 18px;
  }


  .labor-row {
    grid-template-columns: 1fr 1fr;
  }

  .labor-row.management-row {
    grid-template-columns: 1fr 1fr;
  }

  .actions,
  .nav-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .actions button,
  .nav-buttons button {
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
  }

  .inline {
    flex-direction: column;
    align-items: stretch;
  }

  .inline > button,
  .inline > .file-button {
    width: auto;
    max-width: 100%;
    align-self: flex-start;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .project-top-row,
  .project-order-primary-row,
  .project-order-secondary-row,
  .project-order-attachment-row,
  .project-manager-row,
  .account-core-row,
  .staff-core-row,
  .integration-review-layout {
    grid-template-columns: 1fr;
  }

  .project-order-attachment-item {
    grid-template-columns: 1fr;
  }

  .integration-review-list,
  .integration-review-detail {
    height: auto;
    max-height: none;
    overflow-y: visible;
    scrollbar-gutter: auto;
  }

  .account-site-access {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .integration-review-list > h3,
  .integration-review-detail-header {
    position: static;
  }

  .integration-review-detail.is-floating .integration-review-detail-header {
    position: sticky;
  }

  .integration-review-detail.is-floating {
    width: min(94vw, 1120px);
    height: min(90vh, 820px);
    min-width: min(320px, 90vw);
    min-height: 280px;
    max-height: 94vh;
    overflow: auto;
    resize: both;
  }

  .integration-work-row,
  .integration-photo-fields {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .integration-work-summary,
  .integration-photo-fields .span-2 {
    grid-column: 1;
  }

  .project-owner-row {
    flex-direction: column;
    gap: 8px;
  }

  .staff-core-row .date-small,
  .staff-core-row .staff-prehire,
  .staff-birthday {
    width: 100%;
    min-width: 0;
  }

  .staff-address-field {
    grid-column: 1 / -1;
  }

  .staff-prehire .inline-suffix {
    width: 100%;
  }

  .staff-prehire input {
    width: 72px;
    min-width: 72px;
  }

  .staff-structured-inputs {
    grid-template-columns: 1fr;
  }

  .staff-work-project-row {
    grid-template-columns: 1fr;
  }

  #staff-cert-list,
  .staff-cert-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  #staff-cert-detail-list .staff-structured-item.cert-card {
    grid-template-columns: 1fr auto;
  }

  #staff-cert-detail-list .staff-structured-item.cert-card .cert-preview-img {
    grid-column: 1 / -1;
  }

  .staff-photo-card {
    grid-row: auto;
  }

  .search-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-row > label,
  .search-row > .search-input-wrap,
  .search-row > input,
  .search-row > select {
    width: 100%;
  }

  .vendor-inline {
    grid-template-columns: 1fr;
  }

  .vendor-procurement-row,
  .vendor-procurement-row-2,
  .vendor-procurement-row-qualification,
  .vendor-procurement-row-3,
  .vendor-contact-line,
  .vendor-payment-line,
  .vendor-procurement-row-top,
  .vendor-procurement-row-meta {
    grid-template-columns: 1fr;
  }

  .qualified-roster-template-bar,
  .qualified-assessment-template-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .qualified-vendor-search-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .qualified-vendor-search-actions {
    align-items: center;
  }

  .qualified-vendor-search-status {
    grid-column: 1;
  }

  .vendor-intake-layout,
  .vendor-intake-fields,
  .vendor-intake-fieldset {
    grid-template-columns: 1fr;
  }

  .vendor-detail-row-brand,
  .vendor-detail-row-contact,
  .vendor-detail-editor-brand,
  .vendor-detail-editor-contact {
    grid-template-columns: 1fr;
  }

  #vendor-brand-rows .vendor-detail-header,
  #vendor-contact-simple-rows .vendor-detail-header {
    display: none;
  }

  .vendor-detail-actions {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .vendor-detail-actions button {
    width: auto;
    max-width: 100%;
  }

  .announcement-editor-row {
    grid-template-columns: 1fr;
  }

  .announcement-admin-row {
    grid-template-columns: 1fr;
  }

  .announcement-panel {
    max-width: 100%;
  }

  .layout-item .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-bar {
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .staff-profile-layout {
    grid-template-columns: 1fr;
  }

  .staff-profile-layout #staff-file-hint {
    min-height: 0;
  }
}


.list details {
  cursor: pointer;
}

.list details pre {
  margin-top: 8px;
  padding: 10px;
  background: #fff7e9;
  border-radius: 10px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

.permission-toggle-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ai-custom-capability-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf3;
}

.ai-provider-settings-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf0;
}

.ai-provider-settings-panel > summary {
  cursor: pointer;
  font-weight: 700;
}

.ai-provider-settings-grid,
.ai-provider-token-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ai-usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.ai-usage-summary-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
}

.ai-usage-summary-card span {
  color: var(--muted);
  font-size: 14px;
}

.ai-usage-summary-card strong {
  font-size: 1.15rem;
}

#ai-usage-table,
#ai-usage-modal details table {
  width: max-content;
  min-width: 100%;
}

#ai-pricing-list input,
#ai-pricing-list select {
  min-width: 130px;
}

.ai-provider-settings-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.ai-provider-token-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.ai-provider-token-card {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e4c995;
  border-radius: 10px;
  background: #fff;
}

.ai-provider-token-card h4,
.ai-provider-token-card .helper-text {
  margin: 0;
}

.ai-provider-list-heading {
  margin-top: 14px;
}

.ai-cloud-provider-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.ai-cloud-provider-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8c49d;
  border-radius: 8px;
  background: #fff;
}

.ai-cloud-provider-title {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.ai-cloud-provider-summary-list {
  display: grid;
  gap: 8px;
}

.ai-cloud-provider-summary-row {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  border: 1px solid #d8c49d;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.ai-cloud-provider-summary-row:hover,
.ai-cloud-provider-summary-row:focus-visible {
  transform: none;
  background: #f4f7f2;
}

.ai-cloud-provider-summary-row > span:first-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-cloud-provider-summary-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ai-provider-connected-status {
  color: #28733f;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.ai-cloud-provider-title-label {
  display: flex;
  min-width: 0;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-cloud-provider-summary-row > span:last-child {
  flex: 0 0 auto;
}

.ai-cloud-provider-editor {
  margin-top: 12px;
}

.ai-cloud-provider-editor-actions {
  margin: 0;
}

.ai-cloud-provider-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.ai-cloud-provider-options,
.ai-cloud-provider-item .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ai-cloud-provider-item .ai-provider-test-status {
  margin: 0;
  line-height: 1.55;
}

.ai-local-provider-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.ai-task-routing-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #d8c49d;
}

.ai-task-route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 10px;
}

.ai-task-route-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8c49d;
  border-radius: 8px;
  background: #fff;
}

.ai-task-route-card h5 {
  margin: 0;
  font-size: 1rem;
}

.ai-route-select-list {
  display: grid;
  gap: 8px;
}

.ai-route-select-list label {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ai-source-external-toggle {
  min-width: 128px;
  margin: 0;
}

.private-assistant-ai-source-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e4c995;
  border-radius: 12px;
  background: #fff8e8;
}

.private-assistant-ai-source-panel h4,
.private-assistant-ai-source-panel .helper-text {
  margin-top: 0;
}

.private-assistant-ai-source-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.private-assistant-ai-source-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(170px, 0.8fr) minmax(240px, 1.4fr) minmax(128px, auto) auto;
  gap: 8px;
  align-items: center;
}

.ai-capability-label {
  display: grid;
  gap: 3px;
  align-items: start;
}

.ai-capability-label small {
  color: var(--muted);
  line-height: 1.35;
}

.ai-capability-label .small-btn {
  justify-self: start;
}

.ai-capability-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.permission-toggle-header,
.permission-toggle-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(130px, 180px) minmax(150px, 200px) minmax(64px, auto);
  align-items: center;
  gap: 12px;
}

.permission-toggle-header {
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.permission-toggle-row {
  min-height: 40px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.permission-scope-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.permission-toggle-row strong {
  color: #1d6b45;
  font-size: 14px;
  font-weight: 600;
}

.permission-toggle-row.is-fixed strong {
  color: #a33a32;
}

@media (max-width: 720px) {
  .ai-custom-capability-form,
  .ai-provider-settings-grid,
  .ai-provider-token-grid,
  .ai-cloud-provider-fields,
  .ai-task-route-grid,
  .ai-cloud-provider-title,
  .channel-ai-data-source-row,
  .private-assistant-ai-source-row {
    grid-template-columns: 1fr;
  }

  .permission-toggle-header {
    display: none;
  }

  .permission-toggle-row {
    grid-template-columns: 1fr;
  }
}

.report-entry-tabs {
  display: flex;
  gap: 0;
  margin: 14px 0 0;
  border-bottom: 1px solid var(--border);
}

#report-photo-panel {
  margin-top: 14px;
  padding-top: 4px;
}

.integration-review-tabs {
  margin: 12px 0;
}

.completion-photo-check {
  margin: 10px 0;
  font-weight: 700;
}

.report-entry-tab {
  min-height: 42px;
  padding: 8px 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.report-entry-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.report-save-scope,
.report-export-choice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
}

.report-save-scope > span,
.report-export-choice legend {
  font-weight: 700;
}

.report-save-scope .inline,
.report-export-choice .inline {
  flex-direction: row;
  align-items: center;
  width: auto;
  margin: 0;
}

.report-entry-panel {
  padding-top: 12px;
}

.report-template-export-window {
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.report-export-options {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 12px;
}

.report-export-choice {
  margin: 14px 0 0;
  border: 1px solid var(--border);
}

.integration-workflow-settings,
.integration-task-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.55);
}

.integration-workflow-settings h4,
.integration-task-panel h4 {
  margin: 0;
}

.integration-workflow-settings select[multiple] {
  min-height: 112px;
}

.permission-preset-multi-select {
  min-height: 112px;
  padding: 4px 6px;
}

.permission-preset-multi-select option {
  padding: 5px 8px;
}

.workflow-stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.workflow-stage-row {
  cursor: grab;
}

.workflow-stage-row.dragging {
  opacity: 0.55;
}

.workflow-stage-row.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(47, 111, 79, 0.08);
}

.workflow-drag-handle {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 14px;
  cursor: grab;
}

.integration-overdue {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  color: #9d2419;
  background: #fce9e7;
  border: 1px solid #ebbbb6;
  font-size: 14px;
}

.evidence-dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.evidence-stat {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

[data-ai-confidence] {
  border-color: #b6c7e8;
  box-shadow: 0 0 0 2px rgba(64, 101, 171, 0.08);
}

@media (max-width: 760px) {
  .report-entry-tabs {
    overflow-x: auto;
  }

  .report-entry-tab {
    flex: 1 0 auto;
  }

  .report-export-options {
    grid-template-columns: 1fr;
  }
}

.feature-permission-preset-system-tabs {
  margin-bottom: 12px;
}

.vendor-import-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d6b27a;
  border-radius: 6px;
  background: #fff8e8;
  color: #5f3a16;
  font-weight: 600;
}

.vendor-import-progress.is-error {
  border-color: #c86b65;
  background: #fff1f0;
  color: #8a2420;
}

.vendor-import-spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 3px solid #e6ccb0;
  border-top-color: #c96f25;
  border-radius: 50%;
  animation: vendor-import-spin 0.8s linear infinite;
}

.vendor-import-progress.is-error .vendor-import-spinner {
  display: none;
}

@keyframes vendor-import-spin {
  to { transform: rotate(360deg); }
}
.vendor-import-qualification-mode {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #decdb9;
  border-radius: 6px;
  background: #fffdf9;
}

.vendor-import-qualification-mode legend {
  padding: 0 6px;
  font-weight: 700;
}

.vendor-import-qualification-mode label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #eadfd3;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.vendor-import-qualification-mode input {
  margin-top: 3px;
}

.vendor-import-qualification-mode span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.vendor-import-qualification-mode small {
  color: #76695e;
}

/* Site-wide narrow-screen guardrails. Wide data tables keep their own scroll containers. */
main,
.app-section,
.card,
form,
.list,
.title-row,
.modal-header,
.table-wrap {
  min-width: 0;
}

img,
video,
canvas,
iframe {
  max-width: 100%;
}

@media (max-width: 900px) {
  .modal {
    box-sizing: border-box;
    padding: 8px;
  }

  .modal .modal-content,
  #staff-list-modal .modal-content,
  #announcement-list-modal .modal-content,
  #member-list-modal .modal-content,
  .staff-certificate-summary-modal-content,
  .staff-certificate-preview-modal-content {
    min-width: 0;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    resize: none;
  }

  .table-wrap,
  .vendor-detail-table-wrap,
  .feature-permission-preset-editor-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
}

@media (max-width: 720px) {
  main {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
  }

  .card,
  .app-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .title-row,
  .modal-header {
    align-items: flex-start;
  }

  .title-row > h2,
  .title-row > h3,
  .modal-header > h2,
  .modal-header > h3 {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .title-row > .title-spacer,
  .modal-header > .title-spacer {
    display: none;
  }

  .window-controls {
    max-width: 100%;
    flex-wrap: wrap;
  }

  input[type="file"] {
    width: 100%;
    min-width: 0;
  }

  #vendor-form,
  .vendor-procurement-form,
  .vendor-procurement-row,
  .vendor-procurement-form > .list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #vendor-form,
  .vendor-procurement-form,
  .vendor-procurement-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .vendor-procurement-form .field-full,
  .vendor-procurement-form .field-wide,
  .staff-address-field {
    grid-column: 1;
  }

  .placeholder-list,
  .ai-usage-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  }

  .segmented-tabs,
  .report-entry-tabs,
  .integration-review-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
  }

  .segmented-tabs button,
  .report-entry-tab {
    flex: 0 0 auto;
  }

  .vendor-card-preview-card,
  .cert-card,
  .cert-preview-img {
    width: 100%;
    max-width: 100%;
  }

  .account-password-box {
    width: 100%;
    min-width: 0;
    height: auto;
  }

  .account-password-field {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-password-field > span {
    white-space: normal;
  }

  #reset-account-password {
    justify-self: start;
  }
}
.global-file-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 20, 16, 0.42);
  cursor: wait;
}

.global-file-upload-overlay.hidden {
  display: none !important;
}

.global-file-upload-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: min(320px, calc(100vw - 40px));
  padding: 24px 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  color: #4f321f;
  text-align: center;
}

.global-file-upload-card strong {
  font-size: 1.15rem;
}

.global-file-upload-card span:last-child {
  color: #725843;
  font-size: 0.92rem;
}

.global-file-upload-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #ead8c8;
  border-top-color: #c56f28;
  border-radius: 50%;
  animation: global-file-upload-spin 0.8s linear infinite;
}

@keyframes global-file-upload-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .global-file-upload-spinner {
    animation-duration: 1.8s;
  }
}

/* Successful permission preset application, beside both apply buttons. */
.helper-text.permission-apply-status {
  color: #176b35;
  font-weight: 700;
}

/* Keep login feedback clearly visible, including invalid credentials. */
#login-status {
  color: #176b35;
  font-weight: 700;
}

/* Contact editing keeps usable columns and scrolls inside the dialog. */
#vendor-contact-modal .modal-content {
  width: min(1360px, 96vw);
  max-width: 96vw;
  box-sizing: border-box;
}
#vendor-contact-view { min-width: 0; }
#vendor-contact-view .vendor-contact-table-wrap { overflow-x: auto; max-width: 100%; }
#vendor-contact-table { min-width: 1180px; width: 100%; table-layout: fixed; }
#vendor-contact-table th { white-space: nowrap; }
#vendor-contact-table th:nth-child(1), #vendor-contact-table td:nth-child(1) { width: 120px; min-width: 120px; }
#vendor-contact-table th:nth-child(2), #vendor-contact-table td:nth-child(2) { width: 120px; min-width: 120px; }
#vendor-contact-table th:nth-child(3), #vendor-contact-table td:nth-child(3) { width: 155px; min-width: 155px; }
#vendor-contact-table th:nth-child(4), #vendor-contact-table td:nth-child(4) { width: 72px; min-width: 72px; }
#vendor-contact-table th:nth-child(5), #vendor-contact-table td:nth-child(5) { width: 150px; min-width: 150px; }
#vendor-contact-table th:nth-child(6), #vendor-contact-table td:nth-child(6) { width: 260px; min-width: 260px; }
#vendor-contact-table th:nth-child(7), #vendor-contact-table td:nth-child(7) { width: 220px; min-width: 220px; }
#vendor-contact-table th:nth-child(8), #vendor-contact-table td:nth-child(8) { width: 80px; min-width: 80px; }
#vendor-contact-table input { box-sizing: border-box; min-height: 40px; padding: 8px; }
#vendor-contact-view .vendor-contact-modal-actions { flex-wrap: wrap; }

/* Project owner information: one contact frame with billing outside. */
#project-form .project-owner-row { display: grid; grid-template-columns: minmax(140px, .85fr) 16ch minmax(180px, 1.2fr) minmax(245px, 1fr); gap: 12px; }
#project-form .project-owner-contact-panel { min-width: 0; margin: 12px 0; padding: 12px; border: 1px solid #d8cabc; border-radius: 12px; }
#project-owner-contact-rows .vendor-detail-table-wrap { border: 0; border-radius: 0; }
#project-form .project-owner-remark { display: grid; width: 100%; margin: 0 0 12px; }
@media (max-width: 1100px) {
  #project-form .project-owner-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  #project-form .project-owner-row { grid-template-columns: minmax(0, 1fr); }
}

.vendor-offices-panel { min-width: 0; }
.vendor-office-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(220px, 2fr) auto; gap: 10px; align-items: end; margin-top: 12px; }
.vendor-office-row label, .vendor-office-row input { min-width: 0; width: 100%; }
@media (max-width: 1000px) { .vendor-office-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .vendor-office-row { grid-template-columns: minmax(0, 1fr); } }

/* Shared columns keep both project addresses aligned and manager names readable. */
#project-form .project-owner-row,
#project-form .project-manager-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) minmax(240px, 1.2fr) minmax(245px, 1fr);
  gap: 12px;
}
#project-form .project-owner-row { grid-template-columns: minmax(240px, 1fr) 16ch minmax(240px, 1.2fr) minmax(245px, 1fr); }
#project-form .project-owner-row > .project-tax-id-field { margin-right: 0; }
#project-form .project-manager-row .searchable-row { display: flex; }
#project-form .project-manager-row .searchable-input { flex: 1 1 0; width: 0; min-width: 0; }
#project-form .project-manager-row .clear-btn,
#project-form .project-manager-row .drop-btn { flex: 0 0 38px; }
@media (max-width: 1200px) {
  #project-form .project-owner-row,
  #project-form .project-manager-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  #project-form .project-owner-row,
  #project-form .project-manager-row { grid-template-columns: minmax(0, 1fr); }
}

.project-short-name-field { min-width: 0; margin: 0; }
.project-short-name-field input { width: 100%; min-width: 0; box-sizing: border-box; }

.vendor-full-text-button { display: block; max-width: 100%; min-width: 0; padding: 2px 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.vendor-full-text-button:hover { text-decoration: underline; }
.vendor-full-text-button:focus-visible { outline: 2px solid #176b35; outline-offset: 2px; }
.vendor-full-text-dialog { width: min(680px, calc(100vw - 48px)); max-width: calc(100vw - 48px); max-height: 80vh; box-sizing: border-box; padding: 24px; border: 1px solid #d8cabc; border-radius: 12px; overflow: auto; }
.vendor-full-text-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.vendor-full-text-content { margin: 16px 0 24px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
