/* ==========================================================================
   需求黑板 · RHINE LAB INDUSTRIAL ARCHIVE OS
   暖实验纸底 (#e7e5e1) · 象牙白档案卡 (#f6f5f2) · 高对比黑墨块 (#111214)
   莱茵警示橙 (#ff7b00) · 信号青柠绿 (#b9e432) · 零圆角工程排版
   ========================================================================== */

:root {
  color-scheme: light;

  --orange: #ff7b00;
  --orange-deep: #d95700;
  --orange-tint: rgba(255, 123, 0, 0.11);
  --lime: #b9e432;
  --lime-ink: #476100;
  --lime-tint: rgba(185, 228, 50, 0.24);

  --paper: #e7e5e1;
  --card: #f6f5f2;
  --tab: #dedcd6;
  --recess: #dfddd8;
  --input-bg: #ffffff;

  --ink: #111214;
  --ink-2: #2d2f33;
  --ink-inverse: #f2f0eb;
  --mute: #75726c;
  --faint: #c6c3bc;
  --line: rgba(17, 18, 20, 0.13);
  --line-strong: rgba(17, 18, 20, 0.30);

  --slab-bg: #111214;
  --slab-bg-2: #1d1e20;
  --slab-ink: #f2f0eb;
  --slab-mute: #8e8c86;

  --accent: var(--lime);
  --bevel-top: rgba(255, 255, 255, 0.85);
  --watermark: rgba(17, 18, 20, 0.048);
  --grid-dot: rgba(17, 18, 20, 0.065);
  --shadow-card: 0 8px 22px -12px rgba(44, 36, 24, 0.20);
  --shadow-panel: 12px 20px 48px rgba(59, 50, 38, 0.18);

  --display: "Montserrat", "Bahnschrift", "DIN Alternate", "Segoe UI", "MiSans", "Microsoft YaHei UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  --cjk: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --orange-deep: #ff942e;
  --orange-tint: rgba(255, 123, 0, 0.14);
  --lime-ink: #b9e432;
  --lime-tint: rgba(185, 228, 50, 0.14);

  --paper: #0b0b0c;
  --card: #141517;
  --tab: #1d1e21;
  --recess: #0f1012;
  --input-bg: #0c0d0f;

  --ink: #f2f0eb;
  --ink-2: #cbc8c1;
  --ink-inverse: #111214;
  --mute: #87847d;
  --faint: #2b2c30;
  --line: rgba(242, 240, 235, 0.13);
  --line-strong: rgba(242, 240, 235, 0.30);

  --slab-bg: #1a1b1e;
  --slab-bg-2: #24262a;
  --slab-ink: #f2f0eb;
  --slab-mute: #8e8c86;

  --accent: var(--orange);
  --bevel-top: rgba(255, 255, 255, 0.10);
  --watermark: rgba(242, 240, 235, 0.04);
  --grid-dot: rgba(242, 240, 235, 0.05);
  --shadow-card: 0 10px 26px -12px rgba(0, 0, 0, 0.65);
  --shadow-panel: 0 24px 60px rgba(0, 0, 0, 0.72);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: 240px 100%;
  background-position: 72px 0;
  color: var(--ink);
  font-family: var(--cjk);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--orange);
  color: #111214;
}

.hidden {
  display: none !important;
}

/* ---------- Icons & Micro Marks ---------- */
.i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vertical-align: middle;
}

.i-muted {
  color: var(--mute);
}

.i-arrow-svg,
.i-arrow-sm {
  fill: var(--orange);
  flex-shrink: 0;
  transition: fill 0.15s var(--ease), transform 0.15s var(--ease);
}

.i-arrow-svg {
  width: 16px;
  height: 12px;
}

.i-arrow-sm {
  width: 13px;
  height: 10px;
}

.sq {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--ink);
  flex-shrink: 0;
}

.sq-sm {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--ink);
  flex-shrink: 0;
}

.lime-sq {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--lime);
  border: 1px solid rgba(17, 18, 20, 0.25);
  flex-shrink: 0;
}

:root[data-theme="dark"] .lime-sq {
  border-color: transparent;
}

.slot-bar {
  display: inline-block;
  width: 96px;
  height: 8px;
  background: var(--card);
  border: 1px solid var(--faint);
  flex-shrink: 0;
}

.solid-tag {
  display: inline-flex;
  align-items: center;
  background: var(--ink);
  color: var(--ink-inverse);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  padding: 3px 7px;
  line-height: 1.1;
  white-space: nowrap;
}

.solid-tag-sm {
  display: inline-flex;
  align-items: center;
  background: var(--ink);
  color: var(--ink-inverse);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  line-height: 1.1;
  margin-right: 4px;
}

.outline-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  line-height: 1.1;
  white-space: nowrap;
}

/* Registration Crosshairs (+) */
.tick {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 3;
}

.tick::before,
.tick::after {
  content: "";
  position: absolute;
  background: var(--line-strong);
}

.tick::before {
  left: 6.5px;
  top: 0;
  width: 1px;
  height: 14px;
}

.tick::after {
  top: 6.5px;
  left: 0;
  height: 1px;
  width: 14px;
}

.tick-tr { right: -7px; top: -7px; }
.tick-bl { left: -7px; bottom: -7px; }
.tick-br { right: -7px; bottom: -7px; }

/* Signature Orange Signal Dots */
.orange-signal-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.orange-signal-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.orange-signal-dots .dot-link {
  position: relative;
  width: 18px;
  height: 7px;
  display: inline-flex;
  align-items: center;
}

.orange-signal-dots .dot-link::before {
  content: "";
  width: 11px;
  height: 1.5px;
  background: var(--orange);
}

.orange-signal-dots .dot-link::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--orange);
}

kbd {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--faint);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--mute);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--faint);
  border-radius: 0;
  padding: 8px 11px;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.14s var(--ease), box-shadow 0.18s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--mute);
  opacity: 0.72;
}

