:root {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f4f5f7;
}

* { box-sizing: border-box; }

code { background: #e8eaef; padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }

.muted { color: #5c6370; font-size: 0.92rem; }
.error { color: #b00020; }
.success { color: #0d6d3b; }
.hint { margin-top: 1rem; font-size: 0.85rem; }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack.tight { gap: 0.5rem; }

.stack label, .stack input, .stack button { width: 100%; }

input, select, button {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #ccd0d6;
  font: inherit;
}

button, .btn {
  cursor: pointer;
  border: none;
  background: #e8eaef;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  color: inherit;
}

button[type="submit"], .btn.primary {
  background: #2563eb;
  color: #fff;
}

.btn { padding: 0.45rem 0.85rem; border-radius: 8px; font-size: 0.9rem; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e1e4e8;
}

.topbar nav { display: flex; gap: 0.5rem; align-items: center; }

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.panel h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.panel h3 { margin: 1rem 0 0.4rem; font-size: 1rem; }

.breadcrumb { margin: 0.5rem 0; font-size: 0.95rem; }
.breadcrumb a { color: #2563eb; }

.filelist { list-style: none; padding: 0; margin: 0.5rem 0; }
.filelist li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.filelist .dir { font-weight: 600; color: #2563eb; text-decoration: none; }
.linkbtn, .danger {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}
.danger { background: #fee2e2; color: #991b1b; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 0.35rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.92rem; }
.list.dense li { padding: 0.25rem 0; font-size: 0.88rem; }

.row { margin-top: 0.75rem; }

.row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0;
}
.row-inline input { flex: 1; min-width: 120px; }

#cmdInput {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.terminal-out {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  overflow: auto;
  max-height: 420px;
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- dashboard: 左侧目录 + 右侧内容（宽屏常驻；窄屏抽屉） --- */
html:has(.dash-body) {
  height: 100%;
}

.dash-body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  background: #f4f5f7;
}

.dash-body .app-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}

.dash-body .drawer {
  flex: 0 0 248px;
  width: 248px;
  max-width: 85vw;
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid #334155;
  min-height: 100vh;
  box-sizing: border-box;
}

.drawer-head {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #334155;
}

.drawer-head strong {
  display: block;
  font-size: 1rem;
  color: #f8fafc;
}

.drawer-user {
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  margin: 0.15rem 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #1e293b;
  color: #fff;
}

.nav-item.nav-link {
  text-decoration: none;
  color: #93c5fd;
}

.nav-item.nav-link:hover {
  color: #bfdbfe;
}

.nav-divider {
  height: 1px;
  background: #334155;
  margin: 0.5rem 0;
}

.nav-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  padding: 0.35rem 0.65rem 0.2rem;
}

.drawer-foot {
  padding: 0.75rem 1rem;
  border-top: 1px solid #334155;
}

.drawer-foot .logout {
  color: #fca5a5;
  font-size: 0.9rem;
}

.drawer-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 35;
}

.drawer-scrim:not([hidden]) {
  display: block;
}

.dash-body .main-column {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f4f5f7;
}

.main-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e1e4e8;
  position: sticky;
  top: 0;
  z-index: 20;
}

.main-topbar-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.dash-body .drawer-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #e1e4e8;
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.main-panels {
  flex: 1;
  padding: 1rem;
}

.panel-section {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
}

.panel-section.active {
  display: block;
}

.card-like.panel {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.panel.card-like.files-sub {
  margin-top: 1rem;
}

.filter-bar.wrap {
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid #eef0f3;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
}

.data-table .nowrap {
  white-space: nowrap;
}

.data-table .detail-cell {
  max-width: 280px;
  word-break: break-word;
}

.modal-dlg {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 2rem);
}

.modal-dlg::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.modal-inner {
  padding: 1.25rem;
}

.modal-inner h3 {
  margin: 0 0 1rem;
}

.modal-inner label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
}

.dlg-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* 仅窄屏使用「抽屉」：侧栏浮层 + 汉堡键；≥769px 侧栏始终在左侧 */
@media (max-width: 768px) {
  .dash-body .drawer-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .dash-body .drawer {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    border-right: none;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  }

  .dash-body .drawer.open {
    transform: translateX(0);
  }

  .dash-body .main-topbar {
    padding-left: 3.5rem;
  }
}
