:root {
  --xh-bg: #000000;
  --xh-bg-2: #0a0a0a;
  --xh-panel: #0d0d0d;
  --xh-border: rgba(255,255,255,.18);
  --xh-border-soft: rgba(255,255,255,.08);
  --xh-text: #ffffff;
  --xh-muted: rgba(255,255,255,.55);
  --xh-green: #00c17c;
  --xh-green-2: #00d68a;
  --xh-green-soft: rgba(0,193,124,.16);
  --xh-red: #ff4d4f;
  --xh-blue: #3b82f6;
  --xh-orange: #f59e0b;
  --xh-table-head: #f3f4f6;
  --xh-table-head-text: #111827;
  --xh-sider: #050805;
  --xh-sider-w: 220px;
  --xh-radius: 4px;
  --xh-font: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: var(--xh-font);
  background: var(--xh-bg);
  color: var(--xh-text);
  font-size: 13px;
}

a { color: var(--xh-green); text-decoration: none; cursor: pointer; }
button { font-family: inherit; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(800px 400px at 20% 10%, rgba(0,193,124,.18), transparent 60%),
    #000;
}
.login-box {
  width: 380px;
  background: #0f1412;
  border: 1px solid var(--xh-border);
  border-radius: 8px;
  padding: 36px 32px 28px;
}
.login-logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.login-logo .mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, #00c17c, #009e66);
}
.login-logo h1 { margin: 0; font-size: 22px; font-weight: 700; }
.login-sub { color: var(--xh-muted); margin: 0 0 24px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sider {
  width: var(--xh-sider-w);
  background: var(--xh-sider);
  border-right: 1px solid var(--xh-border-soft);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sider-brand {
  padding: 18px 16px 14px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--xh-border-soft);
  line-height: 1.4;
}
.sider-nav { padding: 10px 8px; overflow: auto; flex: 1; }
.nav-group { margin-bottom: 4px; }
.nav-group-title {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 0; color: var(--xh-text);
  padding: 10px 12px; border-radius: 4px; cursor: pointer; text-align: left;
  font-size: 13px;
}
.nav-group-title:hover { background: rgba(255,255,255,.04); }
.nav-group-title .arrow { margin-left: auto; color: var(--xh-muted); font-size: 10px; }
.nav-sub { padding: 2px 0 6px 0; }
.nav-item {
  display: block; width: 100%;
  background: transparent; border: 0; color: rgba(255,255,255,.78);
  padding: 9px 12px 9px 36px; border-radius: 4px; cursor: pointer; text-align: left;
  font-size: 13px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active {
  background: var(--xh-green);
  color: #fff;
  font-weight: 600;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--xh-bg); }
.topbar {
  height: 48px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--xh-border-soft);
  background: #050505;
}
.crumb { color: rgba(255,255,255,.7); }
.crumb .current { color: var(--xh-green); }
.userbox { display: flex; align-items: center; gap: 8px; color: #fff; }
.userbox .avatar {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.5);
  display: grid; place-items: center; font-size: 12px;
}

.content { padding: 14px 16px 24px; flex: 1; overflow: auto; }

/* Filter */
.filter-box {
  border: 1px solid var(--xh-border);
  border-radius: var(--xh-radius);
  padding: 14px 14px 8px;
  margin-bottom: 12px;
  background: var(--xh-panel);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 12px 16px;
  align-items: end;
}
.filter-item label {
  display: block; color: rgba(255,255,255,.75); margin-bottom: 6px; font-size: 12px;
}
.filter-item input, .filter-item select, .xh-input, .xh-select {
  width: 100%;
  background: #000;
  border: 1px solid var(--xh-border);
  color: #fff;
  border-radius: 2px;
  height: 32px;
  padding: 0 10px;
  outline: none;
}
.filter-item input::placeholder { color: rgba(255,255,255,.35); }
.filter-item input:focus, .xh-input:focus, .xh-select:focus {
  border-color: var(--xh-green);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 32px; padding: 0 14px; border-radius: 2px; cursor: pointer;
  font-size: 13px; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--xh-green); color: #fff; border-color: var(--xh-green); }
