:root {
  --Blue: #3b82f6;
  --BlueDark: #2563eb;
  --BlueSoft: #dbeafe;
  --Bg: #f8fafc;
  --Panel: #ffffff;
  --Text: #172033;
  --Muted: #64748b;
  --Border: #d9e1ec;
  --Danger: #b4232c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--Bg);
  color: var(--Text);
  font-family: Microsoft YaHei, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--Blue);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--BlueDark);
}

button.secondary,
.button-link.secondary {
  background: #4b5565;
}

button.danger {
  background: var(--Danger);
}

input,
select,
textarea {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--Text);
}

input,
select {
  height: 34px;
  padding: 0 9px;
}

textarea {
  width: 100%;
  min-height: 240px;
  padding: 10px;
  resize: vertical;
}

.file-drop-zone {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.file-drop-zone.dragging {
  border-color: var(--Blue);
  background: #eff6ff;
}

.file-drop-title {
  color: #0f172a;
  font-weight: 700;
}

.file-drop-zone input {
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: #f7f9fc;
  color: #0f172a;
  position: sticky;
  top: 0;
}

.app-root {
  min-height: 100vh;
}

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  height: 100vh;
  padding: 18px 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid var(--BlueSoft);
  box-shadow: 10px 0 28px rgba(15, 23, 42, 0.06);
}

.brand {
  padding: 4px 8px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.brand-meta {
  margin-top: 4px;
  color: var(--Muted);
  font-size: 12px;
  word-break: break-all;
}

.nav-section {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.nav-label {
  padding: 0 8px;
  color: #94a3b8;
  font-size: 12px;
}

.nav-item,
.logout-button {
  min-height: 38px;
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 10px;
  background: transparent;
  color: #334155;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover,
.logout-button:hover {
  background: #eff6ff;
  color: var(--BlueDark);
  border-color: #bfdbfe;
}

.nav-item.active {
  background: var(--BlueSoft);
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.main-view {
  margin-left: 256px;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--BlueSoft);
  border-radius: 8px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.045);
}

.page-head h1 {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.2;
}

.muted {
  color: var(--Muted);
  font-size: 12px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--Border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title h2,
.panel h2,
.panel h3 {
  margin: 0;
  color: #0f172a;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stat-card {
  min-height: 82px;
  border: 1px solid var(--Border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.stat-value {
  margin-top: 4px;
  color: #0f172a;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sticky-panel {
  position: sticky;
  top: 24px;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.action-bar,
.action-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  min-height: 36px;
  border: 1px solid var(--Border);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--Text);
}

.tab.active {
  background: var(--Blue);
  color: #fff;
  border-color: var(--Blue);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.content-cell {
  max-width: 620px;
  max-height: 92px;
  overflow: auto;
  word-break: break-all;
  line-height: 1.35;
  color: #334155;
  font-size: 12px;
}

.notice {
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 10px;
  background: #ecfdf5;
  color: #065f46;
}

.notice.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.warn {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 10px;
  background: #fff7ed;
  color: #9a3412;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
}

.pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.pill.danger {
  background: #fee2e2;
  color: #991b1b;
}

.loading-panel {
  border: 1px solid var(--Border);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

@media (max-width: 960px) {
  .side-nav {
    position: sticky;
    top: 0;
    width: auto;
    height: auto;
    z-index: 30;
  }

  .main-view {
    margin-left: 0;
    padding: 10px;
  }

  .workspace-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }
}
