:root{
  --bg:#f6f8fb;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;
  --shadow: 0 8px 30px rgba(15,23,42,.08);

  --primary:#2563eb;
  --danger:#dc2626;
  --warn:#f59e0b;
}

*{ box-sizing:border-box; }
.hidden{ display:none; }

html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:var(--bg);
}

code{
  background:#eef2ff;
  padding:2px 6px;
  border-radius:6px;
  font-size: 12px;
}

.app{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  background:rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.logo-dot{
  width:14px;height:14px;border-radius:999px;
  background:var(--primary);
  box-shadow: 0 0 0 6px rgba(37,99,235,.12);
}
.brand-title{ font-weight:700; }
.brand-subtitle{ color:var(--muted); font-size:12px; }

.layout{
  display:flex;
  flex:1;
  min-height:0;
}

.sidebar{
  width:220px;
  padding:14px 10px;
  border-right:1px solid var(--border);
  background:rgba(255,255,255,.6);
}

.nav-item{
  width:100%;
  text-align:left;
  padding:12px 12px;
  border:1px solid transparent;
  border-radius:12px;
  background:transparent;
  color:var(--text);
  font-weight:600;
  cursor:pointer;
}
.nav-item:hover{
  background:rgba(37,99,235,.08);
}
.nav-item.active{
  background:rgba(37,99,235,.12);
  border-color: rgba(37,99,235,.18);
}

.main{
  flex:1;
  padding:16px;
  overflow:auto;
}

.view{
  max-width:1100px;
  margin:0 auto;
}

.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:16px;
}

.panel-title{
  font-weight:800;
  font-size:16px;
  margin-bottom:6px;
}
.panel-desc{
  color:var(--muted);
  font-size:13px;
  margin-bottom:12px;
}

.split{
  display:grid;
  grid-template-columns: 1.6fr .9fr;
  gap:14px;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  box-shadow:var(--shadow);
}
.card-title{
  font-weight:800;
  margin-bottom:6px;
}
.card-desc{
  color:var(--muted);
  font-size:13px;
  margin-bottom:12px;
}

.form{ display:flex; flex-direction:column; gap:10px; }
.field{ display:flex; flex-direction:column; gap:6px; }
.label{ font-size:12px; color:var(--muted); }
.label-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; }

.row{ display:flex; gap:10px; align-items:flex-start; }
.grow{ flex:1; }

.inline{
  display:flex;
  align-items:center;
  gap:8px;
}

.input, .textarea, select.input{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
  font-size:14px;
  background:#fff;
}
.input:focus, .textarea:focus, select.input:focus{
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 0 0 4px rgba(37,99,235,.14);
}

.textarea{
  min-height:180px;
  resize:vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.suffix{
  display:inline-flex;
  align-items:center;
  padding:10px 12px;
  border-radius:12px;
  background:#f1f5f9;
  border:1px solid var(--border);
  color:#334155;
  font-size:14px;
  white-space:nowrap;
}

.at{
  display:inline-flex;
  align-items:center;
  padding:10px 10px;
  border-radius:12px;
  background:#f1f5f9;
  border:1px solid var(--border);
  color:#334155;
}

.editor-toolbar{
  display:flex;
  gap:8px;
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#f8fafc;
}
.tool{
  border:1px solid var(--border);
  background:#fff;
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  font-size:13px;
}
.tool:hover{ background:#f1f5f9; }

.editor{
  min-height:220px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  outline:none;
  overflow:auto;
}

.actions{
  display:flex;
  gap:10px;
  margin-top:10px;
  flex-wrap:wrap;
}

.btn{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 14px;
  cursor:pointer;
  font-weight:700;
  background:#fff;
}
.btn:hover{
  background:#f1f5f9;
}

.btn-primary{
  background: var(--primary);
  color:#fff;
  border-color: rgba(37,99,235,.3);
}
.btn-primary:hover{ filter: brightness(.98); }

.btn-danger{
  background: var(--danger);
  color:#fff;
  border-color: rgba(220,38,38,.3);
}
.btn-danger:hover{ filter: brightness(.98); }

.btn-ghost{
  background:transparent;
}

.hint{
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.bullets{
  margin: 8px 0 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}
.bullets li{ margin: 8px 0; }

.list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:12px;
}

.item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
  display:flex;
  justify-content:space-between;
  gap:10px;
  cursor:pointer;
}
.item:hover{
  background:#f8fafc;
}

.item-title{
  font-weight:800;
  margin-bottom:4px;
}
.item-sub{
  color:var(--muted);
  font-size:12px;
}
.item-right{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:6px;
}
.badge{
  font-size:12px;
  font-weight:700;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#f8fafc;
}
.badge.success{
  border-color: rgba(34,197,94,.35);
  background: rgba(34,197,94,.1);
}
.badge.error{
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.1);
}

.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:14px;
}
.pager-info{ color:var(--muted); font-size:12px; }

.grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:14px;
}

.divider{
  height:1px;
  background:var(--border);
  margin:12px 0;
}

.banner{
  max-width:1100px;
  margin: 10px auto 0 auto;
  border-radius:16px;
  border:1px solid var(--border);
  padding:14px 16px;
  box-shadow:var(--shadow);
  background:#fff;
}
.banner-warn{
  border-color: rgba(245,158,11,.35);
  background: rgba(245,158,11,.08);
}
.banner-title{ font-weight:900; }
.banner-desc{ color: var(--muted); font-size:12px; margin:6px 0 10px 0; }
.banner-actions{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

.toast{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  max-width: min(520px, calc(100% - 32px));
  font-weight: 700;
}
.toast.success{ border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.10); }
.toast.error{ border-color: rgba(220,38,38,.35); background: rgba(220,38,38,.10); }
.toast.warn{ border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.10); }

.modal{
  position: fixed;
  inset:0;
  z-index: 10000;
}
.modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(15,23,42,.55);
}
.modal-panel{
  position: relative;
  width: min(980px, calc(100% - 24px));
  height: min(90vh, 760px);
  margin: 5vh auto 0 auto;
  background:#fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 14px;
  border-bottom:1px solid var(--border);
}
.modal-title{ font-weight:900; }
.modal-body{
  padding: 14px;
  overflow:auto;
}
.kv{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom:1px dashed var(--border);
  font-size: 13px;
}
.kv .k{ color: var(--muted); }
.iframe{
  width:100%;
  height: 420px;
  border:1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
}

@media (max-width: 980px){
  .split{ grid-template-columns: 1fr; }
  .grid{ grid-template-columns: 1fr; }
  .sidebar{ width: 180px; }
}

@media (max-width: 760px){
  .main{ padding: 12px; }
  .sidebar{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    display:flex;
    gap:8px;
    justify-content: space-between;
    padding: 10px;
    border-right: none;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
    z-index: 20;
  }
  .nav-item{
    text-align:center;
    padding: 10px 8px;
    border-radius: 14px;
    flex:1;
    font-size: 13px;
  }
  .layout{ padding-bottom: 74px; }
}
