:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  color: #142c36;
  background: #f4f7f9;
  --muted: #526773;
  --accent: #08736d;
  --accent-hover: #075953;
  --border: #dbe5e9;
  --white: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .21em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid #07847d; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.65rem); line-height: 1.25; font-weight: 760; letter-spacing: -.035em; }
h2 { font-size: 1.12rem; line-height: 1.5; }
small { color: var(--muted); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
.shell { display: grid; grid-template-columns: 225px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; min-height: 480px; display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 24px 16px 16px; background: #122f36; color: #eef9f9;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; color: inherit; font-weight: 700; text-decoration: none; }
.brand:hover { color: #aee9df; }
.brand small { display: block; color: #b5d0d2; font-size: .78rem; font-weight: 500; margin-top: 2px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 37px; height: 37px; flex: 0 0 37px;
  border-radius: 10px; background: #3cbdb1; color: #092e32; font-size: 1.4rem; font-weight: 800;
}
.navigation { margin-top: 38px; display: grid; gap: 5px; }
.nav-caption { padding: 0 11px 5px; color: #a9c5cb; font-size: .78rem; }
.nav-section { margin-top: 15px; }
.navigation a { display: flex; gap: 11px; align-items: center; color: #e0eeee; padding: 11px; border-radius: 9px; text-decoration: none; }
.navigation a span { display: inline-block; width: 18px; text-align: center; color: #a6c7c9; }
.navigation a:hover, .navigation a[aria-current] { background: #214a51; color: #fcffff; }
.navigation a[aria-current] span { color: #6ee2d4; }
.nav-toggle { display: none; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: 9px; border-top: 1px solid #38535a; padding: 16px 2px 0; }
.account-mark { width: 34px; height: 34px; border-radius: 100px; display: grid; place-items: center; flex: 0 0 34px; color: #b5efe7; background: #22545a; }
.identity { flex: 1; min-width: 0; }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { color: #b5d0d2; font-size: .77rem; }
.logout { color: #ddf1ee; border: 1px solid #42636a; background: transparent; border-radius: 7px; min-width: 37px; min-height: 37px; }
.workspace { display: flex; min-width: 0; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px;
  padding: 12px clamp(18px, 3.4vw, 48px); background: var(--white); border-bottom: 1px solid var(--border); color: #405965;
}
.topbar a { font-size: .88rem; text-decoration: none; }
.breadcrumb-divider { color: #678891; margin-inline: 7px; }
.main { width: 100%; max-width: 1450px; flex: 1; margin: 0 auto; padding: clamp(22px, 3.4vw, 46px); }
.footer { padding: 14px clamp(18px, 3.4vw, 48px) 25px; color: var(--muted); font-size: .8rem; }
.footer span { margin-left: 10px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 23px; }
.page-heading p { color: var(--muted); margin-top: 7px; line-height: 1.6; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  border-radius: 8px; border: 1px solid transparent; padding: 8px 15px; font-weight: 650; text-decoration: none; white-space: nowrap;
}
.primary { background: var(--accent); border-color: var(--accent); color: var(--white); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--white); }
.danger, .danger:hover { background: #9a3943; color: #fff; }
.secondary { color: #254c56; border-color: #c5d7db; background: var(--white); }
.secondary:hover { background: #edf7f6; }
.button.compact { min-height: 36px; padding: 5px 10px; font-size: .86rem; }
.text-button { font-size: .9rem; text-decoration: none; }
.notice { border: 1px solid; border-radius: 9px; padding: 11px 14px; margin-bottom: 17px; line-height: 1.55; }
.local { color: #325866; background: #eaf3f7; border-color: #cce2eb; }
.success { color: #126050; background: #e6f5ed; border-color: #bcdfcc; }
.error { color: #882d36; background: #fff2f2; border-color: #ebcbd0; }
.dot { background: #289a8a; display: inline-block; height: 8px; width: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; margin-bottom: 19px; }
.stat, .panel { background: var(--white); border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 2px 3px #12364208; }
.stat { padding: 15px 18px 17px; }
.stat p { color: #4c6670; font-weight: 600; }
.stat strong { display: block; margin: 9px 0 3px; font-size: 1.74rem; }
.stat small { display: block; line-height: 1.55; }
.stat-icon { display: inline-grid; place-items: center; background: #e7f4f2; color: var(--accent); width: 29px; height: 29px; border-radius: 8px; margin-right: 5px; }
.dashboard-grid, .editor-grid { display: grid; gap: 18px; align-items: start; }
.dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr); }
.editor-grid { grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); }
.editor-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.quick-upload { margin-block: 14px; }
.quick-upload summary { cursor: pointer; font-weight: 650; }
.quick-upload form { margin-top: 14px; }
.panel { padding: 19px; min-width: 0; }
.main > .panel + .panel { margin-top: 16px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-heading p { color: var(--muted); margin-top: 3px; font-size: .88rem; line-height: 1.55; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 17px; }
.pill { display: inline-flex; align-items: center; padding: 4px 8px; color: #235f56; background: #e9f4f1; border-radius: 20px; white-space: nowrap; font-size: .8rem; }
.details { margin: 0; }
.details div { border-top: 1px solid #e7eef0; padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.message-stage {
  padding: 18px 12px; border-radius: 11px; background-color: #e8f1ef;
  background-image: radial-gradient(#9bbdb74d 1px, transparent 1px); background-size: 13px 13px;
}
.message-preview { max-width: 390px; margin: 0 auto; }
.message-bubble { background: #fff; border: 1px solid #d6e5e0; border-radius: 12px; overflow: hidden; }
.message-media { width: 100%; max-height: 330px; display: block; object-fit: contain; background: #142c36; }
.message-text { padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.empty-text { color: var(--muted); }
.keyboard-row { display: flex; gap: 4px; margin-top: 4px; }
.keyboard-button {
  padding: 8px 5px; min-width: 0; min-height: 35px; flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 4px; border-radius: 6px; border: 1px solid #538682; background: #3c7671; color: #fff; font-size: .82rem; text-align: center;
}
.keyboard-button > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.keyboard-button.pending { background: #60807e; color: #fff; border-color: #5e7b79; }
label { display: block; font-weight: 660; line-height: 1.4; }
input:not([type=hidden], [type=checkbox]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 42px; margin-top: 5px; border: 1px solid #c9d8de;
  border-radius: 8px; color: #142c36; padding: 8px 10px; background: #fff; font-weight: 400;
}
input::placeholder, textarea::placeholder { color: #627b84; }
textarea { resize: vertical; }
.field-note { color: var(--muted); font-size: .85rem; margin: 8px 0 13px; line-height: 1.5; }
.stack { display: grid; gap: 14px; }
.stack .button { justify-self: start; }
.stack .field-note { margin: 0; }
.narrow { max-width: 560px; }
.button-entry { display: grid; grid-template-columns: minmax(92px, .55fr) minmax(140px, 1.45fr); gap: 7px 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.button-entry small { display: block; font-weight: 400; margin-top: 3px; }
.entry-controls, .row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.entry-controls { grid-column: 1 / -1; }
.entry-controls button, .row-actions button {
  min-width: 36px; min-height: 36px; padding: 5px 8px; background: #fff; color: #255760;
  border: 1px solid #c5d7db; border-radius: 7px;
}
.checkbox { display: flex; align-items: center; gap: 5px; margin-right: auto; min-height: 37px; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }
.action-strip { margin-top: 14px; display: flex; justify-content: flex-end; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .92rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: #405b65; white-space: nowrap; background: #f5f8f9; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.horizontal-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.horizontal-form .checkbox { margin-right: 0; }
.table-detail { width: 100%; padding: 5px 0; }
.table-detail summary { cursor: pointer; color: var(--accent); }
.table-detail form { margin: 7px 0 0; }
.grant-options { display: grid; gap: 4px; }
.row-actions input:not([type=hidden]) { max-width: 175px; margin: 0; }
.secret { border-color: #7fb7ae; margin-bottom: 16px; }
.secret p { color: var(--muted); margin: 5px 0; }
.secret code { overflow-wrap: anywhere; }
progress { width: 100%; height: 15px; accent-color: var(--accent); }
.login-wrap { min-height: 100dvh; padding: 25px; display: grid; place-items: center; background: #eaf3f3; }
.login-box { width: min(100%, 450px); padding: clamp(22px, 6vw, 38px); border: 1px solid var(--border); border-radius: 17px; background: #fff; box-shadow: 0 18px 40px #143f3e14; }
.login-box h1 { margin: 20px 0 5px; font-size: clamp(1.65rem, 6vw, 2.15rem); }
.login-box p { line-height: 1.55; margin-bottom: 15px; }
.login-box .subtle { color: var(--muted); }
.login-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }

@media (max-width: 980px) {
  .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 740px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: relative; height: auto; min-height: 0; padding: 12px 15px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .brand { padding: 0; }
  .brand small { display: inline; margin-left: 4px; }
  .nav-toggle { display: block; }
  .nav-toggle summary { cursor: pointer; padding: 8px 3px; }
  .navigation { display: none; margin: 10px 0 0; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar:has(.nav-toggle[open]) .navigation { display: grid; }
  .nav-caption { grid-column: 1 / -1; }
  .sidebar-bottom { display: none; }
  .sidebar:has(.nav-toggle[open]) .sidebar-bottom { display: flex; grid-column: 1 / -1; margin-top: 11px; padding-top: 10px; }
  .topbar { min-height: 48px; font-size: .86rem; }
  .main { padding: 20px 15px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panel { padding: 14px; }
  .stats-grid { gap: 7px; }
  .stat { padding: 9px; }
  .stat p, .stat small { font-size: .78rem; }
  .stat strong { font-size: 1.32rem; }
  .stat-icon { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  input:not([type=hidden], [type=checkbox]), select, textarea { font-size: 16px; }
  .main { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .horizontal-form > label { min-width: 0; max-width: 100%; }
  .action-strip { padding-block: 8px max(8px, env(safe-area-inset-bottom)); }
}
@media (max-width: 350px) {
  .brand small { display: none; }
  .button-entry { grid-template-columns: minmax(0, 1fr); }
}
