/* Unified Alloy & Enamel industrial-blue theme matching the SINNEX Vue Portal */
:root {
  color-scheme: light;
  --ink: #142d49;
  --text: #304966;
  --subtle: #526a83;
  --faint: #647c93;
  --line: #c5d1de;
  --line-soft: #dde6ef;
  --accent: #125e9c;
  --deep: #14375a;
  --mint: #deedfa;
  --surface: #fbfdff;
  --page: #edf2f7;
  --radius: 10px;
  --metal-edge: inset 0 1px 0 #ffffffed, 0 2px 5px #142d4910;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(130deg, #e6edf4, #f5f8fb 52%, #e7eff6);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3, p, dl { margin: 0; }
h1 { font-size: clamp(1.35rem, 2.2vw, 1.75rem); font-weight: 650; line-height: 1.28; letter-spacing: -0.02em; color: var(--ink); }
h2 { font-size: 15.5px; font-weight: 650; color: var(--ink); }
p { color: var(--subtle); }
:focus-visible { outline: 2px solid #1d5288; outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* Unified wide workspace container & frosted metallic masthead */
.wrap { width: min(calc(100% - 2.4rem), 84rem); margin-inline: auto; }
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, #fffffff5, #eef4f9eb);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -1px #ffffffd9, 0 2px 8px #1434510d;
  backdrop-filter: blur(12px);
}
.masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding-block: 6px;
}
.masthead-left { display: flex; align-items: center; gap: 18px; min-width: 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; white-space: nowrap; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eaf6ff;
  background: linear-gradient(145deg, #245e90, #12385c 65%, #072744);
  border: 1px solid #436d90;
  box-shadow: inset 0 1px 0 #b4d6ed88, inset 0 -2px 0 #082b49, 0 2px 5px #152f501a;
}
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 14px; color: var(--ink); }
.brand-text small { font-size: 11px; color: var(--subtle); font-weight: 400; }

