/* FundStone Production project styles. Colors, spacing and radii come from FDS tokens only. */

.fsp-skip { position: absolute; left: -999px; top: var(--fds-space-2); background: var(--fds-bg-panel); color: var(--fds-text-primary); padding: var(--fds-space-2) var(--fds-space-3); border-radius: var(--fds-radius-sm); }
.fsp-skip:focus { left: var(--fds-space-2); z-index: 10; }

.fsp-main { max-width: 1120px; margin: 0 auto; padding: var(--fds-space-6) var(--fds-space-4); }
.fsp-main-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.fsp-login-card { width: 100%; max-width: 420px; }
.fsp-login-card .fds-card-body { display: flex; flex-direction: column; gap: var(--fds-space-4); }
.fsp-login-button { display: inline-flex; justify-content: center; width: 100%; }

.fsp-notice { margin: 0; padding: var(--fds-space-3) var(--fds-space-4); border-radius: var(--fds-radius-sm); background: var(--fds-bg-muted); color: var(--fds-text-primary); }
.fsp-notice-error { background: var(--fds-red-50); color: var(--fds-red-700); }
.fsp-notice-info { background: var(--fds-blue-50); color: var(--fds-blue-600); }

.fsp-lang { display: flex; gap: var(--fds-space-3); font-size: 0.875rem; color: var(--fds-text-secondary); }
.fsp-lang a { color: var(--fds-text-secondary); }
.fsp-lang [aria-current="true"] { color: var(--fds-text-primary); font-weight: 600; }

.fsp-topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--fds-space-4); flex-wrap: wrap; padding: var(--fds-space-3) var(--fds-space-4); background: var(--fds-bg-panel); border-bottom: 1px solid var(--fds-gray-100); }
.fsp-brand { margin: 0; font-weight: 600; color: var(--fds-text-primary); }
.fsp-topbar-actions { display: flex; align-items: center; gap: var(--fds-space-4); flex-wrap: wrap; }

.fsp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--fds-space-4); margin: var(--fds-space-4) 0 var(--fds-space-8); }
.fsp-facts div { background: var(--fds-bg-panel); border-radius: var(--fds-radius-md); padding: var(--fds-space-4); }
.fsp-facts dt { color: var(--fds-text-muted); font-size: 0.875rem; margin-bottom: var(--fds-space-1); }
.fsp-facts dd { margin: 0; color: var(--fds-text-primary); font-weight: 600; overflow-wrap: anywhere; }

.fsp-line-list { list-style: none; margin: var(--fds-space-4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--fds-space-4); }
.fsp-line-card .fds-card-body p { margin: 0 0 var(--fds-space-1); }

@media (max-width: 480px) {
  .fsp-main { padding: var(--fds-space-4) var(--fds-space-4); }
  .fsp-topbar-actions { width: 100%; justify-content: space-between; }
}

