.manual-panel, .manual-result { display: grid; gap: 12px; margin-top: 18px; min-width: 0; }
.manual-panel textarea, .manual-result textarea { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; font: 13px/1.6 monospace; border: 1px solid #ddd9cd; border-radius: 8px; padding: 12px; }
.manual-panel p, .manual-result p { overflow-wrap: anywhere; }
.manual-panel input { max-width: 100%; min-width: 0; }
.automation-settings input { display: block; max-width: 100%; width: 32rem; padding: 10px; margin: 8px 0; box-sizing: border-box; }
.automation-banner { font-size: .72rem; color: #27634f; overflow-wrap: anywhere; }
@media (max-width: 700px) { .automation-banner { width: 100%; order: 10; } .topbar { flex-wrap: wrap; height: auto !important; } }
:root {
  --ink: #172322;
  --muted: #64716f;
  --paper: #f4f2ec;
  --panel: #fffdf7;
  --line: #ddd9cd;
  --brand: #0d665a;
  --brand-dark: #084a42;
  --accent: #df6a42;
  --soft: #e3efe9;
  --warn: #fff0d7;
  --shadow: 0 12px 34px rgba(30, 50, 46, .08);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; }
body { background: radial-gradient(circle at 85% 0, #dceae4 0, transparent 31rem), var(--paper); }
button, a { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
input { width: 100%; min-width: 0; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font: inherit; }
:focus-visible { outline: 3px solid #ef9d59; outline-offset: 3px; }
h1[tabindex="-1"]:focus { outline: none; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 50; background: #fff; padding: .7rem 1rem; border-radius: .5rem; }
.skip-link:focus { top: 1rem; }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 32px; border-bottom: 1px solid rgba(13,102,90,.14); background: rgba(244,242,236,.86); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: var(--brand); box-shadow: 0 7px 18px rgba(13,102,90,.25); }
.topbar-note { color: var(--muted); font-size: .84rem; }
.menu-button { display: none; border: 1px solid var(--line); background: var(--panel); border-radius: .7rem; padding: .65rem .8rem; }
.topbar-action { border: 1px solid var(--line); border-radius: 9px; padding: .5rem .7rem; color: var(--brand-dark); background: var(--panel); }
.runtime-identity { text-align: right; }

.login-page { width: min(1120px, calc(100% - 48px)); min-height: 100vh; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); align-items: center; gap: clamp(2rem, 8vw, 7rem); padding: 48px 0; }
.login-copy { min-width: 0; }
.login-card { min-width: 0; padding: clamp(24px, 4vw, 36px); border: 1px solid var(--line); border-radius: 22px; background: rgba(255,253,247,.96); box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 .4rem; font-size: 1.5rem; }
.login-form { display: grid; gap: .7rem; margin-top: 1.5rem; }
.login-form label { margin-top: .3rem; font-size: .85rem; font-weight: 750; }
.primary-action { width: 100%; margin-top: .8rem; padding: .82rem 1rem; border: 0; border-radius: 10px; color: #fff; background: var(--brand); font-weight: 800; }
.primary-action:disabled { opacity: .65; cursor: wait; }
.login-outcome { min-height: 1.5em; margin: .2rem 0 0; color: #8d1713; }
.runtime-card { display: inline-flex; max-width: 100%; margin-top: 1.5rem; padding: .7rem 1rem; border-radius: 999px; color: var(--brand-dark); background: var(--soft); overflow-wrap: anywhere; }

.home { max-width: 1220px; margin: 0 auto; padding: 70px 32px 90px; }
.home-hero { max-width: 820px; margin-bottom: 44px; }
.eyebrow { margin: 0 0 .7rem; color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(2.15rem, 5vw, 4.8rem); line-height: 1.04; letter-spacing: -.055em; font-weight: 550; }
.hero-copy { color: var(--muted); font-size: 1.08rem; line-height: 1.75; max-width: 680px; margin: 1.35rem 0 0; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 20px; }
.project-card { display: flex; min-height: 390px; flex-direction: column; padding: 25px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,253,247,.93); box-shadow: var(--shadow); text-decoration: none; transition: transform .18s, border-color .18s; }
.project-card:hover { transform: translateY(-3px); border-color: #94b8ae; }
.card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.project-card h2 { margin: .15rem 0 .55rem; font-size: 1.55rem; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.stage { margin: 1.4rem 0; padding: .85rem 1rem; border-left: 3px solid var(--accent); background: #fbf1e9; border-radius: 0 .7rem .7rem 0; }
.stage small, .next-step small { display: block; color: var(--muted); margin-bottom: .3rem; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 1.4rem; }
.metric { min-width: 0; padding: .8rem .55rem; text-align: center; border-radius: 12px; background: var(--soft); }
.metric strong { display: block; font-size: 1.25rem; }
.metric span { display: block; color: var(--muted); font-size: .73rem; margin-top: .25rem; }
.next-step { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.badge { flex: none; display: inline-flex; align-items: center; padding: .38rem .65rem; border-radius: 999px; font-size: .74rem; font-weight: 750; background: var(--soft); color: var(--brand-dark); }
.badge.attention { background: var(--warn); color: #8a4c09; }
.permission-badge { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; max-width: 100%; padding: .45rem .7rem; border: 1px solid transparent; border-radius: 999px; font-size: .76rem; font-weight: 800; line-height: 1.25; }
.permission-management { color: #4c5756; background: #e4e6e5; border-color: #c7ccca; }
.permission-readonly { color: #385568; background: #e3edf3; border-color: #aec5d2; }
.permission-controlled { color: #174e87; background: #e1edfb; border-color: #9fbfe4; }
.permission-ask { color: #7b4d06; background: #fff0c7; border-color: #e7bd60; }
.permission-waiting { color: #713a00; background: #ffd69b; border-color: #d97000; box-shadow: 0 0 0 3px rgba(217,112,0,.12); }
.permission-full-auto { color: #8f1515; background: #ffe0dc; border-color: #d7473f; }
.permission-border-management { border-left: 4px solid #8b9693; }
.permission-border-readonly { border-left: 4px solid #6f91a5; }
.permission-border-controlled { border-left: 4px solid #2d75bd; }
.permission-border-ask { border-left: 4px solid #df970d; }
.permission-border-full-auto { border-left: 4px solid #c9322b; }
.risk-copy { color: #981f1f !important; font-weight: 700; }
.risk-ack { display: flex; gap: .7rem; align-items: flex-start; margin: 1rem 0; padding: 1rem; border: 2px solid #c9322b; border-radius: 12px; background: #fff4f2; color: #7d1616; font-weight: 750; }
.risk-ack input { width: 1.15rem; height: 1.15rem; margin-top: .15rem; }
.full-auto-warning { margin: 1rem 0; padding: 1rem; border: 2px solid #c9322b; border-radius: 12px; background: #ffe7e3; color: #7d1616; }
.full-auto-warning strong { font-size: 1.05rem; }
.full-auto-warning p { color: inherit; margin: .55rem 0 0; }
.full-auto-warning.persistent { position: sticky; top: 76px; z-index: 5; }
.empty-home { padding: 3rem; border: 1px dashed #aeb7b4; border-radius: 20px; text-align: center; color: var(--muted); }

.cockpit { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 232px minmax(0, 1fr) 286px; }
.sidebar { padding: 26px 18px; border-right: 1px solid var(--line); background: rgba(250,249,244,.72); }
.project-switch { display: block; width: 100%; border: 1px solid var(--line); padding: .75rem; border-radius: 11px; background: var(--panel); text-align: left; text-decoration: none; line-height: 1.35; }
.nav-label { margin: 1.5rem .75rem .55rem; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.nav-list { display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: .65rem; min-height: 42px; padding: .65rem .75rem; border-radius: 9px; text-decoration: none; color: #45504f; font-size: .91rem; }
.nav-link:hover { background: #ecebe5; }
.nav-link[aria-current="page"] { color: white; background: var(--brand); box-shadow: 0 7px 16px rgba(13,102,90,.17); }
.nav-dot { width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; }

.content { min-width: 0; padding: 40px clamp(24px, 4vw, 58px) 80px; }
.content-header { margin-bottom: 28px; }
.content-header h1 { font-size: clamp(2rem, 4vw, 3.6rem); }
.content-header p { color: var(--muted); line-height: 1.7; max-width: 720px; }
.status-mobile { display: none; }
.mobile-project-summary { display: none; }
.drawer-backdrop { display: none; }
.right-rail { padding: 34px 24px; border-left: 1px solid var(--line); background: rgba(255,253,247,.62); }
.rail-block { margin-bottom: 1.8rem; }
.rail-block h2 { margin: 0 0 .7rem; color: var(--muted); font-size: .72rem; letter-spacing: .12em; }
.rail-block p { margin: 0; line-height: 1.55; font-size: .9rem; }
.attention-box { padding: 1rem; border: 1px solid #edd2aa; border-radius: 13px; background: var(--warn); }
.all-clear { padding: 1rem; border-radius: 13px; background: var(--soft); color: var(--brand-dark); }

.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.answer-card, .panel, .doc-card, .list-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 8px 24px rgba(30,50,46,.045); }
.answer-card { padding: 20px; }
.answer-card.wide { grid-column: 1 / -1; }
.answer-card small { color: var(--muted); }
.answer-card h2 { margin: .5rem 0 0; font-size: 1.12rem; line-height: 1.45; }
.section-title { margin: 36px 0 15px; font-size: 1.25rem; letter-spacing: -.025em; }
.panel { padding: 22px; margin-bottom: 15px; }
.panel h2, .panel h3 { margin-top: 0; }
.panel p { line-height: 1.7; }
.list { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.list-card { min-width: 0; max-width: 100%; overflow-wrap: anywhere; padding: 17px 19px; }
.list-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.list-card h3 { margin: 0; font-size: 1rem; }
.list-card p { margin: .65rem 0 0; color: var(--muted); line-height: 1.6; font-size: .9rem; }
.empty-state { padding: 34px 24px; border: 1px dashed #aeb7b4; border-radius: 16px; background: rgba(255,253,247,.58); text-align: center; }
.empty-state strong { display: block; margin-bottom: .5rem; }
.empty-state p { margin: 0; color: var(--muted); line-height: 1.6; }
.doc-card { padding: 20px; margin-bottom: 12px; }
.doc-card h3 { margin: 0 0 .55rem; }
.doc-card p { color: var(--muted); line-height: 1.6; }
.doc-toggle { border: 0; border-bottom: 1px solid var(--brand); color: var(--brand); background: transparent; padding: .2rem 0; }
.doc-body { margin-top: 1rem; padding: 1rem; border-radius: 10px; background: #f4f3ee; white-space: pre-wrap; line-height: 1.7; font-size: .88rem; max-height: 420px; overflow: auto; }
.artifact-text { max-height: 260px; overflow: auto; white-space: pre-wrap; background: #fff; padding: .75rem; border-radius: 8px; }
.group { margin-bottom: 28px; }
.group h2 { display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.count { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding: 0 .4rem; border-radius: 999px; background: #e5e9e5; color: var(--muted); font-size: .72rem; }
.pagination-status { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 14px; color: var(--muted); font-size: .85rem; }
.load-more { border: 1px solid var(--line); border-radius: 9px; padding: .55rem .85rem; color: var(--brand-dark); background: var(--panel); }
.technical { margin-top: 1rem; font-size: .8rem; color: var(--muted); }
.technical summary { cursor: pointer; }
.technical pre { overflow: auto; white-space: pre-wrap; }
.permission-summary { display: grid; gap: .15rem; margin-top: .8rem; }
.permission-summary p { margin: .25rem 0; }
.execution-live { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: #f8f7f2; }
.execution-live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .9rem; }
.execution-live-head p { margin: .35rem 0 0; }
.execution-tabs { display: flex; gap: .35rem; margin: 1rem 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.execution-tab { flex: none; padding: .65rem .8rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); }
.execution-tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 800; }
.execution-tab-panel { min-height: 130px; }
.timeline-list { display: grid; gap: .55rem; }
.timeline-event { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: .65rem; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.timeline-event p { margin: .2rem 0; color: var(--muted); }
.timeline-event small { color: var(--muted); }
.timeline-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: white; background: var(--brand); font-size: .7rem; font-weight: 900; }
.severity-warning .timeline-icon { background: #d87500; }
.severity-error .timeline-icon { background: #ba2823; }
.severity-success .timeline-icon { background: #23804b; }
.approval-card { margin: .8rem 0; padding: 1rem; border: 1px solid #d5cab7; border-radius: 11px; background: #fffdf7; }
.approval-card.pending { border: 2px solid #d97000; background: #fff0d7; }
.permission-human-summary { overflow-wrap: anywhere; font-weight: 650; }
.card-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.danger-action { border: 1px solid #b52b26; border-radius: 9px; padding: .55rem .85rem; color: #8d1713; background: #fff1ef; }
.mobile-timeline-expand { display: none; margin-top: .75rem; }
.error-page { max-width: 680px; margin: 12vh auto; padding: 30px; }
.loading-state { max-width: 800px; margin: 18vh auto; padding: 30px; }

@media (max-width: 1080px) {
  .cockpit { grid-template-columns: 210px minmax(0, 1fr); }
  .right-rail { display: none; }
  .status-mobile { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 24px; }
  .status-mobile .rail-block { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
}

@media (max-width: 720px) {
  .topbar { height: 62px; padding: 0 16px; }
  .topbar-note { display: none; }
  .topbar-action { padding: .45rem .55rem; font-size: .78rem; }
  .login-page { width: min(100% - 32px, 520px); min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 2rem; padding: 36px 0; }
  .login-copy h1 { font-size: clamp(2.4rem, 14vw, 3.7rem); }
  .login-card { width: 100%; padding: 22px 18px; }
  .menu-button { display: inline-block; }
  .home { padding: 42px 16px 70px; }
  .home-hero { margin-bottom: 28px; }
  .project-card { min-height: 0; padding: 20px; }
  .cockpit { min-height: calc(100vh - 62px); display: block; }
  .sidebar { position: fixed; z-index: 30; inset: 62px auto 0 0; width: min(82vw, 300px); transform: translateX(-105%); transition: transform .2s; background: #faf9f4; box-shadow: var(--shadow); overflow-y: auto; }
  .sidebar.open { transform: translateX(0); }
  .drawer-backdrop { position: fixed; display: block; z-index: 25; inset: 62px 0 0; width: 100%; border: 0; padding: 0; background: rgba(17,35,32,.38); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
  .content { padding: 25px 16px 60px; }
  .mobile-project-summary { display: block; margin-bottom: 18px; }
  .mobile-project-summary h1 { font-size: 2rem; }
  .mobile-project-summary p { color: var(--muted); line-height: 1.6; }
  .content-header h1 { font-size: 2.35rem; }
  .answer-grid { grid-template-columns: 1fr; }
  .answer-card.wide { grid-column: auto; }
  .status-mobile { grid-template-columns: 1fr; }
  .metrics { gap: 6px; }
  .metric { padding: .65rem .35rem; }
  .list-card-head { display: grid; }
  .execution-live { padding: .75rem; }
  .execution-live-head { display: grid; }
  .timeline-list .timeline-event:nth-child(n+4) { display: none; }
  .timeline-list.expanded .timeline-event { display: grid; }
  .mobile-timeline-expand { display: inline-block; }
  .approval-card, .full-auto-warning, .execution-live { min-width: 0; overflow-wrap: anywhere; }
  .approval-card .card-actions { display: grid; grid-template-columns: 1fr; }
  .execution-tabs { max-width: 100%; overscroll-behavior-inline: contain; }
  .technical pre, .approval-card pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
  .full-auto-warning.persistent { top: 66px; }
}