.top-nav { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.top-nav a {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.top-nav a:hover { background: #e2eef9; color: var(--accent); }
.top-nav a[aria-current="page"] {
  background: linear-gradient(110deg, #c5dff2, #e0effb);
  color: #164f83;
  font-weight: 650;
  box-shadow: inset 0 1px 0 #effaff, 0 1px 2px #203a5812;
}
.top-nav a.nav-admin { color: #125e9c; border: 1px solid #c2d8ec; background: #f2f8fe; }

.session-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.user-chip {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--deep);
  background: #e9f2fa;
  border: 1px solid #c7daec;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.mode { color: var(--subtle); font-size: 12px; white-space: nowrap; }

/* Buttons */
.btn, .quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f3f7fb);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 #ffffffdc;
}
.btn:hover:not(:disabled), .quiet-button:hover { background: #e7f1fa; border-color: #9cb9d4; color: var(--accent); }
.btn.primary, .primary-action {
  background: linear-gradient(#2675ae, #185788);
  border: 1px solid #16517f;
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 1px 0 #95cee577, 0 1px 3px #103c5b22;
}
.btn.primary:hover:not(:disabled), .primary-action:hover { background: linear-gradient(#256a9e, #164a75); color: #fff; }
.btn:disabled { opacity: 0.48; cursor: default; }
.btn-sm { min-height: 27px; padding: 3px 9px; font-size: 12px; border-radius: 6px; }

/* Main content spacing */
.content { padding-block: 18px 40px; }

/* Page Hero Header */
.page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(115deg, #e5f0fa, #fbfdff 64%, #e8f1f9);
  box-shadow: var(--metal-edge);
}
.hero-main { display: grid; gap: 5px; }
.hero-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.back-link { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.hero-sub { font-size: 13px; color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Badges & Chips */
.pill, .cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.code-pill { background: #14375a; color: #eaf5ff; letter-spacing: 0.03em; }
.cat-chip { background: #eaf2fa; color: #1b4f7c; border: 1px solid #cce0f3; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-jade { background: #e2f2e9; color: #216848; border: 1px solid #bfe0ce; }
.badge-blue { background: #e4f1fc; color: #15558a; border: 1px solid #bcd8f2; }
.badge-amber { background: #fff4dd; color: #8c5209; border: 1px solid #ebd19a; }
.badge-red { background: #fdeaea; color: #a62b2b; border: 1px solid #f2bcbc; }
.badge-muted { background: #edf1f5; color: #54687c; border: 1px solid #d1dbe5; }
.text-danger { color: #a62b2b; }
.muted-meta { font-size: 12px; color: var(--subtle); }

/* Alert & Step Strip */
.alert-banner {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 13px;
}
.alert-success { background: #e5f4ec; border: 1px solid #a9d9be; color: #1c5c3e; }
.alert-danger { background: #fdeaea; border: 1px solid #f0b6b6; color: #9c2626; }
.notice-card { margin: 28px auto; }

.step-strip {
  padding: 11px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 1px solid #bfd3e6;
  background: linear-gradient(120deg, #eef6fd, #fbfdff);
  box-shadow: var(--metal-edge);
  display: grid;
  gap: 6px;
}
.step-track { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.step-chip {
  padding: 2px 9px;
  border-radius: 99px;
  background: #edf3f8;
  color: var(--subtle);
  border: 1px solid #d2dfe9;
  font-weight: 550;
}
.step-chip.done { background: #e2f2e9; color: #216848; border-color: #b7dcc7; }
.step-chip.current { background: #185788; color: #fff; border-color: #144973; }
.step-arrow { color: #8ca4bc; }
.step-hint { font-size: 12.5px; color: var(--text); }
.visual-strip-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.strip-meter { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; }
.strip-meter progress { width: 120px; height: 8px; border-radius: 99px; accent-color: #1d7a50; }

/* Enamel Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--metal-edge);
  overflow: hidden;
}
.section-gap { margin-top: 16px; }
.narrow-panel { max-width: 44rem; }
.empty-panel { padding: 24px; text-align: center; grid-column: 1 / -1; }
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(#ffffff, #f1f5fa);
}
.card-body { padding: 14px 16px; }
.card-details > summary.panel-heading { cursor: pointer; list-style: none; }
.card-details > summary.panel-heading::-webkit-details-marker { display: none; }
.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(#ffffff, #f1f5fa);
}

/* Spreadsheet-style Project Table */
.sheet-toolbar { gap: 10px; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar-select, .toolbar-search, .toolbar-reason {
  height: 32px;
  padding: 0 9px;
  border: 1px solid #bfcedd;
  border-radius: 6px;
  background: #ffffff;
  font-size: 12.5px;
}
.toolbar-search { width: 160px; }
.toolbar-reason { width: 185px; }

.table-scroll { overflow-x: auto; }
.sheet-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.sheet-table thead th {
  padding: 9px 10px;
  background: linear-gradient(#edf3f9, #e5edf5);
  color: #3d5771;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.sheet-table tbody td, .sheet-table tbody th {
  padding: 7px 10px;
  border-bottom: 1px solid #e5edf4;
  vertical-align: middle;
}
.sheet-table tbody tr:hover { background: #f5f9fe; }
.sheet-table tbody tr.row-dirty { background: #eaf4ff; }
.sheet-table tbody tr.row-conflict { background: #fff0f0; }
.sheet-table tbody tr.row-issue td:first-child { box-shadow: inset 3px 0 #c94a4a; }
.col-idx { width: 38px; color: var(--faint); text-align: center; }
.col-cat { width: 105px; white-space: nowrap; }
.col-title { min-width: 210px; }
.col-state { width: 112px; white-space: nowrap; }
.col-user { width: 136px; }
.col-date { width: 146px; }
.col-act { width: 122px; white-space: nowrap; }

.task-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  text-decoration: none;
}
.task-link:hover strong { color: var(--accent); text-decoration: underline; }
.cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.empty-cell { text-align: center; padding: 26px 14px; color: var(--subtle); }

/* Inline spreadsheet inputs */
.sheet-cell {
  width: 100%;
  min-width: 96px;
  height: 30px;
  padding: 2px 7px;
  border: 1px solid #c5d4e3;
  border-radius: 5px;
  background: #ffffff;
  font-size: 12.5px;
  color: var(--ink);
}
.sheet-cell:hover { border-color: #7ea3c4; }
.sheet-cell:focus { border-color: #185788; background: #fbfdff; }
.sheet-cell.is-empty { background: #fffaf0; border-color: #e4c992; }
.row-conflict select[name^="reviewer_"] { border-color: #cf3d3d; background: #fff5f5; }
.row-btn-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

/* Compact management forms & 2-col grids */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
  margin-top: 16px;
  align-items: start;
}
.confirm-card { border-color: #9ec0df; }
.compact-form { display: grid; gap: 10px; }
.compact-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.compact-form input:not([type="checkbox"]):not([type="hidden"]),
.compact-form select,
.compact-form textarea {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #bfcedd;
  border-radius: 6px;
  background: #ffffff;
  font-size: 13px;
}
.compact-form button.btn { justify-self: start; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.checkbox-line { display: flex !important; flex-direction: row; align-items: center; gap: 7px; font-weight: 500 !important; }

.task-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  gap: 16px;
  margin-top: 14px;
  align-items: start;
}
.col-stack { display: grid; gap: 14px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.info-rows { display: grid; gap: 6px; font-size: 13px; }
.log-stack { display: grid; gap: 6px; }

/* Inline edit popover on project_fields */
.inline-edit { position: relative; }
.inline-edit > summary { list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-popover {
  margin-top: 8px;
  padding: 12px;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faff;
}

/* Legacy / Shared Elements (members.html, evidence.html, demo, notice, etc.) */
.intro { margin-bottom: 16px; display: grid; gap: 6px; justify-items: start; }
.overview {
  border: 1px solid #c2d4e6;
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  background: linear-gradient(115deg, #e0edfa, #f6faff 68%, #dce7f2);
  box-shadow: var(--metal-edge);
}
.navigation { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 12px; }
.navigation a { padding: 6px 12px; border-radius: 7px; text-decoration: none; color: var(--subtle); }
.navigation a:hover, .navigation a[aria-current="page"] { background: var(--mint); color: var(--accent); }
.navigation a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -2px #3f7fae; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--metal-edge);
}
.tile:hover { border-color: #7ea3c4; background: #f7fbff; }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; }
.tile strong { font-size: 15px; }
.tile-description { color: var(--subtle); font-size: 13px; }
.tile-icon { display: grid; place-items: center; border-radius: 8px; width: 38px; height: 38px; background: var(--mint); color: var(--accent); font-weight: 700; }
.tile-action { margin-top: auto; padding-top: 6px; color: var(--accent); font-size: 12.5px; font-weight: 600; }
.tile[hidden] { display: none; }

.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; padding: 14px 18px; }
.details dt { font-size: 12px; color: var(--subtle); }
.details dd { margin: 4px 0 0; font-weight: 650; overflow-wrap: anywhere; }

.access-list { list-style: none; margin: 0; padding: 0; }
.access-list li { display: grid; grid-template-columns: 1.3fr 1fr 1.1fr; align-items: center; gap: 12px; padding: 12px 18px; }
.access-list li + li { border-top: 1px solid var(--line-soft); }
.account { display: grid; gap: 2px; overflow-wrap: anywhere; }
.account span { color: var(--subtle); font-size: 12px; }
.role { color: var(--accent); font-weight: 550; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.form-error { color: #a62b2b; }

.project-form { max-width: 44rem; padding: 18px; display: grid; gap: 12px; }
.project-form label { display: grid; gap: 5px; font-weight: 600; }
.project-form input:not([type="hidden"]) { border: 1px solid #b5c6d8; border-radius: 6px; padding: 8px 10px; width: 100%; background: #fff; }
.project-form small { font-weight: 400; color: var(--subtle); }

.proj-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.proj-nav a, .proj-list a { color: var(--accent); }
.section-head { margin-top: 18px; }
.proj-list, .proj-form, .proj-notice, .proj-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 10px 0;
  padding: 14px 16px;
  box-shadow: var(--metal-edge);
}
.proj-list a { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); padding: 10px 0; text-decoration: none; }
.proj-list a:last-child { border: 0; }
.proj-list span, .proj-log { color: var(--subtle); font-size: 12.5px; }
.proj-form summary { color: var(--accent); font-weight: 650; cursor: pointer; }
.proj-form form, form.proj-form, .proj-form label { display: grid; gap: 7px; max-width: 52rem; }
.proj-form input, .proj-form select, .proj-form textarea { padding: 7px 10px; border: 1px solid #bfcedd; border-radius: 6px; background: #fff; }
.proj-form button { background: linear-gradient(#2675ae, #185788); color: #fff; border: 1px solid #16517f; border-radius: 7px; padding: 7px 14px; cursor: pointer; justify-self: start; }
.proj-table { overflow-x: auto; padding: 0; }
.proj-table table { width: 100%; text-align: left; border-collapse: collapse; }
.proj-table th, .proj-table td { padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.proj-table thead th { background: linear-gradient(#edf3f9, #e5edf5); color: #3d5771; font-size: 12px; }
.proj-log { padding: 6px 10px; border: 1px solid var(--line-soft); border-radius: 7px; background: #fafdff; }
.proj-log summary { cursor: pointer; }
.proj-log pre, .nested-log pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 6px 0 0; color: var(--text); background: #f2f6fb; padding: 8px 10px; border-radius: 6px; }
.proj-notice { border-inline-start: 4px solid var(--accent); }
.reference-frame { width: 100%; height: min(82dvh, 960px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: #f0f4f8; }

@media (max-width: 960px) {
  .task-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 1.2rem); }
  .top-nav { display: none; }
  .page-hero { padding: 13px 14px; }
  .form-row-2 { grid-template-columns: 1fr; }
  .access-list li { grid-template-columns: 1fr 1fr; gap: 4px 10px; }
  .access-list li .account { grid-column: 1 / -1; }
  .toolbar-search, .toolbar-reason { width: 100%; }
}
