:root {
  --bg: #f6f3ed;
  --panel: #ffffff;
  --text: #151515;
  --muted: #6e6a62;
  --line: #e6e0d5;
  --gold: #b89354;
  --gold-soft: #efe4cf;
  --dark: #111111;
  --green: #2f7a55;
  --green-soft: #e8f3ec;
  --amber: #9c6a22;
  --amber-soft: #f7eddc;
  --red: #9a4343;
  --red-soft: #f6e6e6;
  --shadow: 0 12px 30px rgba(32, 24, 12, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, select { font: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  background: var(--dark);
  color: white;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 26px 18px 20px;
  position: sticky;
  top: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 30px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #d6ba83, #8f6a2f);
  color: #111; font-weight: 800; font-size: 22px;
}
.brand-name { font-weight: 700; letter-spacing: .4px; }
.brand-sub { color: #aaa; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%; border: 0; color: #d4d4d4; background: transparent;
  text-align: left; padding: 12px 13px; border-radius: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-item:hover { background: #1b1b1b; color: white; }
.nav-item.active { background: #26231f; color: white; box-shadow: inset 3px 0 var(--gold); }
.badge { background: #3a342c; color: #d9bd89; padding: 2px 7px; border-radius: 999px; font-size: 11px; }
.sidebar-footer { margin-top: auto; padding-top: 20px; }
.tenant-chip { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid #2a2a2a; border-radius: 12px; }
.tenant-chip small { display: block; color: #939393; margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: #52b47a; box-shadow: 0 0 0 4px rgba(82,180,122,.12); }

.main { padding: 26px 32px 44px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 4px 0 0; font-size: 28px; }
.eyebrow { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.project-select { border: 1px solid var(--line); background: transparent; padding: 10px 12px; border-radius: 10px; min-width: 230px; }
.btn { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--dark); color: white; }
.btn.ghost { background: transparent; color: var(--text); }
.btn.small { padding: 7px 10px; font-size: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); color: #6f5124; display: grid; place-items: center; font-weight: 700; }

.hero-card, .panel, .metric-card { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero-card { border-radius: var(--radius); padding: 24px; display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.hero-card h2 { margin: 8px 0 8px; font-size: 24px; }
.hero-card p { margin: 0; color: var(--muted); }
.meta-line { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px 18px; color: #777269; font-size: 12px; }
.meta-line code { color: #48391e; background: #f5efe5; padding: 3px 6px; border-radius: 6px; }
.status-panel { text-align: right; min-width: 180px; }
.status-panel small { display: block; color: var(--muted); margin-top: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.status-pill.running { color: var(--green); background: var(--green-soft); }

.metrics-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.metric-card { border-radius: 14px; padding: 17px; min-height: 120px; }
.metric-label { color: var(--muted); font-size: 12px; min-height: 34px; }
.metric-value { font-size: 30px; font-weight: 750; margin: 8px 0 4px; }
.metric-note { color: var(--muted); font-size: 11px; }
.metric-card.alert { border-color: #ead8b5; background: #fffdf8; }

.content-grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: 1.15fr .85fr; }
.lower-grid { margin-top: 16px; }
.panel { border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h3 { margin: 5px 0 0; font-size: 18px; }
.count-pill { background: var(--gold-soft); color: #785b2b; padding: 5px 9px; border-radius: 999px; font-size: 12px; }
.link-btn { background: none; border: none; color: #87652f; padding: 0; }

.task-list, .activity-feed { display: grid; gap: 10px; }
.task-item { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.task-item.done { opacity: .55; }
.task-title { font-weight: 650; }
.task-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.task-actions { display: flex; gap: 8px; }
.task-actions button { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 7px 9px; }
.task-actions .primary { background: var(--dark); color: white; border-color: var(--dark); }

.activity-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.activity-text { font-size: 13px; }
.activity-time { font-size: 11px; color: var(--muted); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: #faf8f3; color: #6d685f; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.grade { font-weight: 800; }
.grade.a { color: var(--green); }
.pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }

.placeholder { background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.placeholder h2 { margin-top: 0; }
.placeholder p { color: var(--muted); max-width: 760px; line-height: 1.7; }
.placeholder code { background: #f6f1e8; padding: 3px 6px; border-radius: 6px; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; }
  .nav { grid-template-columns: repeat(4, 1fr); }
  .sidebar-footer { display: none; }
  .main { padding: 20px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .project-select { min-width: 0; flex: 1; }
  .hero-card { flex-direction: column; }
  .status-panel { text-align: left; }
}
@media (max-width: 560px) {
  .nav { grid-template-columns: repeat(2, 1fr); }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-line { flex-direction: column; gap: 6px; }
}
.hidden { display: none !important; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: transparent; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #f7ead2 0, #f6f3ed 34%, #eee9df 100%); }
.login-card { width: min(430px, 100%); background: transparent; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 70px rgba(32,24,12,.12); padding: 34px; text-align: center; }
.login-logo { width: 82px; height: 82px; border-radius: 22px; object-fit: cover; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(141,100,37,.18); }
.login-card h1 { margin: 8px 0 4px; font-size: 30px; }
.login-card > p { margin: 0 0 24px; color: var(--muted); }
.login-form { display: grid; gap: 14px; text-align: left; }
.login-form label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: #5e594f; }
.login-form input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; background: #fff; outline: none; }
.login-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,147,84,.12); }
.login-form .btn { margin-top: 4px; padding: 12px 14px; }
.login-error { min-height: 18px; color: var(--red); font-size: 12px; text-align: center; }
.demo-note { display: block; color: #9a958c; margin-top: 18px; line-height: 1.5; }
.avatar { border: 0; }
.project-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 14px; margin-top: 18px; }
.project-card { text-align: left; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 18px; display: grid; gap: 8px; }
.project-card:hover, .project-card.selected { border-color: #ceb78d; background: #fffaf1; }
.project-card span { color: var(--muted); font-size: 13px; }
.project-card code { font-size: 11px; color: #75592d; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.settings-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; }
.settings-card p { margin-bottom: 12px; }
@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; } }