input[type="text"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='%2375726c'%3E%3Cpath d='M2 4l4 5 4-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

select option,
select optgroup {
  background: var(--card);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.input-lg {
  font-size: 15px !important;
  padding: 10px 12px !important;
  font-weight: 600;
}

input[type="checkbox"] {
  accent-color: var(--orange);
  border-radius: 0;
}

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ==========================================================================
   Buttons (Zero-Radius Industrial Tactile)
   ========================================================================== */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-icon,
.btn-square-icon,
.btn-danger-text,
.btn-action-cta,
.btn-action-ghost {
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.1s var(--ease);
}

.btn-primary:active,
.btn-secondary:active,
.btn-action-cta:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--ink-inverse);
  border: 1px solid var(--ink);
  padding: 8px 14px;
  letter-spacing: 0.04em;
}

.btn-primary:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

.btn-primary:hover .i-arrow-sm,
.btn-primary:hover .i-arrow-svg {
  fill: #111214;
  transform: translateX(2px);
}

.btn-secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 7px 12px;
}

.btn-secondary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-inverse);
}

.btn-ghost {
  background: transparent;
  color: var(--mute);
  border: 1px solid transparent;
  padding: 6px 10px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--tab);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-sm .i {
  width: 13px;
  height: 13px;
}

.btn-icon {
  background: transparent;
  color: var(--mute);
  border: 1px solid transparent;
  width: 32px;
  height: 32px;
  padding: 0;
}

.btn-icon:hover {
  color: var(--ink);
  background: var(--tab);
  border-color: var(--line);
}

.btn-square-icon {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--faint);
  color: var(--ink);
}

.btn-square-icon:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-inverse);
}

.btn-danger-text {
  background: transparent;
  border: 1px solid transparent;
  color: var(--orange-deep);
  padding: 5px 10px;
  font-size: 12px;
}

.btn-danger-text:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

/* Action bar buttons (sit inside dark #111214 slabs) */
.btn-action-cta {
  background: var(--orange);
  color: #111214;
  border: 1px solid var(--orange);
  padding: 8px 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.btn-action-cta:hover {
  background: var(--lime);
  border-color: var(--lime);
  color: #111214;
}

.btn-action-ghost {
  background: transparent;
  color: #f2f0eb;
  border: 1px solid rgba(242, 240, 235, 0.35);
  padding: 7px 12px;
}

.btn-action-ghost:hover {
  background: #f2f0eb;
  color: #111214;
  border-color: #f2f0eb;
}

/* ==========================================================================
   Shared Primitives
   ========================================================================== */
.role-dot {
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--role-color, var(--mute));
  flex-shrink: 0;
}

/* Square industrial member badge (replaces soft circle avatar) */
.op-avatar {
  --size: 28px;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--size) * 0.44);
  font-weight: 700;
  line-height: 1;
  background: var(--ink);
  color: var(--ink-inverse);
  border-bottom: 3px solid var(--role-color, var(--orange));
  user-select: none;
}

.op-avatar-sm {
  --size: 24px;
  border-bottom-width: 2px;
}

.op-avatar.is-online::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 7px;
  height: 7px;
  background: var(--lime);
  border: 1.5px solid var(--card);
}

.muted-text {
  font-size: 12px;
  color: var(--mute);
}

.mono-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--mute);
  letter-spacing: 0.02em;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--orange);
  color: #111214;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

.badge-float {
  position: absolute;
  top: -6px;
  right: -6px;
  border: 1.5px solid var(--card);
}

/* Tags (Sharp Technical Badges) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border: 1px solid var(--faint);
  background: var(--paper);
  color: var(--ink-2);
  white-space: nowrap;
}

.tag-danger {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

.tag-warn {
  background: var(--orange-tint);
  border-color: var(--orange);
  color: var(--orange-deep);
}

.tag-ok {
  background: var(--lime-tint);
  border-color: var(--lime-ink);
  color: var(--lime-ink);
}

.tag-accent {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-inverse);
}

.tag-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
}

.mention-highlight {
  color: var(--orange-deep);
  font-weight: 700;
  background: var(--orange-tint);
  padding: 0 3px;
}

/* ==========================================================================
   Auth Gate (Rhine Lab Personnel Access Terminal)
   ========================================================================== */
.auth-gate {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 40px 22px;
  background-color: var(--paper);
  background-image:
    radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow-x: hidden;
}

.auth-vline {
  position: fixed;
  left: 24%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
  opacity: 0.45;
  pointer-events: none;
}

.auth-edge-bar {
  position: fixed;
  left: 0;
  top: 34%;
  width: 7px;
  height: 168px;
  background: var(--ink);
  pointer-events: none;
}

.auth-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.rhine-lockup {
  display: inline-flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--display);
  line-height: 1;
}

.rl-l1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.rl-l2 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.25em;
  margin-top: 5px;
  color: var(--ink-2);
}

.rl-l3 {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 3px;
  font-size: 24px;
  letter-spacing: 0.06em;
}

.rl-light {
  font-weight: 300;
}

.rl-bold {
  font-weight: 800;
}

.auth-clock-block {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.clock-readout {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.clock-readout sup {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  margin-left: 4px;
  vertical-align: top;
}

.clock-date {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}

.clock-node {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  color: var(--mute);
}

.auth-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1080px;
  margin: 24px auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 560px);
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.auth-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.aside-slab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.aside-tag {
  background: var(--ink);
  color: var(--ink-inverse);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 7px;
}

.aside-copy {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--mute);
}

.aside-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--mute);
}

.aside-log li::before {
  content: "· ";
  color: var(--orange);
  font-weight: 700;
}

.aside-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--faint);
  font-size: 11px;
  color: var(--mute);
}

.auth-panel-wrap {
  position: relative;
  width: 100%;
}

