:root {
  --ink: #14161c;
  --paper: #f6f5f2;
  --panel: #ffffff;
  --line: #e4e2dc;
  --muted: #6f7280;
  --accent: #3d3ff2;
  --accent-soft: #eceaff;
  --radius: 10px;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #1c1e2b, #0c0d13 65%);
}
.login-card {
  background: var(--panel);
  padding: 48px 40px;
  border-radius: 16px;
  width: 380px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
}
.login-logo { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.login-sub { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 28px; }
.ms-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid #d0d0d0; border-radius: 6px; padding: 12px 16px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px;
  transition: background .15s;
}
.ms-btn:hover { background: #f2f2f2; }
.login-fine { color: #9a9ca5; font-size: 12px; margin-top: 18px; }

/* ---------- App shell ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--ink); color: #fff;
}
.topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.topbar nav a { color: #c9cad6; text-decoration: none; margin-left: 20px; font-size: 14px; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c9cad6; }
.topbar .who img { width: 28px; height: 28px; border-radius: 50%; }
.topbar .who a { color: #c9cad6; font-size: 12px; text-decoration: underline; }

.layout { display: grid; grid-template-columns: 360px 1fr; gap: 0; min-height: calc(100vh - 58px); }
.panel-scroll { padding: 24px; overflow-y: auto; }
.controls { border-right: 1px solid var(--line); background: var(--panel); }
.preview-pane { background: #eceeF4; display: flex; flex-direction: column; }

h2.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
h2.section-title:first-child { margin-top: 0; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input[type=text], .field input[type=url], .field input[type=tel], .field input[type=email] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.template-card {
  border: 2px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; font-size: 12px; text-align: center; background: #fff;
}
.template-card.selected { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 40px; height: 32px; border: none; background: none; padding: 0; cursor: pointer; }

.upload-row { display: flex; align-items: center; gap: 10px; }
.upload-row img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f2f2f2; }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600; }
.btn:hover { background: #f4f4f4; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: 12px; }

.preview-toolbar { padding: 16px 24px; border-bottom: 1px solid #d9dbe4; display: flex; align-items: center; justify-content: space-between; }
.preview-toolbar .status { font-size: 12px; color: var(--muted); }
.preview-surface { flex: 1; padding: 40px; display: flex; align-items: flex-start; justify-content: center; }
.preview-card { background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(20,22,28,0.08); padding: 32px; min-width: 460px; }
.preview-actions { display: flex; gap: 10px; padding: 0 24px 24px; }
.html-box { width: 100%; height: 160px; font-family: monospace; font-size: 11px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- Team page ---------- */
.team-wrap { padding: 24px 32px; max-width: 1100px; margin: 0 auto; }
table.roster { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 16px rgba(20,22,28,0.05); }
table.roster th, table.roster td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.roster th { background: #f0f0ee; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.yes { background: #e5f6ea; color: #1d7a3c; }
.badge.no { background: #f2f2f2; color: #888; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transform: translateY(10px); transition: all .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Admin console ---------- */
.admin-wrap { padding: 24px 32px; max-width: 1100px; margin: 0 auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab-btn { border: none; background: none; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-row input[type=text], .form-row input[type=url], .form-row input[type=date], .form-row select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
}
.form-row input[type=checkbox] { margin-right: 6px; }
.item-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.item-row:last-child { border-bottom: none; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.pill.active { background: #e5f6ea; color: #1d7a3c; }
.pill.inactive { background: #f2f2f2; color: #888; }
.status-badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-badge.draft { background: #f2f2f2; color: #777; }
.status-badge.pending { background: #fff4e0; color: #a15c00; }
.status-badge.approved { background: #e5f6ea; color: #1d7a3c; }
.status-badge.rejected { background: #fde8e8; color: #b42318; }
.status-badge.none { background: #f2f2f2; color: #aaa; }
.result-box { background: #f6f5f2; border-radius: 8px; padding: 12px; font-size: 12px; margin-top: 12px; white-space: pre-wrap; }
.approval-preview { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 10px 0; background: #fafafa; }
