:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #047857;
  --warn: #b45309;
  --danger: #b91c1c;
  --amber-bg: #fef3c7;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px -12px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--primary); }

/* ---- login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--card); padding: 40px 44px; border-radius: 16px;
  box-shadow: var(--shadow); text-align: center; max-width: 360px; width: 90%;
}
.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { font-size: 20px; margin: 6px 0 4px; }
.login-card p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.btn-google {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  background: var(--primary); color: #fff; text-decoration: none;
  padding: 11px 22px; border-radius: 10px; font-weight: 600; font-size: 15px; width: 100%;
}
.btn-google:hover { background: var(--primary-dark); }
.btn-google .g {
  background: #fff; color: var(--primary); width: 22px; height: 22px;
  border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800;
}

/* ---- shell ---- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 10px 22px; position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar nav { display: flex; gap: 4px; margin-inline-start: 8px; }
.topbar nav a {
  text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 14px;
}
.topbar nav a.active, .topbar nav a:hover { background: #eef2ff; color: var(--primary); }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.topbar .who img { width: 28px; height: 28px; border-radius: 50%; }

.container { max-width: 1000px; margin: 0 auto; padding: 22px; }

.testing-banner {
  background: var(--amber-bg); color: var(--warn); border: 1px solid #fcd34d;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  margin-bottom: 18px; display: flex; gap: 8px; align-items: center;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.card .big { font-size: 30px; font-weight: 800; }
.card .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card.warn .big { color: var(--warn); }

.section { margin-top: 26px; }
.section h2 { font-size: 17px; margin: 0 0 12px; }

table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.grid th, table.grid td { text-align: right; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
table.grid th { background: #fafbfc; color: var(--muted); font-weight: 600; }
table.grid tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.sent { background: #dcfce7; color: var(--ok); }
.pill.dry { background: #e5e7eb; color: var(--muted); }
.pill.err { background: #fee2e2; color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #fca5a5; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---- settings ---- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h2 { margin: 0 0 4px; font-size: 16px; }
.panel .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
label.field { display: block; margin: 12px 0; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff;
}
input[type=text]:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }

.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; border: 1px solid var(--line); border-bottom: none; border-radius: 9px 9px 0 0; padding: 6px; background: #fafbfc; }
.editor-toolbar button { border: 1px solid transparent; background: transparent; cursor: pointer; padding: 5px 9px; border-radius: 6px; font-size: 14px; font-weight: 700; min-width: 32px; }
.editor-toolbar button:hover { background: #eef2ff; }
.editor-toolbar select { width: auto; padding: 5px 8px; font-size: 13px; }
.rich {
  min-height: 180px; border: 1px solid var(--line); border-radius: 0 0 9px 9px;
  padding: 12px 14px; background: #fff; font-size: 14px; line-height: 1.7; overflow-y: auto;
}
.rich:focus { outline: 2px solid #bfdbfe; }

.status-line { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--ok); } .dot.gray { background: #9ca3af; }

.preview-box { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; margin-top: 12px; background: #fff; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.toast { position: fixed; bottom: 20px; inset-inline-start: 20px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 14px; opacity: 0; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: 1; }