.auth-rear {
  position: absolute;
  inset: 0;
  transform: translate(14px, -14px);
  background: transparent;
  border: 1px solid var(--line-strong);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--bevel-top);
  padding: 24px 26px 22px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  animation: slide-in 0.35s var(--ease) both;
}

.auth-hex {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 58%;
  height: 55%;
  opacity: 0.32;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='42' viewBox='0 0 48 42'%3E%3Cpath d='M12 1h24l12 20-12 20H12L0 21z' fill='none' stroke='%238b8882' stroke-width='0.9' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 44px 38px;
  -webkit-mask-image: linear-gradient(120deg, transparent 20%, #000 85%);
  mask-image: linear-gradient(120deg, transparent 20%, #000 85%);
}

.auth-watermark {
  position: absolute;
  right: -8px;
  top: -18px;
  font-family: var(--display);
  font-size: 92px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--watermark);
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.auth-card-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-tags-l {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.auth-tags-r {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.auth-title-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-title-bar {
  display: inline-flex;
  align-items: center;
  background: var(--ink);
  color: var(--ink-inverse);
  padding: 8px 22px 8px 16px;
}

.auth-title-bar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.auth-state-box {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--mute);
  border: 1px solid var(--faint);
  padding: 4px 8px;
}

.auth-form {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.role-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.role-pick-btn {
  appearance: none;
  position: relative;
  background: var(--input-bg);
  border: 1px solid var(--faint);
  padding: 10px 8px 9px;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  transition: all 0.14s var(--ease);
}

.role-pick-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--role-color);
  opacity: 0.45;
  transition: opacity 0.14s var(--ease);
}

.role-pick-code {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  color: var(--mute);
}

.role-pick-label {
  font-size: 14px;
  font-weight: 700;
}

.role-pick-btn:hover {
  border-color: var(--ink);
}

.role-pick-btn:hover::before {
  opacity: 1;
}

.role-pick-btn.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-inverse);
}

.role-pick-btn.selected::before {
  opacity: 1;
}

.role-pick-btn.selected .role-pick-code {
  color: var(--lime);
}

:root[data-theme="dark"] .role-pick-btn.selected .role-pick-code {
  color: #d95700;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--mute);
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--orange-deep);
  background: var(--orange-tint);
  border: 1px solid var(--orange);
  border-left: 4px solid var(--orange);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  animation: shake 0.3s var(--ease);
}

.auth-submit-slab {
  display: flex;
  align-items: stretch;
  background: #111214;
  border-bottom: 3px solid var(--accent);
  margin-top: 2px;
}

.auth-submit-meta {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #8e8c86;
}

.btn-rhine-submit {
  appearance: none;
  border: none;
  margin: 5px;
  min-width: 148px;
  padding: 12px 18px;
  background: #222427;
  color: #f2f0eb;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.btn-rhine-submit:hover {
  background: var(--orange);
  color: #111214;
}

.btn-rhine-submit:hover .i-arrow-svg {
  fill: #111214;
  transform: translateX(3px);
}

.auth-foot {
  position: relative;
  z-index: 2;
  margin: 14px 0 0;
  font-size: 11.5px;
  color: var(--mute);
}

.auth-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}

.auth-footer-l,
.auth-footer-r {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-bar {
  width: 30px;
  height: 8px;
  background: var(--ink);
}

.footer-dash {
  width: 16px;
  height: 3px;
  background: var(--ink);
}

.footer-sep {
  width: 1px;
  height: 12px;
  background: var(--faint);
}

.footer-action {
  appearance: none;
  background: transparent;
  border: none;
  padding: 2px 4px;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  cursor: pointer;
}

.footer-action:hover {
  color: var(--orange);
}

/* ==========================================================================
   App Shell & Topbar
   ========================================================================== */
.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  height: 54px;
  padding: 0 20px 0 0;
  background: var(--card);
  border-bottom: 1px solid var(--faint);
  box-shadow: 0 2px 10px -6px rgba(17, 18, 20, 0.14);
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-left {
  align-items: stretch;
  gap: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 16px;
  border-right: 1px solid var(--faint);
  border-left: 5px solid var(--ink);
  flex-shrink: 0;
}

.brand-box {
  position: relative;
  width: 24px;
  height: 24px;
  background: var(--ink);
  display: inline-block;
  flex-shrink: 0;
}

.brand-box::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1.5px solid var(--ink-inverse);
}

.brand-box-pip {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  background: var(--orange);
}

.brand-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.brand-code {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--mute);
  margin-top: 2px;
}

.nav-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.nav-tab {
  appearance: none;
  position: relative;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--mute);
  padding: 0 18px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.nav-idx {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--mute);
  opacity: 0.7;
}

.nav-tab:hover {
  color: var(--ink);
  background: var(--paper);
}

.nav-tab.active {
  color: var(--ink);
  background: var(--paper);
}

.nav-tab.active .nav-idx {
  color: var(--orange);
  opacity: 1;
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--ink);
}

.nav-tab.active::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 22px;
  height: 3px;
  background: var(--orange);
  z-index: 1;
}

.tab-count {
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--tab);
  border: 1px solid var(--faint);
}

.nav-tab.active .tab-count {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--lime);
}

:root[data-theme="dark"] .nav-tab.active .tab-count {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

.identity-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 0;
  border: 1px solid var(--faint);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 230px;
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.identity-btn:hover {
  border-color: var(--ink);
  background: var(--paper);
}

.op-code-badge {
  height: 100%;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--ink-inverse);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-bottom: 3px solid var(--role-color, var(--orange));
  flex-shrink: 0;
}

.identity-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Page 1 · 需要我处理
   ========================================================================== */
.page-mine {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 56px;
}

.mine-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Dossier Header */
.dossier-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}

.dossier-head-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.dossier-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}