/* M1: work orders */
.fsp-topbar-left { display: flex; align-items: center; gap: var(--fds-space-6); flex-wrap: wrap; }
.fsp-nav { display: flex; flex-wrap: wrap; gap: var(--fds-space-4); }
.fsp-nav a { text-decoration: none; color: var(--fds-text-secondary); padding: var(--fds-space-1) 0; }
.fsp-nav a[aria-current="page"] { color: var(--fds-text-primary); font-weight: 600; border-bottom: 2px solid var(--fds-text-primary); }
.fsp-actor { white-space: nowrap; }
.fsp-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--fds-space-4); flex-wrap: wrap; margin-bottom: var(--fds-space-4); }
.fsp-page-head h1, .fsp-page-head h2 { margin-bottom: 0; }
.fsp-status-block { display: flex; align-items: center; gap: var(--fds-space-2); flex-wrap: wrap; }
.fsp-section { margin-top: var(--fds-space-8); }
.fsp-counts { list-style: none; margin: 0 0 var(--fds-space-4); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--fds-space-2); }
.fsp-counts a { display: flex; flex-direction: column; gap: 2px; padding: var(--fds-space-2) var(--fds-space-3); background: var(--fds-bg-panel); border-radius: var(--fds-radius-sm); text-decoration: none; }
.fsp-counts a[aria-current="true"] { outline: 2px solid var(--fds-text-primary); }
.fsp-filters { display: flex; flex-wrap: wrap; gap: var(--fds-space-3); align-items: flex-end; margin-bottom: var(--fds-space-4); }
.fsp-field { display: flex; flex-direction: column; gap: var(--fds-space-1); font-size: 0.875rem; color: var(--fds-text-secondary); min-width: 0; }
.fsp-field input, .fsp-field select, .fsp-field textarea { font-size: 1rem; color: var(--fds-text-primary); padding: var(--fds-space-2) var(--fds-space-3); border: 1px solid var(--fds-gray-300); border-radius: var(--fds-radius-sm); background: var(--fds-bg-panel); max-width: 100%; }
.fsp-form { display: grid; gap: var(--fds-space-3); }
.fsp-form-inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; margin-top: var(--fds-space-2); }
.fsp-form-actions { display: flex; gap: var(--fds-space-2); justify-content: flex-end; }
.fsp-inline { display: inline; }
.fsp-link-button { background: none; border: 0; padding: 0; color: var(--fds-red-700); text-decoration: underline; cursor: pointer; font-size: 0.875rem; }
.fsp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--fds-bg-panel); border-radius: var(--fds-radius-md); }
.fsp-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.fsp-table th, .fsp-table td { text-align: left; padding: var(--fds-space-2) var(--fds-space-3); border-bottom: 1px solid var(--fds-gray-100); vertical-align: top; white-space: nowrap; }
.fsp-table th { color: var(--fds-text-muted); font-weight: 500; font-size: 0.8125rem; }
.fsp-table td:nth-child(2) { white-space: normal; min-width: 160px; }
.fsp-badge { display: inline-block; padding: 2px var(--fds-space-2); border-radius: var(--fds-radius-pill); font-size: 0.75rem; font-weight: 600; background: var(--fds-gray-100); color: var(--fds-text-secondary); }
.fsp-badge-warn { background: var(--fds-amber-50); color: var(--fds-amber-700); }
.fsp-status-in_production { background: var(--fds-blue-50); color: var(--fds-blue-600); }
.fsp-status-completed { background: var(--fds-green-50); color: var(--fds-green-700); }
.fsp-status-cancelled, .fsp-status-suspended { background: var(--fds-red-50); color: var(--fds-red-700); }
.fsp-status-reviewed { background: var(--fds-green-50); color: var(--fds-green-700); }
.fsp-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--fds-space-4); }
.fsp-material { display: flex; align-items: center; gap: var(--fds-space-2); flex-wrap: wrap; }
.fsp-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--fds-gray-300); vertical-align: middle; }
.fsp-details summary { cursor: pointer; color: var(--fds-text-secondary); font-size: 0.875rem; }
.fsp-details[open] { background: var(--fds-bg-muted); padding: var(--fds-space-3); border-radius: var(--fds-radius-sm); margin-top: var(--fds-space-2); }
.fsp-row-actions .fsp-details[open] { position: relative; min-width: 280px; white-space: normal; }
.fsp-events { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--fds-space-1); font-size: 0.875rem; }
.fsp-events time { color: var(--fds-text-muted); font-variant-numeric: tabular-nums; margin-right: var(--fds-space-2); }
.fsp-note { white-space: pre-wrap; }
.fsp-empty { padding: var(--fds-space-6); text-align: center; }
.fds-layer:not([hidden]) { display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.4); padding: var(--fds-space-4); overflow: auto; }
.fds-dialog { background: var(--fds-bg-panel); border-radius: var(--fds-radius-md); padding: var(--fds-space-6); width: 100%; max-width: 560px; max-height: 100%; overflow: auto; }

