/* Signera – gemensam stil. Ljust tema med guld/svart accent. */

:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1c1a16;
  --muted: #6f6a60;
  --line: #e8e2d4;
  --gold: #c9a659;
  --gold-dark: #a8842e;
  --black: #14120e;
  --green: #2e7d4f;
  --red: #b23a3a;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

header.topbar {
  background: var(--black);
  color: var(--gold);
  padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between;
}
header.topbar .brand { font-weight: 700; letter-spacing: 3px; font-size: 15px; }
header.topbar .sub { color: #8f8878; font-size: 12px; }

main { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { font-size: 17px; margin-bottom: 14px; }
.card h2 .accent { color: var(--gold-dark); }

label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .5px; }
input[type=text], input[type=email], input[type=password], textarea, input[type=file] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; background: #fdfcfa; color: var(--ink);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }

button, .btn {
  display: inline-block; border: 0; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; padding: 11px 20px; text-decoration: none;
  background: var(--black); color: var(--gold);
}
button:hover, .btn:hover { filter: brightness(1.25); }
button.secondary, .btn.secondary { background: #efece4; color: var(--ink); }
button.danger { background: #f7ecec; color: var(--red); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: 6px 12px; font-size: 12px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .4px; }
.badge.sent      { background: #eee9db; color: #7a6a3d; }
.badge.viewed    { background: #e3ecf5; color: #3a5a7d; }
.badge.pending   { background: #efece4; color: var(--muted); }
.badge.signed,
.badge.completed { background: #e2f0e7; color: var(--green); }
.badge.declined,
.badge.cancelled { background: #f7ecec; color: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #faf8f2; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; }
.mt { margin-top: 14px; }
.hidden { display: none !important; }

.notice { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin: 12px 0; }
.notice.warn { background: #fdf6e3; border: 1px solid #ecdcae; color: #7a6a3d; }
.notice.ok   { background: #e2f0e7; border: 1px solid #bcd9c6; color: var(--green); }
.notice.err  { background: #f7ecec; border: 1px solid #e3c1c1; color: var(--red); }

/* Signatärsrader i skapa-formuläret */
.signer-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.signer-row input { flex: 1; }
.signer-row button { flex: 0 0 auto; }

/* Inloggning – samma stil som Planner: mörk fond, kort med Staffler-orben. */
.login {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background:
    radial-gradient(700px 460px at 50% -10%, rgba(201, 166, 89, .16), transparent 70%),
    #14120e;
}
.login-card {
  width: min(360px, 90vw); background: #1c1914;
  border: 1px solid #3a332a; border-radius: 20px; padding: 36px 28px;
  display: grid; gap: 12px; justify-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.login-card h1 { color: var(--gold); font-size: 30px; letter-spacing: 6px; margin-top: 8px; }
.login-card .login-sub { color: #8f8878; font-size: 13px; }
.login-card input {
  width: 100%; padding: 13px 16px; text-align: center; letter-spacing: 6px; font-size: 18px;
  background: #14120e; border: 1px solid #3a332a; border-radius: 12px; color: #ece9e0;
}
.login-card input:focus { outline: none; border-color: var(--gold); }
.login-card button {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: linear-gradient(120deg, #a8842e, #c9a659 60%, #e8c67a);
  color: #14120e; font-weight: 800; font-size: 15px; letter-spacing: .5px;
}
.login-error { color: #ff6b5e; font-size: 13px; }
.login-orb { display: block; filter: drop-shadow(0 12px 34px rgba(201, 166, 89, .35)); cursor: default; }

/* Kodruta (identitetsverifiering på signeringssidan) */
.code-input {
  text-align: center; letter-spacing: 10px; font-size: 24px; max-width: 260px;
  font-family: ui-monospace, Menlo, monospace;
}
.code-chip {
  display: inline-block; font-family: ui-monospace, Menlo, monospace; font-weight: 700;
  background: #f3efe5; border: 1px dashed var(--gold); border-radius: 8px;
  padding: 4px 10px; letter-spacing: 3px; font-size: 14px;
}

/* PDF-förhandsgranskning */
#pdf-pages { background: #dcd7cb; border-radius: var(--radius); padding: 14px; max-height: 62vh; overflow-y: auto; }
#pdf-pages canvas { display: block; margin: 0 auto 14px; max-width: 100%; height: auto; box-shadow: 0 2px 10px rgba(0,0,0,.18); background: #fff; }

/* Signaturruta */
.sig-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.sig-tabs button { background: #efece4; color: var(--ink); }
.sig-tabs button.active { background: var(--black); color: var(--gold); }
#sig-canvas { width: 100%; height: 160px; border: 2px dashed var(--line); border-radius: 8px; background: #fdfcfa; touch-action: none; }
.sig-line { border-top: 1px solid var(--muted); margin-top: -28px; margin-left: 8%; margin-right: 8%; pointer-events: none; position: relative; }

/* Stämpel-look på bekräftelser */
.stamp {
  display: inline-block; border: 3px solid var(--gold); color: var(--gold-dark);
  border-radius: 10px; padding: 8px 22px; font-weight: 800; letter-spacing: 3px;
  transform: rotate(-4deg); font-size: 18px;
}

/* Tidslinje (verifiering) */
.timeline { list-style: none; }
.timeline li { padding: 10px 0 10px 22px; border-left: 2px solid var(--line); position: relative; font-size: 14px; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--gold); border: 2px solid #fff;
}

@media (max-width: 640px) {
  .card { padding: 16px; }
  td, th { padding: 8px 6px; }
}
