:root {
  --navy: #143226;
  --navy-2: #1d4636;
  --paper: #f2efe6;
  --ink: #1a1a17;
  --rust: #b5532a;
  --green: #2f7d57;
  --line: rgba(0,0,0,.12);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: var(--paper); padding: 12px 22px;
}
.brand { color: var(--paper); text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.brand span { color: #7ec8a4; }
.topbar nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar .who { opacity: .85; }
.topbar .link { color: #cfe6da; }
.topbar .switch { color: #143226; background: #7ec8a4; text-decoration: none;
  font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 7px; }
.topbar .switch:hover { background: #94d6b6; }
.wrap { max-width: 880px; margin: 26px auto; padding: 0 18px; }
h1 { margin: 0 0 4px; font-size: 26px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: #5d6b62; }
.small { font-size: 13px; }
.sub { margin-bottom: 18px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.link { color: var(--rust); text-decoration: none; }
.link:hover { text-decoration: underline; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin: 16px 0; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card.center { text-align: center; }
.narrow { max-width: 440px; margin: 60px auto; }
.card.ok { border-left: 4px solid var(--green); }
.card.error { border-left: 4px solid #b5392a; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.card.client { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .05s; }
.card.client:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-1px); }
.ctitle { font-weight: 700; font-size: 16px; }
.meta { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: #5d6b62; }
.pill { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-variant-numeric: tabular-nums; }

.form { display: grid; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #41504a; font-weight: 600; }
.form input, .form select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
.form .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form .check input { width: auto; }
.req { color: var(--rust); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.email-edit { font: 13px/1.5 ui-monospace, "SF Mono", Consolas, monospace; width: 100%;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  resize: vertical; }
.hint { font-weight: 400; font-size: 12px; color: #5d6b62; margin-top: 2px; }
.hint b { color: var(--navy); }

.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--navy);
  background: #fff; color: var(--navy); text-decoration: none; justify-self: start;
}
.btn:hover { background: var(--paper); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-danger { border-color: #b5392a; color: #b5392a; background: #fff; }
.btn-danger:hover:not(:disabled) { background: #b5392a; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.modal { position: fixed; inset: 0; z-index: 50; padding: 18px;
  background: rgba(20,30,25,.55); display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 12px; padding: 22px 24px; width: 100%; max-width: 460px;
  max-height: 90vh; overflow: auto; box-shadow: 0 16px 48px rgba(0,0,0,.3); }
.modal-card h3 { margin: 0 0 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-form { margin-top: 12px; padding: 14px; border: 1px solid rgba(181,57,42,.35); border-radius: 8px; background: rgba(181,57,42,.04); }
code { background: #f1efe8; padding: 1px 6px; border-radius: 4px; font: 13px ui-monospace, monospace; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #5d6b62; }

.warn { color: #8a5a12; font-size: 14px; }
pre { background: #f7f6f1; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; white-space: pre-wrap; }
pre.email { font: 13px/1.5 ui-monospace, monospace; }
details summary { cursor: pointer; font-weight: 600; margin-top: 8px; }
