@import url('tokens.css');
/* PageCraft — shared UI components. Palette + fonts now live in tokens.css (single source). */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font-ui);
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-ui); letter-spacing: -0.01em; line-height: 1.15; }
a { color: var(--ink); text-decoration: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: 16px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: white; }
.btn-primary:hover { transform: translateY(-1px); background: #000; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-deep); }
.btn-ghost { background: white; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-sand-soft); border-color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink-muted); }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; font-family: inherit; font-size: 14.5px;
  border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink);
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 90px; }

/* Card */
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow-sm); }

/* Top nav */
.app-nav { position: sticky; top: 0; z-index: 50; background: rgba(251, 247, 242, 0.85); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
.app-nav-inner { max-width: 1200px; margin: 0 auto; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; }
.app-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; font-family: 'Plus Jakarta Sans', sans-serif; }
.app-logo-mark { width: 30px; height: 30px; background: var(--ink); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; }
.app-logo-mark svg { width: 16px; height: 16px; stroke-width: 2.5; }
.app-nav-right { display: flex; gap: 16px; align-items: center; }
.tenant-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: white; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink); }
.tenant-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.user-chip:hover { background: var(--bg-sand-soft); }
.user-chip .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }

/* Layout */
.wrap { max-width: 1200px; margin: 0 auto; padding: 48px 28px; }
.wrap-narrow { max-width: 560px; margin: 0 auto; padding: 64px 28px; }
.page-head { margin-bottom: 32px; }
.page-head h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; margin-bottom: 8px; }
.page-head p { color: var(--ink-soft); font-size: 16px; }
.page-head .row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

/* Empty + loading */
.empty { text-align: center; padding: 64px 24px; color: var(--ink-soft); border: 2px dashed var(--line); border-radius: 20px; background: var(--bg-sand-soft); }
.empty .icon-circle { width: 72px; height: 72px; border-radius: 50%; background: var(--bg-sand); color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty .icon-circle svg { width: 32px; height: 32px; stroke-width: 1.5; }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 18px; }
.empty p { font-size: 14px; margin-bottom: 20px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Alerts */
.alert { padding: 14px 16px; border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-ok   { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warn { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-err  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: var(--accent-soft); color: var(--accent-deep); border: 1px solid #FACEC0; }

/* Project / tenant grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.tile { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 24px; transition: all 0.2s; cursor: pointer; text-decoration: none; color: inherit; display: block; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent-soft); }
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.tile-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--bg-sand); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.tile-icon svg { width: 22px; height: 22px; stroke-width: 1.75; }
.tile h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.tile p { color: var(--ink-soft); font-size: 13.5px; line-height: 1.5; margin-bottom: 14px; min-height: 40px; }
.tile-meta { display: flex; gap: 14px; font-size: 12px; color: var(--ink-muted); padding-top: 12px; border-top: 1px solid var(--line-soft); }
.tile-meta strong { color: var(--ink); font-weight: 600; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-draft     { background: var(--bg-sand); color: var(--ink-soft); }
.badge-published { background: #D1FAE5; color: #065F46; }
.badge-archived  { background: #FEE2E2; color: #991B1B; }
