/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; color: #333; line-height: 1.5; }

/* === Nav === */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; background: #fff; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-weight: 700; font-size: 1.1rem; color: #1a73e8; text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-link { text-decoration: none; color: #555; font-size: 0.9rem; padding: 0.25rem 0.5rem; border-radius: 4px; transition: background 0.15s; }
.nav-link:hover, .nav-link.active { background: #e8f0fe; color: #1a73e8; }

/* === Buttons === */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border: none; border-radius: 6px; font-size: 0.9rem; cursor: pointer; transition: background 0.15s; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-secondary:hover { background: #ccc; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d8f47; }
.btn-warning { background: #f9ab00; color: #fff; }
.btn-warning:hover { background: #e09600; }
.btn-danger { background: #ea4335; color: #fff; }
.btn-danger:hover { background: #c5221f; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-ms { background: #2f2f2f; color: #fff; padding: 0.6rem 1.2rem; font-size: 1rem; }
.btn-ms:hover { background: #444; }

/* === Layout === */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.card { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #555; margin-bottom: 0.25rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.9rem; transition: border-color 0.15s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,0.15); }
.form-group input[type="color"] { height: 38px; padding: 2px; cursor: pointer; }

/* === Login === */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 80vh; text-align: center; }
.login-box { max-width: 400px; }
.login-box h1 { font-size: 1.8rem; margin-bottom: 0.5rem; color: #1a73e8; }
.login-box p { color: #666; margin-bottom: 1.5rem; }

/* === Signature Preview === */
.signature-preview { border: 1px dashed #ccc; padding: 1rem; background: #fff; min-height: 200px; }
.signature-preview iframe { width: 100%; border: none; min-height: 250px; }
.copy-feedback { display: none; color: #34a853; font-weight: 600; font-size: 0.85rem; margin-top: 0.5rem; }
.copy-feedback.show { display: block; }

/* === Tabs === */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 1rem; }
.tab { padding: 0.5rem 1rem; cursor: pointer; font-size: 0.9rem; border: none; background: none; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab:hover { color: #1a73e8; }
.tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Instructions === */
.instructions ol { padding-left: 1.5rem; }
.instructions li { margin-bottom: 0.5rem; line-height: 1.6; }
.source-link { font-size: 0.8rem; color: #888; margin-top: 0.5rem; }
.source-link a { color: #1a73e8; }

/* === Admin: Brands Table === */
.brand-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.brand-table th, .brand-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
.brand-table th { font-weight: 600; color: #555; background: #f9f9f9; }
.brand-table input { width: 100%; padding: 0.3rem 0.5rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85rem; }
.brand-table input[type="color"] { width: 40px; height: 28px; padding: 1px; }
.color-preview { display: inline-block; width: 20px; height: 20px; border-radius: 3px; border: 1px solid #ddd; vertical-align: middle; margin-right: 4px; }

/* === Admin: Template Editor === */
.template-editor { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; }
.template-editor .editor-main { min-height: 500px; }
.placeholder-panel { max-height: 500px; overflow-y: auto; }
.placeholder-group h4 { font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin: 0.75rem 0 0.25rem; }
.placeholder-chip { display: inline-block; padding: 0.2rem 0.5rem; margin: 0.15rem; background: #e8f0fe; color: #1a73e8; border-radius: 4px; font-size: 0.75rem; font-family: monospace; cursor: pointer; transition: background 0.15s; user-select: none; }
.placeholder-chip:hover { background: #c6dafc; }
.preview-brand-select { margin-bottom: 0.75rem; }
.preview-brand-select select { padding: 0.3rem 0.5rem; border: 1px solid #ddd; border-radius: 4px; }

/* === Toast === */
.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.75rem 1.25rem; border-radius: 6px; color: #fff; font-size: 0.9rem; z-index: 9999; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.success { background: #34a853; }
.toast.error { background: #ea4335; }