.dossier-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.dossier-op-slab {
  display: inline-flex;
  align-items: center;
  background: var(--ink);
  color: var(--ink-inverse);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 16px 6px 14px;
  border-left: 4px solid var(--role-color, var(--orange));
}

.dossier-telemetry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tele-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  background: var(--card);
  border: 1px solid var(--faint);
  font-size: 12px;
  color: var(--mute);
}

.tele-chip b {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.tele-chip.is-hot {
  border-color: var(--orange);
  background: var(--orange-tint);
  color: var(--orange-deep);
}

.tele-chip.is-hot b {
  color: var(--orange-deep);
}

.dossier-sub {
  font-size: 12.5px;
  color: var(--mute);
}

.dossier-sub b {
  color: var(--ink);
  font-weight: 700;
}

.dossier-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.dossier-clock {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
  margin-top: 2px;
}

.dossier-clock sup {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  margin-left: 3px;
  vertical-align: top;
}

.dossier-date {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mute);
}

/* Status Bar */
.my-status-bar {
  display: grid;
  grid-template-columns: auto 136px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  background: var(--card);
  border: 1px solid var(--faint);
  border-left: 4px solid var(--ink);
  box-shadow: var(--shadow-card);
}

.my-status-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  padding-right: 4px;
  white-space: nowrap;
}

.inline-state-select,
.inline-focus-input {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

.mine-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-head h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.sec-en {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--mute);
}

.section-count {
  min-width: 22px;
  height: 19px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--ink);
  color: var(--ink-inverse);
}

/* Issue Cards */
.issue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.issue-row {
  --strip: var(--ink);
  position: relative;
  background: var(--card);
  border: 1px solid var(--faint);
  border-left: 4px solid var(--strip);
  padding: 14px 16px 14px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.14s var(--ease), transform 0.14s var(--ease), box-shadow 0.16s var(--ease);
}

.issue-row:hover {
  border-color: var(--ink);
  transform: translateX(3px);
}

.issue-row.is-in-progress {
  --strip: var(--lime-ink);
}

:root[data-theme="dark"] .issue-row.is-in-progress {
  --strip: var(--lime);
}

.issue-row.is-urgent,
.issue-row.is-blocked {
  --strip: var(--orange);
}

.issue-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.issue-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.issue-id {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--mute);
  letter-spacing: 0.04em;
}

.issue-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.issue-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

/* Signature Rhine Warning Banner (Black slab + Orange text/border) */
.issue-blocker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--orange);
  padding: 6px 10px;
  background: #111214;
  border-left: 3px solid var(--orange);
}

.issue-blocker .i {
  width: 14px;
  height: 14px;
  color: var(--orange);
}

.issue-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--mute);
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.issue-meta > span,
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.issue-meta .i,
.meta-item .i {
  width: 13px;
  height: 13px;
}

.meta-source {
  color: var(--ink-2);
  font-weight: 500;
}

.issue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}

/* Compact secondary dossier table */
.compact-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--faint);
  background: var(--card);
}

.compact-row {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.12s var(--ease);
}

.compact-row + .compact-row {
  border-top: 1px solid var(--line);
}

.compact-row:hover {
  background: var(--paper);
}

.compact-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.compact-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--mute);
}

#done-list .compact-title {
  color: var(--mute);
  text-decoration: line-through;
}

.done-check {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--slab-bg);
  color: var(--lime);
  flex-shrink: 0;
}

.done-check .i {
  width: 10px;
  height: 10px;
  stroke-width: 3;
}

.empty-box {
  padding: 36px 20px;
  text-align: center;
  color: var(--mute);
  border: 1px dashed var(--line-strong);
  background: var(--card);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

.empty-box::before {
  content: "■ STATUS: CLEAR";
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.collapse-toggle {
  appearance: none;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 6px 4px 0;
  cursor: pointer;
}

.collapse-toggle .i {
  width: 14px;
  height: 14px;
  transition: transform 0.16s var(--ease);
}

.collapse-toggle:hover {
  color: var(--ink);
}

#done-section:has(#done-list:not(.hidden)) .collapse-toggle .i {
  transform: rotate(90deg);
}

/* ==========================================================================
   Page 2 · 全队进度 (4-Division Matrix)
   ========================================================================== */
.page-team {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 18px;
  gap: 12px;
}

.team-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-toolbar-l {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 32px;
  height: 16px;
  background: var(--tab);
  border: 1px solid var(--line-strong);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--ink);
  transition: transform 0.16s var(--ease), background-color 0.15s var(--ease);
}

.switch-row input:checked + .switch {
  background: var(--ink);
  border-color: var(--ink);
}

.switch-row input:checked + .switch::after {
  transform: translateX(16px);
  background: var(--lime);
}

.team-mobile-tabs {
  display: none;
}

.team-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(256px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.team-col {
  --role-color: var(--orange);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--faint);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.team-col.drag-over {
  border-color: var(--orange);
  box-shadow: inset 0 0 0 2px var(--orange);
}

.team-col-head {
  border-bottom: 1px solid var(--faint);
  display: flex;
  flex-direction: column;
}

.team-col-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: var(--slab-bg);
  color: var(--slab-ink);
  border-top: 3px solid var(--role-color);
  border-bottom: 1px solid var(--line);
}

.team-col-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.04em;
}

.team-col-code {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--role-color);
  letter-spacing: 0.10em;
}

.team-col-head-meta {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.65;
}

.team-col-count {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--role-color);
  color: #111214;
}

.team-col-members {
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.team-member-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  transition: background-color 0.12s var(--ease);
}

.team-member-row + .team-member-row {
  border-top: 1px solid var(--line);
}

.team-member-row:hover {
  background: var(--card);
}

.team-member-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-member-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
}

.team-member-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  min-width: 0;
}

.team-member-name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member-name .tag {
  padding: 2px 5px;
  font-size: 10px;
}