/* M2: process, media, time */
.fsp-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--fds-space-3); }
.fsp-timeline-entry { background: var(--fds-bg-panel); border-radius: var(--fds-radius-md); padding: var(--fds-space-3) var(--fds-space-4); border-left: 4px solid var(--fds-gray-300); }
.fsp-timeline-deleted { opacity: 0.6; border-left-color: var(--fds-red-700); }
.fsp-timeline-head { display: flex; align-items: center; gap: var(--fds-space-2); flex-wrap: wrap; font-size: 0.875rem; }
.fsp-timeline-head time { color: var(--fds-text-muted); font-variant-numeric: tabular-nums; }
.fsp-badge-visible { background: var(--fds-green-50); color: var(--fds-green-700); }
.fsp-entry-actions { margin: var(--fds-space-2) 0 0; display: flex; gap: var(--fds-space-3); font-size: 0.875rem; }
.fsp-link-neutral { color: var(--fds-text-secondary); }
.fsp-media { list-style: none; margin: var(--fds-space-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--fds-space-2); }
.fsp-media li { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.fsp-media img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--fds-radius-sm); border: 1px solid var(--fds-gray-200); display: block; }
.fsp-media-cover img { outline: 2px solid var(--fds-blue-600); }
.fsp-media-file { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: var(--fds-radius-sm); background: var(--fds-bg-muted); font-size: 0.75rem; color: var(--fds-text-secondary); }
.fsp-media-actions { display: flex; gap: var(--fds-space-2); font-size: 0.75rem; }
.fsp-progress { display: flex; gap: var(--fds-space-1); align-items: center; }
.fsp-progress input { width: 5em; padding: var(--fds-space-1) var(--fds-space-2); border: 1px solid var(--fds-gray-300); border-radius: var(--fds-radius-sm); }
.fsp-check { display: flex; align-items: center; gap: var(--fds-space-2); font-size: 0.9375rem; }
.fsp-table td:last-child { white-space: normal; }

/* M4: dashboard stats */
.fsp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--fds-space-4); margin-bottom: var(--fds-space-6); }
.fsp-stats h3 { margin: 0 0 var(--fds-space-2); }

/* M5: assignments, board, scan */
.fsp-badge-assignee { background: var(--fds-blue-50); color: var(--fds-blue-600); }
.fsp-badge-assignee .fsp-link-button { color: inherit; text-decoration: none; font-weight: 700; }
.fsp-assignees { white-space: normal; min-width: 140px; }
.fsp-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--fds-space-4); }
.fsp-tasks { list-style: none; margin: var(--fds-space-2) 0 0; padding: 0; display: grid; gap: var(--fds-space-1); font-size: 0.9375rem; }
.fsp-scan { max-width: 560px; display: grid; gap: var(--fds-space-4); }
.fsp-scan-button { width: 100%; justify-content: center; padding: var(--fds-space-4); font-size: 1.125rem; }
.fsp-scan-progress { justify-content: space-between; flex-wrap: wrap; gap: var(--fds-space-2); margin-bottom: var(--fds-space-2); }

/* admin */
.fsp-scope { display: flex; flex-wrap: wrap; gap: var(--fds-space-2); align-items: center; }
.fsp-table td input[type=text] { width: 100%; min-width: 120px; padding: var(--fds-space-1) var(--fds-space-2); border: 1px solid var(--fds-gray-300); border-radius: var(--fds-radius-sm); }

/* FDS extension: long immutable order IDs stay inside the intake card on phones. */
.fsp-tray-intake, .fsp-tray-intake .fsp-field { min-width: 0; }
.fsp-tray-intake select { width: 100%; min-width: 0; box-sizing: border-box; }

/* FDS extension: immutable TrayScene manufacturing attachments. */
.fsp-configuration{max-width:100%;overflow-wrap:anywhere;font-size:12px}
.fsp-configuration summary{cursor:pointer;min-height:44px;display:flex;align-items:center}
.fsp-configuration dl{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px 12px;max-height:480px;overflow:auto}
.fsp-configuration dt,.fsp-configuration dd{margin:0;min-width:0;overflow-wrap:anywhere}
.fsp-configuration img{max-width:100%;height:auto}
