/* DocSign – app.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #f5f5f7;
  --surface: #ffffff;
  --border:  #e2e2e8;
  --text:    #1a1a2e;
  --muted:   #6b6b7b;
  --accent:  #4f46e5;
  --accent2: #7c3aed;
  --success: #059669;
  --danger:  #dc2626;
  --radius:  10px;
  --shadow:  0 1px 4px rgba(0,0,0,.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }

/* ── Navbar ── */
.navbar { background: var(--surface); border-bottom: 1px solid var(--border);
          padding: 0 24px; height: 56px; display: flex; align-items: center;
          justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-weight: 700; font-size: 17px; text-decoration: none; color: var(--text); }
.nav-right  { display: flex; align-items: center; gap: 16px; }
.nav-user   { color: var(--muted); font-size: 14px; }

/* ── Layout ── */
.container    { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.container-sm { max-width: 640px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px;
       padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
       cursor: pointer; text-decoration: none; border: none; transition: .15s; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #4338ca; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-full     { width: 100%; justify-content: center; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Auth page ── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card  { background: var(--surface); border-radius: 16px; padding: 40px;
              width: 100%; max-width: 420px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-logo  { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.auth-card h1 { font-size: 20px; margin-bottom: 24px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--accent); }

/* ── Forms ── */
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px;
        font-weight: 500; margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=file] {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--bg); width: 100%; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
input[type=file] { padding: 6px 12px; }
label small { color: var(--muted); font-weight: 400; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-card { background: var(--surface); border: 1px solid var(--border);
             border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ── Dashboard table ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; }
.doc-table-wrap { background: var(--surface); border-radius: var(--radius);
                  border: 1px solid var(--border); overflow: hidden; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { padding: 12px 16px; text-align: left; font-size: 12px; text-transform: uppercase;
                letter-spacing: .05em; color: var(--muted); background: var(--bg);
                border-bottom: 1px solid var(--border); }
.doc-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.doc-table tr:last-child td { border-bottom: none; }
.doc-table small { color: var(--muted); }
.actions { display: flex; gap: 12px; }
.actions a { color: var(--accent); font-size: 13px; text-decoration: none; }
.actions a:hover { text-decoration: underline; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-gray  { background: #f3f4f6; color: #374151; }
.badge-blue  { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #f0fdf4; color: #166534; }
.badge-red   { background: #fef2f2; color: #991b1b; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .btn { margin-top: 16px; }

/* ── Signer list ── */
.signer-list { background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.signer-list h2 { padding: 16px 20px 0; font-size: 16px; }
.signer-row { display: flex; align-items: center; justify-content: space-between;
              padding: 14px 20px; border-bottom: 1px solid var(--border); }
.signer-row:last-child { border-bottom: none; }

/* ── Document detail ── */
.back-link { display: inline-block; color: var(--muted); font-size: 14px;
             text-decoration: none; margin-bottom: 16px; }
.back-link:hover { color: var(--text); }
.header-actions { display: flex; gap: 10px; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 16px; margin-bottom: 16px; }
.audit-log { max-height: 300px; overflow-y: auto; }
.audit-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-row:last-child { border-bottom: none; }
.audit-action { font-weight: 500; }
.audit-meta   { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Sign page ── */
.pdf-viewer-wrap { background: #000; border-radius: 8px; overflow: hidden;
                   margin: 20px 0; height: 500px; }
.pdf-frame { width: 100%; height: 100%; border: none; }
.signature-section { background: var(--surface); border: 2px dashed var(--border);
                     border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.signature-section h2 { font-size: 16px; margin-bottom: 6px; }
#sig-canvas { display: block; width: 100%; max-width: 600px; height: 180px;
              border: 1px solid var(--border); border-radius: 8px; background: #fafaf9;
              touch-action: none; cursor: crosshair; margin: 12px 0; }
.sig-actions { margin-bottom: 8px; }
.checkbox-label { display: flex; flex-direction: row; align-items: flex-start; gap: 10px;
                  font-size: 13px; color: var(--muted); margin: 16px 0; font-weight: 400; }
.checkbox-label input { margin-top: 2px; flex-shrink: 0; }

/* ── Success ── */
.sign-success { text-align: center; padding: 60px 24px; }
.success-icon { font-size: 48px; margin-bottom: 16px; }
.sign-success h2 { font-size: 24px; margin-bottom: 8px; }

/* ── Utility ── */
.text-muted { color: var(--muted); font-size: 14px; }
.mt-1 { margin-top: 12px; }

@media (max-width: 700px) {
  .doc-grid { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