.team-member-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  white-space: nowrap;
}

.state-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--state-color, var(--mute));
}

.state-working { --state-color: var(--lime-ink); color: var(--lime-ink); }
.state-waiting { --state-color: #c28000; color: #a36a00; }
.state-blocked { --state-color: var(--orange); color: var(--orange-deep); }
.state-away { --state-color: var(--mute); }

:root[data-theme="dark"] .state-waiting { --state-color: #f0b429; color: #f0b429; }

.team-col-focus {
  font-size: 12px;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-col-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(var(--grid-dot) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--recess);
}

.team-empty {
  margin: auto 0;
  padding: 24px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--mute);
  letter-spacing: 0.06em;
}

.team-card {
  position: relative;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--faint);
  border-left: 3px solid var(--role-color);
  padding: 10px 11px;
  cursor: pointer;
  transition: border-color 0.14s var(--ease), transform 0.12s var(--ease);
}

.team-card[draggable="true"] {
  cursor: grab;
}

.team-card[draggable="true"]:active {
  cursor: grabbing;
}

.team-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.team-card.is-blocked {
  border-left: 3px solid var(--orange);
  border-color: var(--orange);
}

.team-card.is-done {
  opacity: 0.55;
}

.team-card.is-done .team-card-title {
  text-decoration: line-through;
}

.team-card.dragging {
  opacity: 0.35;
}

.team-card-title {
  margin: 0 0 7px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
  word-break: break-word;
}

.team-card-blocker {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--orange);
  background: #111214;
  padding: 4px 7px;
  margin-bottom: 8px;
}

.team-card-blocker .i {
  width: 12px;
  height: 12px;
  margin-top: 2px;
}

.team-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--mute);
}

.team-card-meta-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.team-card-meta .tag {
  padding: 2px 6px;
  font-size: 10.5px;
}

.team-card-meta-left .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
}

.team-card-meta-left .meta-item .i {
  width: 12px;
  height: 12px;
}

.team-card-time {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--mute);
}

.dm-link-btn {
  appearance: none;
  border: 1px solid var(--faint);
  background: var(--card);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.12s var(--ease);
}

.team-member-row:hover .dm-link-btn,
.dm-link-btn:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .dm-link-btn {
    opacity: 1;
  }
}

.dm-link-btn:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

/* ==========================================================================
   Page 3 · 团队对话 (COMMS TERMINAL)
   ========================================================================== */
.page-chat {
  flex: 1;
  min-height: 0;
  padding: 14px 20px 18px;
  display: flex;
}

.chat-shell {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--card);
  border: 1px solid var(--faint);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--faint);
  padding: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  background: var(--paper);
}

.chat-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.chat-side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.chat-side-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--mute);
  padding: 2px 8px 6px;
}

.chat-channel-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-channel-btn {
  appearance: none;
  position: relative;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  padding: 8px 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: all 0.12s var(--ease);
}

.chat-channel-btn:hover {
  background: var(--card);
  color: var(--ink);
}

.chat-channel-btn.active {
  background: var(--slab-bg);
  color: var(--slab-ink);
  font-weight: 700;
}

.chat-channel-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--orange);
}

.chat-channel-btn.active .muted-text {
  color: var(--lime);
}

.chat-channel-btn.active .op-avatar {
  background: #25272b;
  color: #f2f0eb;
}

.chat-channel-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.chat-channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-avatar {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--orange);
  color: #111214;
}

.group-avatar .i {
  width: 13px;
  height: 13px;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat-head {
  flex-shrink: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card);
}

.chat-head-title {
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  background:
    radial-gradient(var(--grid-dot) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--recess);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 76%;
  align-self: flex-start;
  flex-shrink: 0;
}

.chat-row.is-mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chat-row.is-mine .chat-bubble-wrap {
  align-items: flex-end;
}

.chat-msg {
  flex-shrink: 0;
  max-width: 100%;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--faint);
  border-left: 3px solid var(--author-color);
  padding: 9px 13px;
  box-shadow: var(--shadow-card);
}

.chat-row.is-mine .chat-msg {
  background: var(--slab-bg);
  color: var(--slab-ink);
  border: 1px solid var(--slab-bg);
  border-left: 1px solid var(--slab-bg);
  border-right: 3px solid var(--accent);
}

.chat-row.is-mine .chat-msg .mention-highlight {
  color: var(--orange);
  background: rgba(255, 123, 0, 0.18);
}

.chat-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
}

.chat-row.is-mine .chat-msg-head {
  flex-direction: row-reverse;
}

.chat-msg-author {
  font-weight: 700;
  color: var(--ink);
}

.chat-msg-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--mute);
}

.chat-msg-body {
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg .comment-img {
  margin-top: 6px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 12px;
}

.chat-empty::before {
  content: "■ CHANNEL IDLE";
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.chat-composer {
  flex-shrink: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--faint);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
}

.composer-box {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--input-bg);
  border: 1px solid var(--faint);
  transition: border-color 0.14s var(--ease), box-shadow 0.18s var(--ease);
}

.composer-box:focus-within {
  border-color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.composer-box textarea {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  resize: none;
  padding: 10px 12px 4px;
  font-size: 13.5px;
}

.composer-box .comment-paste-preview {
  padding: 10px 12px 0;
}

.composer-tools {
  padding: 6px 8px 8px;
}

.composer-tools-l {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mention-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.mention-chip {
  appearance: none;
  border: 1px solid var(--faint);
  background: var(--paper);
  color: var(--ink-2);
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s var(--ease);
}

.mention-chip:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-inverse);
}

.comment-paste-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-paste-preview img {
  height: 50px;
  border: 1px solid var(--faint);
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 18, 20, 0.56);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: min(560px, 94vw);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--ink);
  border-top: 4px solid var(--ink);
  box-shadow: var(--shadow-panel);
  animation: slide-in 0.22s var(--ease) both;
}

