/* ==========================================================================
   Anavo Global Ministries - Admin panel
   Self-contained: no external fonts, icon packs or CDN dependencies.
   ========================================================================== */

:root {
    --ink:        #101828;
    --ink-soft:   #475467;
    --ink-faint:  #98a2b3;
    --line:       #e4e7ec;
    --surface:    #ffffff;
    --canvas:     #f5f7fa;
    --brand:      #0f5c4a;
    --brand-dark: #0b4437;
    --brand-tint: #e7f2ef;
    --danger:     #b42318;
    --danger-bg:  #fef3f2;
    --warn:       #b54708;
    --warn-bg:    #fffaeb;
    --ok:         #067647;
    --ok-bg:      #ecfdf3;
    --radius:     10px;
    --shadow:     0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

body.agm-admin {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

/* ---------- Layout ---------- */
.agm-shell { display: flex; min-height: 100vh; }

.agm-sidebar {
    width: 244px;
    flex: 0 0 244px;
    background: var(--brand-dark);
    color: #d7e6e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.agm-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.agm-brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; }
.agm-brand span   { display: block; font-size: 12px; color: #8fb3aa; margin-top: 2px; }

.agm-nav { padding: 12px 10px; flex: 1; }
.agm-nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6f958c;
    padding: 14px 12px 6px;
}

.agm-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #d7e6e1;
    text-decoration: none;
    font-size: 14px;
}

.agm-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.agm-nav a.is-active { background: #fff; color: var(--brand-dark); font-weight: 600; }

.agm-nav .agm-badge {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 12px;
}
.agm-nav a.is-active .agm-badge { background: var(--brand-tint); color: var(--brand-dark); }

.agm-sidebar-foot {
    padding: 14px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 13px;
}
.agm-sidebar-foot a { color: #a9cdc4; text-decoration: none; display: block; padding: 4px 0; }
.agm-sidebar-foot a:hover { color: #fff; }

.agm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.agm-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.agm-topbar h1 { margin: 0; font-size: 20px; font-weight: 650; }
.agm-topbar .agm-who { font-size: 13px; color: var(--ink-soft); }

.agm-content { padding: 24px 28px 56px; }

/* ---------- Cards ---------- */
.agm-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.agm-card > header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.agm-card > header h2 { margin: 0; font-size: 15px; font-weight: 650; }
.agm-card > header p  { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.agm-card-body { padding: 20px; }
.agm-card-body.is-flush { padding: 0; }

/* ---------- Stat tiles ---------- */
.agm-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.agm-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.agm-tile .agm-tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.agm-tile .agm-tile-value { font-size: 26px; font-weight: 650; margin-top: 6px; line-height: 1.1; }
.agm-tile .agm-tile-note  { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Forms ---------- */
.agm-grid { display: grid; gap: 16px; }
.agm-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.agm-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.agm-field { display: block; margin-bottom: 4px; }
.agm-field > label,
.agm-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--ink);
}
.agm-hint { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }

input[type=text], input[type=email], input[type=url], input[type=password],
input[type=number], input[type=date], input[type=search], input[type=tel],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-tint);
}
textarea { min-height: 96px; resize: vertical; }
input[type=file] { font-size: 13px; }

.agm-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.agm-check input { width: auto; }

/* ---------- Buttons ---------- */
.agm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.agm-btn:hover { background: var(--brand-dark); color: #fff; }
.agm-btn.is-ghost { background: #fff; border-color: #d0d5dd; color: var(--ink); }
.agm-btn.is-ghost:hover { background: #f9fafb; color: var(--ink); }
.agm-btn.is-danger { background: var(--danger); }
.agm-btn.is-danger:hover { background: #912018; }
.agm-btn.is-small { padding: 6px 11px; font-size: 13px; }
.agm-btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }

/* ---------- Tables ---------- */
.agm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.agm-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-faint);
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    background: #fcfcfd;
    white-space: nowrap;
}
.agm-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.agm-table tr:last-child td { border-bottom: 0; }
.agm-table tbody tr:hover { background: #fcfcfd; }
.agm-table .agm-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.agm-table td.is-right { text-align: right; }
.agm-scroll { overflow-x: auto; }

.agm-thumb {
    width: 56px; height: 42px; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--line); background: #f2f4f7;
    display: block;
}

/* ---------- Pills & alerts ---------- */
.agm-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #f2f4f7;
    color: var(--ink-soft);
}
.agm-pill.is-ok     { background: var(--ok-bg);     color: var(--ok); }
.agm-pill.is-warn   { background: var(--warn-bg);   color: var(--warn); }
.agm-pill.is-danger { background: var(--danger-bg); color: var(--danger); }

.agm-alert {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid;
    margin-bottom: 20px;
    font-size: 14px;
}
.agm-alert.is-success { background: var(--ok-bg);     border-color: #abefc6; color: var(--ok); }
.agm-alert.is-danger  { background: var(--danger-bg); border-color: #fecdca; color: var(--danger); }
.agm-alert.is-warning { background: var(--warn-bg);   border-color: #fedf89; color: var(--warn); }

.agm-empty { padding: 40px 20px; text-align: center; color: var(--ink-soft); }
.agm-empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- Filter bar ---------- */
.agm-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.agm-filters .agm-field { margin: 0; min-width: 150px; }

/* ---------- Repeater rows ---------- */
.agm-repeat-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.agm-repeat-row input { flex: 1; }
.agm-repeat-row .agm-btn { flex: 0 0 auto; }

/* ---------- Rich text editor ---------- */
.agm-editor { border: 1px solid #d0d5dd; border-radius: 8px; overflow: hidden; background: #fff; }
.agm-editor-toolbar {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 6px; border-bottom: 1px solid var(--line); background: #fcfcfd;
}
.agm-editor-toolbar button {
    border: 1px solid transparent; background: transparent; border-radius: 6px;
    padding: 5px 9px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-soft);
    min-width: 30px;
}
.agm-editor-toolbar button:hover { background: #eef1f4; color: var(--ink); }
.agm-editor-area { min-height: 260px; padding: 14px 16px; outline: none; }
.agm-editor-area:focus { box-shadow: inset 0 0 0 2px var(--brand-tint); }
.agm-editor-area p { margin: 0 0 12px; }
.agm-editor-area img { max-width: 100%; }

/* ---------- Login ---------- */
body.agm-login {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px; background: var(--brand-dark);
}
.agm-login-card {
    width: 100%; max-width: 400px; background: #fff;
    border-radius: 14px; padding: 32px; box-shadow: 0 20px 40px rgba(0, 0, 0, .22);
}
.agm-login-card h1 { margin: 0 0 4px; font-size: 20px; }
.agm-login-card p.agm-sub { margin: 0 0 22px; color: var(--ink-soft); font-size: 14px; }
.agm-login-card .agm-field { margin-bottom: 14px; }
.agm-login-card .agm-btn { width: 100%; justify-content: center; margin-top: 6px; }
.agm-login-foot { margin-top: 18px; text-align: center; font-size: 13px; }
.agm-login-foot a { color: var(--ink-soft); text-decoration: none; }

/* ---------- Media grid ---------- */
.agm-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}
.agm-media-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.agm-media-preview {
    height: 118px; display: flex; align-items: center; justify-content: center;
    background: #f2f4f7; overflow: hidden;
}
.agm-media-preview img { width: 100%; height: 100%; object-fit: cover; }
.agm-media-preview .agm-file-badge { font-size: 13px; font-weight: 700; color: var(--ink-soft); letter-spacing: .06em; }
.agm-media-meta { padding: 10px 12px; font-size: 12px; }
.agm-media-meta strong { display: block; font-size: 13px; word-break: break-all; margin-bottom: 3px; }
.agm-media-meta span { color: var(--ink-soft); }
.agm-media-actions { display: flex; gap: 6px; padding: 0 12px 12px; }

/* ---------- Definition list ---------- */
.agm-dl { display: grid; grid-template-columns: 220px 1fr; gap: 0; font-size: 14px; }
.agm-dl dt { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.agm-dl dd { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; word-break: break-word; }

.agm-muted { color: var(--ink-soft); }
.agm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.agm-mb-0 { margin-bottom: 0; }

@media (max-width: 900px) {
    .agm-shell { flex-direction: column; }
    .agm-sidebar { width: 100%; flex: none; height: auto; position: static; }
    .agm-nav { display: flex; flex-wrap: wrap; }
    .agm-nav-label { width: 100%; }
    .agm-content { padding: 18px; }
    .agm-topbar { padding: 14px 18px; }
    .agm-dl { grid-template-columns: 1fr; }
    .agm-dl dt { border-bottom: 0; padding-bottom: 0; }
}
