:root {
    --primary: #1a4b8c;
    --bg: #f5f6f8;
    --card: #ffffff;
    --border: #dfe3e8;
    --text: #1f2430;
    --muted: #667085;
    --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

header {
    background: var(--primary);
    color: #fff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 { font-size: 18px; margin: 0; }

#header-actions { display: flex; align-items: center; }
#header-actions a { color: #fff; font-size: 13px; }
#header-actions a:hover { text-decoration: none; }

input:disabled, select:disabled, textarea:disabled { background: #f0f1f3; color: var(--muted); }
.gear-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; margin-right: 14px; font-size: 18px;
    text-decoration: none; border-radius: 6px; opacity: 0.9;
}
.gear-link:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

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

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=color], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
textarea { min-height: 160px; font-family: monospace; }

.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type=color] { width: 40px; height: 34px; padding: 2px; flex: none; }
.color-field input[type=text] { flex: 1; }

button {
    background: var(--primary); color: #fff; border: none; border-radius: 6px;
    padding: 9px 16px; font-size: 14px; cursor: pointer; margin-top: 12px; margin-right: 8px;
}
button.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.preview-frame {
    border: 1px solid var(--border); border-radius: 6px; background: #fff;
    padding: 16px; min-height: 160px;
}

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }

.row-actions { display: flex; gap: 4px; }
.icon-btn {
    background: none; border: 1px solid transparent; color: var(--text);
    font-size: 16px; padding: 4px 6px; margin: 0; border-radius: 6px; line-height: 1;
}
.icon-btn:hover { background: #fff; border-color: var(--border); }

.kv-table th { width: 140px; color: var(--muted); font-weight: normal; border-bottom: 1px solid var(--border); }
.kv-table td { border-bottom: 1px solid var(--border); }

.image-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 8px;
}
.image-slot {
    border: 1px solid var(--border); border-radius: 6px; padding: 8px; text-align: center; background: #fff;
}
.image-slot img {
    max-width: 100%; max-height: 60px; display: block; margin: 0 auto 6px; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0 0/12px 12px;
}
.image-slot .image-slot-empty {
    height: 60px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; margin-bottom: 6px;
}
.image-slot label { font-size: 11px; margin: 0 0 4px; }
.image-slot input[type=file] { font-size: 11px; width: 100%; margin-bottom: 4px; }

.config-transfer-bar { display: flex; gap: 8px; margin-bottom: 12px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { margin: 0; }
.tabs button.active { background: var(--text); }

.info-banner {
    background: #e8f1fc; border: 1px solid #bcd7f5; border-radius: 6px;
    padding: 10px 12px; font-size: 13px; margin-bottom: 12px; color: #1f3a5c;
}
.primary-action { background: #1a9e5c; }
.primary-action:hover { background: #158049; }

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hidden { display: none !important; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 20, 30, 0.5);
    display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.modal {
    background: var(--card); border-radius: 8px; padding: 24px; max-width: 560px; width: 100%;
    max-height: 80vh; overflow-y: auto; position: relative;
}
.modal-close {
    position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--muted);
    font-size: 22px; line-height: 1; margin: 0; padding: 4px 8px; cursor: pointer;
    z-index: 1;
}

.modal-large {
    max-width: 1100px; width: 95%; height: 90vh; max-height: 90vh;
    padding: 0; overflow: hidden; display: flex;
}
.admin-iframe { width: 100%; height: 100%; border: none; }

.wysiwyg-toolbar {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; margin-bottom: 4px;
}
.wysiwyg-toolbar button {
    margin: 0; padding: 6px 10px; font-size: 13px; background: #fff; color: var(--text);
    border: 1px solid var(--border);
}
.wysiwyg-toolbar button:hover { background: var(--bg); }
.wysiwyg-editor {
    min-height: 220px; border: 1px solid var(--border); border-radius: 6px; padding: 10px;
    background: #fff; overflow: auto;
}
.wysiwyg-editor table { border-collapse: collapse; }
.wysiwyg-editor td, .wysiwyg-editor th { border: 1px dashed #ccd2da; padding: 2px; }
