@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #0d1120;
    --panel: #141a2b;
    --border: #2a3350;
    --text: #e8e6df;
    --muted: #8f97b3;
    --faint: #5c6584;
    --accent: #c9a05c;
    --accent-light: #e8c98a;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- Auth pages ---------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 18px; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #8a6a35); color: var(--bg); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.auth-card h1 { font-family: 'Cormorant Garamond', serif; font-size: 26px; margin: 4px 0; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 4px; }
.auth-card label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-top: 10px; }
.auth-card input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 14px; margin-top: 4px; }
.btn-primary { margin-top: 20px; background: var(--accent); color: var(--bg); border: none; border-radius: 8px; padding: 11px; font-weight: 600; font-size: 14px; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; }
.btn-primary:hover { background: var(--accent-light); }
.alt-link { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.alt-link a { color: var(--accent); text-decoration: none; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: #3a1a1a; color: #ff9999; border: 1px solid #5a2a2a; }
.alert-success { background: #1a3a24; color: #9ae6b4; border: 1px solid #2a5a3a; }

/* ---------- Nav ---------- */
.topnav { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.topnav-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.topnav-links a { margin-left: 20px; font-size: 13px; color: var(--muted); text-decoration: none; }
.topnav-links a:hover { color: var(--accent); }

/* ---------- Dashboard ---------- */
.page { padding: 28px 24px; max-width: 960px; margin: 0 auto; }
.page h1 { font-family: 'Cormorant Garamond', serif; font-size: 28px; margin-bottom: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 22px 0; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-label { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; margin: 0 0 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--accent-light); margin: 0; }
.stat-value-sm { font-size: 15px; font-weight: 600; margin: 0; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.btn-cta { margin-top: 6px; }
.section-heading { font-family: 'Cormorant Garamond', serif; font-size: 20px; margin-top: 32px; }
.empty-note { color: var(--faint); font-size: 13px; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }

/* ---------- Builder layout ---------- */
.builder-topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; border-bottom: 1px solid var(--border); }
.save-status { font-size: 12px; color: var(--faint); }
.export-actions { display: flex; gap: 10px; }
.btn-outline { border: 1px solid var(--accent); color: var(--accent-light); padding: 8px 14px; border-radius: 8px; font-size: 13px; text-decoration: none; }
.btn-outline:hover { background: var(--accent); color: var(--bg); }

.builder-layout { display: grid; grid-template-columns: 220px 1fr 1fr; min-height: calc(100vh - 105px); }

.step-nav { border-right: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.step-btn { background: none; border: none; color: var(--muted); text-align: left; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.step-btn:hover { background: var(--panel); }
.step-btn.active { background: var(--panel); color: var(--accent-light); }

.form-panel { padding: 22px 24px; border-right: 1px solid var(--border); overflow-y: auto; max-height: calc(100vh - 105px); }
.form-panel h2 { font-family: 'Cormorant Garamond', serif; font-size: 21px; margin: 0 0 14px; }
.form-panel label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 10px 0 4px; }
.form-panel input, .form-panel select, .form-panel textarea {
    width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
    padding: 9px 11px; color: var(--text); font-size: 13.5px; font-family: inherit;
}
.form-panel input:focus, .form-panel select:focus, .form-panel textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-row { margin-bottom: 14px; }
.hint { font-size: 11px; color: var(--faint); display: block; margin-top: 6px; }

.photo-uploader { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.photo-thumb { width: 64px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.photo-placeholder { background: var(--panel); }

.label-row { display: flex; align-items: center; justify-content: space-between; }
.btn-translate {
    background: none; border: 1px solid #3a4570; color: var(--muted); border-radius: 6px;
    padding: 5px 10px; font-size: 11.5px; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.btn-translate:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-translate:disabled { opacity: 0.6; cursor: wait; }
.btn-translate-inline { margin-left: auto; }

.section-head { display: flex; align-items: center; justify-content: space-between; }
.btn-add { background: none; border: 1px solid var(--accent); color: var(--accent-light); border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer; }
.btn-add:hover { background: var(--accent); color: var(--bg); }

.record-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; position: relative; }
.card-delete { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--faint); cursor: pointer; font-size: 13px; }
.card-delete:hover { color: #ff8080; }

.lang-row { display: grid; grid-template-columns: 1fr 140px 28px; gap: 8px; margin-bottom: 8px; align-items: center; }

.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doc-item { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.doc-label { display: block; font-size: 13px; font-weight: 500; }
.doc-status { display: block; font-size: 11.5px; color: var(--muted); margin: 4px 0 8px; }
.doc-input { font-size: 11px; }

.template-grid { display: grid; gap: 10px; }
.template-card { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer; color: var(--text); }
.template-card.selected { border-color: var(--accent); background: #1e2540; }
.tpl-name { display: block; font-weight: 600; font-size: 14px; }
.tpl-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.preview-panel { background: #0a0d18; padding: 20px; display: flex; justify-content: center; overflow-y: auto; max-height: calc(100vh - 105px); }
.preview-frame { width: 100%; max-width: 700px; height: 1400px; border: none; background: #fff; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }

@media (max-width: 1100px) {
    .builder-layout { grid-template-columns: 1fr; }
    .step-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .form-panel, .preview-panel { border-right: none; max-height: none; }
}
