:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #6c7787;
  --line: #e4e9ef;
  --primary: #126d65;
  --primary-dark: #0b554f;
  --primary-soft: #e1f2ef;
  --danger: #b83b45;
  --danger-soft: #fbe8ea;
  --warning: #9b6200;
  --warning-soft: #fff0d1;
  --notice: #2362a2;
  --notice-soft: #e5f0fb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(27, 42, 64, .07);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 10px 14px; border-radius: 8px; background: #fff; color: var(--primary-dark); transform: translateY(-150%); box-shadow: var(--shadow); }
.skip-link:focus { transform: translateY(0); }
.clipboard-helper { position: fixed; left: -10000px; top: -10000px; }
.app-body { display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: #11262a; color: #fff; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; }
.brand:hover { color: inherit; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #4ec2b5; color: #0c3734; font-weight: 850; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: #9eb7b8; font-size: 11px; }
.brand.large .brand-mark { width: 52px; height: 52px; font-size: 18px; }
.brand.large strong { font-size: 20px; }
.nav-list { display: grid; gap: 5px; margin-top: 40px; }
.nav-list a { padding: 11px 13px; border-radius: 9px; color: #b9cdce; font-size: 14px; }
.nav-list a:hover, .nav-list a.active { background: rgba(100, 210, 196, .12); color: #f2fffd; }
.nav-divider { margin: 20px 13px 5px; color: #688386; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 6px 0; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { color: #8da6a8; margin-top: 3px; font-size: 11px; }
.sidebar .link-button { color: #92b6b3; }

.main-content { min-width: 0; padding: 30px clamp(22px, 4vw, 54px) 60px; }
.page-header { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; margin-bottom: 26px; }
.page-header h1 { margin: 3px 0 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--primary); font-size: 10px; font-weight: 850; letter-spacing: .15em; }
.global-search input { width: min(310px, 28vw); }

input, select, textarea { width: 100%; border: 1px solid #d7dee7; border-radius: 9px; background: #fff; color: var(--ink); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #55a89e; box-shadow: 0 0 0 3px rgba(20, 124, 113, .12); }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: #445063; font-size: 13px; font-weight: 650; }
label > span { color: var(--danger); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; font-size: 13px; text-decoration: none; transition: transform .1s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); color: #fff; }
.button.secondary { background: #fff; border-color: #d7dee7; color: #344054; }
.button.secondary:hover { border-color: #9aa9ba; color: var(--ink); }
.button.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.button.danger { background: var(--danger); color: #fff; }
.button.tiny { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.button.wide { width: 100%; min-height: 45px; }
.button-row, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions { gap: 12px; }
.link-button { appearance: none; min-height: 36px; padding: 6px 2px; border: 0; background: none; color: var(--primary); font-weight: 650; }
.danger-text { color: var(--danger); }
.text-link { font-size: 13px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel + .panel, .panel + .danger-zone { margin-top: 20px; }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-heading p, .muted { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-heading { padding: 22px 22px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
th { color: #566276; background: #fafbfc; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfd; }
.primary-link { color: var(--ink); font-weight: 780; }
.cell-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.neutral { background: #edf1f5; color: #536071; }
.badge.notice { background: var(--notice-soft); color: var(--notice); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.danger-text { color: var(--danger) !important; }
.warning-text { color: var(--warning) !important; }
.notice-text { color: var(--notice) !important; }
.neutral-text { color: var(--muted) !important; }

.flash { margin-bottom: 18px; padding: 12px 15px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; }
.flash.error { background: var(--danger-soft); color: #8b2932; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat-card { display: grid; gap: 8px; min-height: 145px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 34px; letter-spacing: -.04em; }
.stat-card a { align-self: end; font-size: 12px; font-weight: 750; }
.stat-card.notice { border-top: 3px solid #4e91d2; }
.stat-card.danger { border-top: 3px solid #d65d66; }
.content-grid { display: grid; gap: 20px; align-items: start; }
.content-grid.two-one { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.list-stack { display: grid; }
.list-item { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 13px 2px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
.list-item strong, .list-item small { display: block; }
.list-item strong { font-size: 13px; }
.list-item small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.list-stack.compact .list-item { padding: 10px 0; }
.empty-state { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 6px 0 0; font-size: 13px; }

.toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 15px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar input { width: 220px; }
.filter-bar select { width: auto; min-width: 130px; }
.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.segmented a { padding: 8px 12px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.segmented a.active { background: var(--primary); color: #fff; }

.form-panel { padding: 0; overflow: hidden; }
.form-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 26px; border-bottom: 1px solid var(--line); }
.section-intro h2 { margin: 0; font-size: 16px; }
.section-intro p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-grid.compact { gap: 12px; margin-top: 14px; }
.full-span { grid-column: 1 / -1; }
.check-label { display: flex; align-items: center; align-self: end; min-height: 39px; }
.check-label input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 20px 26px; background: #fafbfc; }
.stack-form { display: grid; gap: 16px; }
.mini-form { display: grid; grid-template-columns: 1fr 130px 110px auto; gap: 7px; margin-top: 10px; min-width: 530px; }

.detail-hero { display: flex; justify-content: space-between; gap: 25px; align-items: flex-start; margin-bottom: 18px; padding: 24px; color: #fff; background: linear-gradient(135deg, #17383b, #0d5c56); border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-hero p { max-width: 720px; margin: 9px 0 0; color: #c4dbda; font-size: 13px; line-height: 1.65; }
.detail-hero .button.secondary { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.detail-title h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #90a0a2; }
.status-dot.active { background: #6ae0b3; box-shadow: 0 0 0 4px rgba(106,224,179,.14); }
.status-dot.paused { background: #ffd26c; }
.info-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin-bottom: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); box-shadow: var(--shadow); }
.info-grid > div { min-height: 95px; padding: 17px; background: #fff; }
.info-grid span, .info-grid strong, .info-grid small { display: block; }
.info-grid span { color: var(--muted); font-size: 11px; }
.info-grid strong { margin-top: 8px; font-size: 14px; overflow-wrap: anywhere; }
.info-grid small { margin-top: 5px; font-size: 11px; }
.credential-list { display: grid; gap: 12px; }
.credential-card { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; }
.credential-card.disabled { opacity: .68; }
.credential-meta { display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.credential-meta > div { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.credential-meta small { color: var(--muted); }
.credential-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.secret-output { min-height: 0; margin-top: 0; padding: 0; border-radius: 8px; font-family: "Cascadia Code", Consolas, monospace; overflow-wrap: anywhere; }
.secret-output:not(:empty) { margin-top: 10px; padding: 10px; background: #edf5f4; color: #174b47; }
.secret-output.visible { user-select: all; }
.secret-output.visible { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.secret-value { min-width: 0; overflow-wrap: anywhere; }
.secret-hide { flex: 0 0 auto; min-height: 28px; padding: 2px 0; }
.inline-editor, .add-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { color: var(--primary); font-size: 12px; font-weight: 750; }
.add-box { padding: 14px; border: 1px dashed #b6c3cf; border-radius: 10px; background: #fafcfc; }
.row-editor summary { color: var(--primary); }
.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding-bottom: 15px; }
.timeline-item > span { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--primary); }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.timeline-item p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; border: 1px solid #f1c5c9; border-radius: var(--radius); background: #fff8f8; }
.danger-zone strong { color: #8a2730; }
.danger-zone p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.callout { margin-top: 18px; padding: 13px; border-radius: 9px; background: #eef6f5; }
.callout p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.auth-body { min-height: 100vh; background: #0e272a; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(390px, .8fr); }
.login-intro { display: flex; flex-direction: column; justify-content: center; padding: clamp(45px, 8vw, 110px); color: #fff; background: radial-gradient(circle at 18% 25%, rgba(70,190,175,.25), transparent 34%), linear-gradient(145deg, #102e32, #0a1f22); }
.login-intro h1 { max-width: 700px; margin: 55px 0 18px; font-size: clamp(36px, 5vw, 67px); line-height: 1.03; letter-spacing: -.055em; }
.login-intro > p { max-width: 640px; color: #b7cdcd; line-height: 1.75; }
.feature-list { display: flex; flex-wrap: wrap; gap: 10px 25px; padding: 0; margin: 28px 0 0; list-style: none; color: #8fc6c0; font-size: 13px; }
.feature-list li::before { content: "✓"; margin-right: 7px; color: #5ed3c4; }
.login-card { align-self: center; width: min(430px, calc(100% - 50px)); margin: 40px auto; padding: 34px; border-radius: 18px; background: #fff; box-shadow: 0 25px 60px rgba(0,0,0,.23); }
.login-card h2 { margin: 6px 0 0; font-size: 27px; letter-spacing: -.035em; }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.error-page { width: min(620px, calc(100% - 40px)); margin: 10vh auto; padding: 40px; border: 1px solid var(--line); border-radius: 18px; background: #fff; text-align: center; box-shadow: var(--shadow); }
.error-code { color: var(--primary); font-size: 58px; font-weight: 850; letter-spacing: -.06em; }
.error-page h2 { margin: 8px 0; }
.error-page p { color: var(--muted); line-height: 1.65; }
.error-page .button-row { justify-content: center; margin-top: 22px; }

@media (max-width: 1150px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid.two-one { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-body { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 16px; }
  .nav-list { display: flex; overflow-x: auto; margin-top: 16px; }
  .nav-list a { white-space: nowrap; }
  .nav-divider, .sidebar-user small { display: none; }
  .sidebar-user { position: absolute; top: 19px; right: 16px; margin: 0; padding: 0; border: 0; }
  .sidebar-user > div { display: block; max-width: 110px; }
  .sidebar-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main-content { padding: 22px 15px 45px; }
  .page-header { align-items: flex-start; }
  .global-search { display: none; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter-bar input, .filter-bar select { flex: 1 1 150px; width: auto; }
  .form-section { grid-template-columns: 1fr; gap: 17px; padding: 20px; }
  .detail-hero { flex-direction: column; }
  .login-shell { display: block; padding: 1px 0; }
  .login-intro { min-height: auto; padding: 35px 25px; }
  .login-intro h1 { margin: 35px 0 14px; font-size: 38px; }
  .feature-list { display: none; }
}

@media (max-width: 560px) {
  .stat-grid, .info-grid, .form-grid { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
  .stat-card { min-height: 120px; }
  .detail-title h2 { font-size: 21px; }
  .login-card { width: calc(100% - 30px); padding: 25px; }
  .mini-form { grid-template-columns: 1fr; min-width: 260px; }
}