.modal-head,
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--faint);
  background: var(--card);
}

.modal-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head h2,
.drawer-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.modal-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.blocker-field {
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--faint);
}

.blocker-field:has(input[type="checkbox"]:checked) {
  background: var(--orange-tint);
  border-color: var(--orange);
}

.checkbox-row {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--cjk) !important;
  font-size: 13px !important;
  color: var(--ink) !important;
}

.checkbox-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

.drawer-backdrop {
  justify-content: flex-end;
}

.detail-drawer,
.activity-drawer {
  height: 100vh;
  height: 100dvh;
  background: var(--card);
  border-left: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 50px rgba(17, 18, 20, 0.28);
  animation: drawer-in 0.24s var(--ease) both;
}

.detail-drawer {
  width: min(610px, 100vw);
}

.activity-drawer {
  width: min(410px, 100vw);
}

.drawer-head-left,
.drawer-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.drawer-head-left .mono-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-chip {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--faint);
  padding: 2px 7px;
  white-space: nowrap;
}

.meta-chip-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-inverse);
}

.meta-chip-accent {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

.drawer-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-block.drag-active {
  outline: 2px dashed var(--orange);
  outline-offset: 6px;
  background: var(--orange-tint);
}

.comments-block {
  border-bottom: none;
}

.block-title {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.detail-title-input {
  font-size: 17px !important;
  font-weight: 700;
}

/* Signature Dark Action Slab inside Drawer */
.action-bar,
.action-bar-col {
  background: #111214;
  color: #f2f0eb;
  padding: 14px 16px;
  border-bottom: 3px solid var(--lime);
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-bar-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-bar-review {
  border-bottom-color: var(--orange);
}

.action-bar-done {
  border-bottom-color: var(--lime);
}

.action-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: #f2f0eb;
}

.action-bar-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #f2f0eb;
}

.action-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-input-row input {
  flex: 1;
  background: #1d1e21;
  border-color: rgba(242, 240, 235, 0.2);
  color: #f2f0eb;
}

.action-input-row input::placeholder {
  color: #8e8c86;
}

.action-input-row input:focus {
  border-color: var(--orange);
  box-shadow: inset 0 -2px 0 var(--orange);
}

.status-readonly-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--lime-tint);
  border: 1px solid var(--lime-ink);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--lime-ink);
}

.ro-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
  word-break: break-word;
}

.ro-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ro-desc {
  font-size: 14px;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--faint);
}

.handoff-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 8px;
}

/* Attachments */
.attachments-empty {
  padding: 14px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  background: var(--paper);
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.att-item {
  background: var(--paper);
  border: 1px solid var(--faint);
  overflow: hidden;
  transition: border-color 0.14s var(--ease);
}

.att-item:hover {
  border-color: var(--ink);
}

.att-item img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  background: #111214;
}

.att-meta {
  padding: 5px 7px;
  font-size: 11px;
  color: var(--mute);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-del {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.att-del:hover {
  color: #111214;
  background: var(--orange);
}

.attachments-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--faint);
  padding: 8px 10px;
}

.file-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-ext {
  min-width: 40px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-inverse);
  background: var(--ink);
  padding: 0 6px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
}

/* ==========================================================================
   Comments
   ========================================================================== */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 280px;
  min-height: 140px;
  max-height: 60vh;
  overflow-y: auto;
  resize: vertical;
  padding: 12px;
  background:
    radial-gradient(var(--grid-dot) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--recess);
  border: 1px solid var(--faint);
}

.comment-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.comment-item {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--faint);
  border-left: 3px solid var(--author-color);
  padding: 8px 11px;
}

.comment-row.is-system .comment-item {
  background: var(--paper);
  border-style: dashed;
}

.comment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 700;
  color: var(--ink);
}

.comment-kind {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-inverse);
  background: var(--ink);
  padding: 1px 5px;
}

.comment-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--mute);
}

.comment-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-img {
  margin-top: 8px;
  max-width: 100%;
  max-height: 220px;
  border: 1px solid var(--faint);
  cursor: zoom-in;
  display: block;
}

.comment-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comments-empty {
  margin: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--mute);
}

/* ==========================================================================
   Activity Drawer
   ========================================================================== */
.activity-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--faint);
  background: var(--paper);
}

.activity-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--mute);
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.activity-tab:hover {
  color: var(--ink);
}

.activity-tab.active {
  color: var(--ink);
  background: var(--card);
  border-bottom-color: var(--orange);
}

.activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--recess);
}

.activity-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--faint);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.14s var(--ease), transform 0.12s var(--ease);
}

.activity-item:hover {
  border-color: var(--ink);
  transform: translateX(-2px);
}

.activity-item.unread {
  border-left: 4px solid var(--orange);
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-summary {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 4px;
}

.activity-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--mute);
}

.activity-empty {
  margin: auto;
  padding: 36px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
}

/* ==========================================================================
   Lightbox & Toast
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 11, 12, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.lightbox img {
  max-width: 92vw;
  max-height: 80vh;
  border: 1px solid rgba(242, 240, 235, 0.2);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(242, 240, 235, 0.35);
  background: #111214;
  color: #f2f0eb;
  cursor: pointer;
}

.lightbox-close:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #111214;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: #f2f0eb;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 180;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  position: relative;
  pointer-events: auto;
  background: #111214;
  color: #f2f0eb;
  border: 1px solid rgba(242, 240, 235, 0.2);
  border-left: 4px solid var(--orange);
  padding: 11px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  animation: slide-in 0.22s var(--ease) both;
}

.toast::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--lime);
  transform-origin: left;
  animation: toast-timer 4.2s linear both;
}

.toast.is-leaving {
  animation: toast-out 0.22s var(--ease) both;
}

/* ==========================================================================
   Animations (Crisp Mechanical Motion)
   ========================================================================== */