.btn-primary:hover { background: var(--xh-green-2); }
.btn-ghost {
  background: transparent; color: #fff;
  border-color: var(--xh-border);
}
.btn-ghost:hover { border-color: var(--xh-green); color: var(--xh-green); }
.btn-outline-green {
  background: transparent; color: #fff;
  border-color: var(--xh-green);
}
.btn-text {
  background: transparent; border: 0; color: var(--xh-green);
  height: auto; padding: 0 6px; cursor: pointer;
}
.btn-text.danger { color: var(--xh-red); }
.btn + .btn { margin-left: 8px; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 8px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* Table */
.table-wrap {
  border: 1px solid var(--xh-border);
  border-radius: var(--xh-radius);
  overflow: auto;
  background: #000;
}
table.xh-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}
.xh-table thead th {
  background: var(--xh-table-head);
  color: var(--xh-table-head-text);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.xh-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--xh-border-soft);
  color: #fff;
  vertical-align: middle;
}
.xh-table tbody tr:hover { background: rgba(0,193,124,.06); }
.xh-link { color: var(--xh-green); cursor: pointer; }
.ops { display: flex; flex-wrap: wrap; gap: 6px 10px; max-width: 220px; }
.ops a, .ops button {
  background: none; border: 0; color: var(--xh-green);
  cursor: pointer; padding: 0; font-size: 13px;
}
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 2px;
  font-size: 12px; line-height: 18px;
}
.tag-red { background: var(--xh-red); color: #fff; margin-left: 6px; }
.tag-blue { color: #60a5fa; }
.tag-green { color: var(--xh-green); }
.tag-gray { color: rgba(255,255,255,.55); }
.status-dot {
  display: inline-flex; align-items: center; gap: 6px;
}
.status-dot::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: currentColor;
}

/* Progress stepper */
.steps {
  display: flex; align-items: flex-start; gap: 0; min-width: 220px;
}
.step {
  display: flex; flex-direction: column; align-items: center; width: 64px; position: relative;
}
.step:not(:last-child)::after {
  content: ""; position: absolute; top: 14px; left: 50%; width: 100%; height: 2px;
  background: rgba(255,255,255,.25); z-index: 0;
}
.step-circle {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  display: grid; place-items: center;
  font-size: 10px; background: #000; z-index: 1; position: relative;
  color: #fff;
}
.step.done .step-circle { border-color: var(--xh-green); background: var(--xh-green); }
.step.active .step-circle { border-color: var(--xh-blue); color: var(--xh-blue); }
.step-name { margin-top: 4px; font-size: 11px; color: rgba(255,255,255,.7); }

/* Dashboard */
.dash-section {
  background: #0b0b0b;
  border: 1px solid var(--xh-border-soft);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 14px;
}
.dash-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.dash-section-hd h3 { margin: 0; font-size: 15px; }
.chip-group { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--xh-border); background: transparent; color: #fff;
  border-radius: 2px; padding: 4px 10px; cursor: pointer; font-size: 12px;
}
.chip.on { background: var(--xh-green); border-color: var(--xh-green); }
.process-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.process-card {
  background: #111; border: 1px solid var(--xh-border-soft);
  border-radius: 6px; padding: 12px;
}
.process-card .ptag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; color: #fff; margin-bottom: 8px;
}
.process-card .big { font-size: 28px; font-weight: 700; line-height: 1.1; }
.process-card .sub { color: var(--xh-muted); font-size: 12px; margin-top: 2px; }
.process-card .stats { float: right; text-align: right; font-size: 12px; color: var(--xh-muted); line-height: 1.7; }
.process-card .bar {
  clear: both; margin-top: 10px; height: 4px; background: rgba(255,255,255,.1);
  border-radius: 999px; overflow: hidden;
}
.process-card .bar > i { display: block; height: 100%; background: var(--xh-blue); }
.process-card .bar.done > i { background: var(--xh-green); }

.kpi-side {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.kpi-cell {
  background: #111; border: 1px solid var(--xh-border-soft);
  border-radius: 6px; padding: 14px 12px; text-align: center;
}
.kpi-cell .v { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi-cell .v.green { color: var(--xh-green); }
.kpi-cell .v.red { color: var(--xh-red); }
.kpi-cell .v.orange { color: var(--xh-orange); }
.kpi-cell .l { color: var(--xh-muted); font-size: 12px; }

.dash-bottom {
  display: grid; grid-template-columns: 1fr 280px; gap: 12px;
}

/* Modal / Form light overlay matching create page */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 16px; overflow: auto;
}
.modal {
  width: min(920px, 100%);
  background: #fff; color: #111;
  border-radius: 4px; padding: 20px 24px 24px;
}
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.form-row { margin-bottom: 14px; display: flex; align-items: flex-start; }
.form-row > label {
  width: 90px; flex-shrink: 0; padding-top: 8px; color: #374151; font-size: 13px;
}
.form-row > label .req { color: #ef4444; margin-right: 2px; }
.form-row .ctrl { flex: 1; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 2px;
  height: 34px; padding: 0 10px; font-size: 13px; color: #111; background: #fff;
}
.form-row textarea { height: 72px; padding: 8px 10px; resize: vertical; }
.modal-actions {
  display: flex; justify-content: center; gap: 12px; margin-top: 20px;
}
.modal .btn-cancel {
  height: 34px; padding: 0 28px; background: #fff; border: 1px solid #d1d5db;
  border-radius: 2px; cursor: pointer;
}
.modal .btn-save {
  height: 34px; padding: 0 28px; background: var(--xh-green); color: #fff;
  border: 0; border-radius: 2px; cursor: pointer;
}

.pager {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 8px; margin-top: 12px; color: rgba(255,255,255,.7);
}
.pager .page {
  min-width: 28px; height: 28px; border: 1px solid var(--xh-border);
  display: grid; place-items: center; border-radius: 2px;
}
.pager .page.on { background: var(--xh-green); border-color: var(--xh-green); color: #fff; }

.empty {
  padding: 48px; text-align: center; color: var(--xh-muted);
}

.toast-wrap {
  position: fixed; right: 20px; top: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  min-width: 220px; max-width: 360px; padding: 10px 14px;
  border-radius: 6px; background: #111827; color: #fff;
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font-size: 13px; animation: toastIn .18s ease;
}
.toast.ok { border-color: rgba(0,193,124,.5); }
.toast.err { border-color: rgba(255,77,79,.55); background: #2a1214; }
.toast.info { border-color: rgba(59,130,246,.45); }
@keyframes toastIn { from { opacity:0; transform: translateY(-6px);} to { opacity:1; transform:none;} }

.loading-mask {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.28); display: grid; place-items: center;
}
.loading-box {
  background: #111; border: 1px solid var(--xh-border); color: #fff;
  padding: 14px 22px; border-radius: 8px; font-size: 13px;
}

@media (max-width: 1100px) {
  .process-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-bottom { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
}