@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes drawer-in {
  from { opacity: 0; transform: translateX(32px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

@keyframes toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  50% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1020px) {
  .auth-stage {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
  .auth-aside,
  .auth-vline,
  .auth-edge-bar {
    display: none;
  }
  .brand-code {
    display: none;
  }
}

@media (max-width: 860px) {
  .btn-label,
  .identity-name,
  .dossier-head-right {
    display: none;
  }
  #btn-new-card {
    width: 36px;
    height: 36px;
    padding: 0;
  }
  .identity-btn {
    padding-right: 6px;
  }
}

@media (hover: none) {
  .issue-row:hover,
  .team-card:hover,
  .activity-item:hover {
    transform: none;
  }
  .nav-tab,
  .role-pick-btn,
  .chat-channel-btn,
  .mention-chip,
  .activity-tab,
  .identity-btn,
  .dm-link-btn,
  .collapse-toggle {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

@media (max-width: 760px) {
  body {
    background-image: none;
  }

  /* Prevent iOS Safari forced zoom on form focus */
  input[type="text"],
  input[type="password"],
  select,
  textarea,
  .composer-box textarea {
    font-size: 16px;
  }
  .input-lg {
    font-size: 16px !important;
  }

  /* Auth Gate */
  .auth-gate {
    padding: max(16px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }
  .auth-topbar {
    flex-direction: column;
    gap: 10px;
  }
  .rl-l1 {
    font-size: 22px;
  }
  .rl-l2 {
    font-size: 9px;
    letter-spacing: 0.16em;
  }
  .rl-l3 {
    font-size: 18px;
  }
  .auth-clock-block,
  .auth-rear,
  .tick,
  .slot-bar {
    display: none;
  }
  .auth-stage {
    margin: 14px auto;
  }
  .auth-card {
    padding: 16px 14px;
  }
  .auth-watermark {
    font-size: 62px;
  }
  .auth-card-head {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }
  .auth-tags-r {
    align-items: flex-start;
  }
  .auth-title-row {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }
  .auth-title-bar {
    padding: 6px 14px 6px 12px;
  }
  .auth-title-bar h1 {
    font-size: 19px;
  }
  .auth-form {
    gap: 12px;
  }
  .role-picker-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .role-pick-btn {
    padding: 10px;
    min-height: 54px;
  }
  .auth-submit-slab {
    flex-direction: column;
  }
  .auth-submit-meta {
    padding: 8px 12px 2px;
  }
  .btn-rhine-submit {
    width: calc(100% - 10px);
    min-height: 46px;
  }
  .auth-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 6px;
  }
  .auth-footer-r {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .footer-action {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 4px 6px;
  }

  /* App Topbar */
  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 0 8px;
    padding: env(safe-area-inset-top) 0 0;
  }
  .topbar-left {
    display: contents;
  }
  .brand {
    order: 1;
    height: 48px;
    border-right: none;
    border-left-width: 4px;
    padding: 0 10px;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .brand-stack {
    min-width: 0;
  }
  .brand-name {
    font-size: 13.5px;
    white-space: nowrap;
  }
  .brand-code {
    display: block;
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8.5px;
    letter-spacing: 0.08em;
  }
  .topbar-right {
    order: 2;
    padding-right: 10px;
    gap: 6px;
    flex-shrink: 0;
  }
  .btn-square-icon,
  #btn-new-card {
    width: 38px;
    height: 38px;
  }
  .identity-btn {
    height: 38px;
    padding-right: 6px;
    gap: 5px;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    height: 44px;
    border-top: 1px solid var(--faint);
  }
  .nav-tab {
    flex: 1;
    justify-content: center;
    padding: 0 4px;
    font-size: 12.5px;
    gap: 4px;
  }
  .nav-tab:last-child {
    border-right: none;
  }
  .nav-idx {
    display: none;
  }

  /* Page 1: 需要我处理 */
  .page-mine {
    padding: 14px 12px calc(36px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mine-container {
    gap: 16px;
  }
  .dossier-header {
    padding-bottom: 12px;
    gap: 12px;
  }
  .dossier-title-line {
    gap: 10px;
  }
  .dossier-op-slab {
    font-size: 17px;
    padding: 4px 12px;
  }
  .tele-chip {
    padding: 3px 8px;
    font-size: 11.5px;
  }
  .my-status-bar {
    grid-template-columns: 1fr auto;
    padding: 10px;
    gap: 8px;
  }
  .my-status-label {
    grid-column: 1;
  }
  .inline-state-select {
    grid-column: 2;
    width: auto;
    min-width: 116px;
  }
  .inline-focus-input {
    grid-column: 1;
    min-width: 0;
  }
  #btn-save-my-status {
    grid-column: 2;
    min-height: 40px;
    padding: 0 14px;
  }
  .section-head {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .issue-row {
    flex-direction: column;
    gap: 10px;
    padding: 12px 12px 12px 14px;
  }
  .issue-title {
    font-size: 15px;
    line-height: 1.4;
  }
  .issue-meta {
    gap: 8px 12px;
    font-size: 11.5px;
  }
  .issue-actions {
    width: 100%;
    align-self: stretch;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }
  .issue-actions .btn-primary,
  .issue-actions .btn-secondary {
    flex: 1;
    min-height: 38px;
    font-size: 13px;
  }
  .compact-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 11px 12px;
  }
  .compact-left {
    width: 100%;
    align-items: flex-start;
  }
  .compact-left .role-dot,
  .compact-left .done-check {
    margin-top: 4px;
  }
  .compact-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
  }
  .compact-right {
    width: 100%;
    justify-content: space-between;
    font-size: 11px;
    padding-left: 18px;
  }
  .field-row-2 {
    grid-template-columns: 1fr;
  }

  /* Page 2: 全队进度 */
  .page-team {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .team-toolbar-l .muted-text {
    display: none;
  }
  .team-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    flex-shrink: 0;
  }
  .team-mobile-tab {
    appearance: none;
    position: relative;
    border: 1px solid var(--faint);
    border-top: 3px solid var(--role-color, var(--ink));
    background: var(--card);
    color: var(--ink-2);
    padding: 7px 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    min-height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease);
  }
  .team-mobile-tab.active {
    background: var(--slab-bg);
    border-color: var(--slab-bg);
    border-top-color: var(--role-color, var(--orange));
    color: var(--slab-ink);
  }
  .team-mobile-tab-count {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 4px;
    background: var(--tab);
    color: var(--ink-2);
  }
  .team-mobile-tab.active .team-mobile-tab-count {
    background: var(--role-color, var(--orange));
    color: #111214;
  }
  .team-columns {
    grid-template-columns: repeat(4, 100%);
    gap: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .team-columns::-webkit-scrollbar {
    display: none;
  }
  .team-col {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
  .team-col-head {
    flex-shrink: 0;
  }
  .team-col-top {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .team-col-body {
    overflow-y: visible;
    flex: 1 0 auto;
  }
  .dm-link-btn {
    padding: 4px 8px;
    min-height: 28px;
    font-size: 11.5px;
  }

  /* Page 3: 团队对话 */
  .page-chat {
    padding: 0;
  }
  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    border: none;
    box-shadow: none;
  }
  .chat-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--faint);
    flex-direction: row;
    overflow-x: auto;
    padding: 7px 8px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chat-sidebar::-webkit-scrollbar {
    display: none;
  }
  .chat-side-head,
  .chat-side-label {
    display: none;
  }
  .chat-side-group {
    flex-shrink: 0;
    padding: 0;
  }
  .chat-channel-list {
    flex-direction: row;
    gap: 6px;
  }
  .chat-channel-btn {
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
    border: 1px solid var(--faint);
    background: var(--card);
    padding: 7px 10px;
    min-height: 36px;
  }
  .chat-channel-btn.active::before {
    display: none;
  }
  .chat-head {
    padding: 9px 12px;
    gap: 6px;
  }
  .chat-head-title {
    font-size: 13.5px;
    min-width: 0;
  }
  .chat-head-title span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-head .mono-sub {
    font-size: 10.5px;
    flex-shrink: 0;
  }
  .chat-messages {
    padding: 12px 10px;
    gap: 11px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .chat-row {
    max-width: 90%;
    gap: 7px;
  }
  .chat-msg {
    padding: 8px 11px;
  }
  .chat-composer {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .mention-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1px;
  }
  .mention-bar::-webkit-scrollbar {
    display: none;
  }
  .mention-chip {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 11.5px;
    min-height: 28px;
  }
  .composer-box textarea {
    padding: 8px 10px 4px;
    min-height: 40px;
    max-height: 120px;
  }
  .composer-tools {
    padding: 4px 6px 6px;
  }
  .composer-tools .btn-ghost,
  .composer-tools .btn-primary {
    min-height: 36px;
    padding: 6px 12px;
  }
  .composer-shortcut {
    display: none;
  }

  /* Modals & Drawers */
  .modal-backdrop {
    align-items: flex-end;
  }
  .modal-card {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    max-height: 92dvh;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-head {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 11px 14px;
  }
  .modal-body {
    padding: 14px 14px 18px;
    gap: 13px;
  }
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary {
    flex: 1;
    min-height: 42px;
  }
  .detail-drawer,
  .activity-drawer {
    width: 100vw;
    border-left: none;
  }
  .drawer-head {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }
  .drawer-head .btn-icon {
    width: 38px;
    height: 38px;
  }
  .drawer-scroll {
    padding: 14px 12px calc(24px + env(safe-area-inset-bottom));
    gap: 14px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .action-bar,
  .action-bar-col {
    padding: 12px;
  }
  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .action-bar .btn-action-cta,
  .action-bar .btn-action-ghost {
    width: 100%;
    min-height: 40px;
  }
  .action-input-row {
    flex-wrap: wrap;
  }
  .action-input-row input {
    flex: 1 0 100%;
  }
  .action-input-row .btn-action-cta,
  .action-input-row .btn-action-ghost {
    flex: 1;
    min-height: 40px;
  }
  .handoff-row {
    grid-template-columns: 1fr;
  }
  .handoff-row #btn-handoff {
    min-height: 40px;
  }
  .attachments-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .file-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .file-row-right {
    width: 100%;
    justify-content: space-between;
  }
  .file-row-right .btn-secondary {
    min-height: 32px;
    padding: 5px 12px;
  }
  .att-del {
    width: 30px;
    height: 30px;
  }
  .comments-list {
    resize: none;
    height: auto;
    min-height: 120px;
    max-height: 46vh;
    max-height: 46dvh;
    padding: 10px;
    overscroll-behavior: contain;
  }
  .activity-tab {
    min-height: 44px;
  }
  .activity-list {
    padding: 10px 10px calc(20px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  /* Lightbox & Toasts */
  .lightbox {
    padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  }
  .lightbox img {
    max-width: 96vw;
    max-height: 74vh;
    max-height: 74dvh;
  }
  .lightbox-close {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    width: 42px;
    height: 42px;
  }
  .lightbox-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    max-width: 100%;
    text-align: center;
  }
  #lightbox-caption {
    word-break: break-all;
    max-width: 100%;
  }
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: none;
  }
}

@media (max-width: 400px) {
  .brand-code {
    max-width: 100px;
  }
  .btn-square-icon,
  #btn-new-card {
    width: 35px;
    height: 35px;
  }
  .identity-btn {
    height: 35px;
  }
  .op-code-badge {
    padding: 0 7px;
    font-size: 10.5px;
  }
  .sec-en {
    display: none;
  }
}
