/* ============================================================
   Carmelo De Grazia — Panel de administración
   ============================================================ */
:root {
    --navy: #0d2b45; --blue: #1a5b8a; --gold: #b08d57;
    --ink: #23303a; --muted: #6b7885; --line: #e4e8ec;
    --bg: #eef1f5; --white: #fff;
    --radius: 10px; --shadow: 0 1px 3px rgba(13,43,69,.08), 0 6px 18px rgba(13,43,69,.05);
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--blue); text-decoration: none; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: linear-gradient(135deg, var(--navy), var(--blue)); }
.login-card { background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 40px; width: 100%; max-width: 400px; }
.login-card .logo { text-align: center; margin-bottom: 26px; }
.login-card .logo .mark { width: 54px; height: 54px; border-radius: 10px; background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; font-family: Georgia, serif; font-weight: 700; font-size: 24px; display: grid; place-items: center; margin: 0 auto 12px; }
.login-card h1 { font-family: Georgia, serif; font-size: 22px; color: var(--navy); margin: 0; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 24px; }

/* Layout */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #c3d0dd; padding: 24px 16px; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 16px; }
.sidebar .brand .mark { width: 38px; height: 38px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), var(--gold)); color: #fff; font-family: Georgia, serif; font-weight: 700; display: grid; place-items: center; }
.sidebar .brand .t { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar .brand .t small { display: block; color: var(--gold); font-size: 11px; font-weight: 500; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; color: #c3d0dd; padding: 11px 12px; border-radius: 8px; font-weight: 500; margin-bottom: 3px; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.sidebar nav a svg { width: 19px; height: 19px; }
.sidebar .badge { margin-left: auto; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.sidebar .foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); }

.main { padding: 0; overflow: auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 20px; margin: 0; color: var(--navy); font-family: Georgia, serif; }
.topbar .user { color: var(--muted); font-size: 14px; }
.content { padding: 32px; }

/* Cards / stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stat .n { font-size: 32px; font-weight: 700; color: var(--navy); font-family: Georgia, serif; }
.stat .l { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.stat.gold .n { color: var(--gold); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { font-size: 17px; margin: 0; color: var(--navy); font-family: Georgia, serif; }

/* Table */
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 13px 24px; border-bottom: 1px solid var(--line); background: #fafbfc; }
table.data td { padding: 14px 24px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfc; }
.ttl-cell { font-weight: 600; color: var(--navy); }
.unread td { background: #fffdf5; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-right: 6px; }

/* Pills / buttons */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.pill-on { background: #e7f6ec; color: #1e6b3a; }
.pill-off { background: #f1f3f5; color: #6b7885; }

.btn { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; cursor: pointer; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; font-family: inherit; transition: .15s; text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--blue); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #9a794a; color: #fff; }
.btn-ghost { background: #eef2f6; color: var(--navy); }
.btn-ghost:hover { background: #e2e8ee; }
.btn-danger { background: #fff; color: #c0392b; border-color: #f0c8c3; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.actions-cell { display: flex; gap: 8px; }

.w-100 { width: 100%; }
.full { width: 100%; }

/* Forms */
.form-grid { display: grid; gap: 20px; max-width: 860px; }
.field label { display: block; font-weight: 600; font-size: 14px; color: var(--navy); margin-bottom: 7px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field textarea, .field select {
    width: 100%; font-family: inherit; font-size: 15px; color: var(--ink);
    padding: 11px 13px; border: 1px solid #cfd8e0; border-radius: 8px; background: #fbfcfd;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,91,138,.12); background: #fff; }
.field textarea { resize: vertical; min-height: 360px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 14px; line-height: 1.6; }
.field .help { color: var(--muted); font-size: 13px; margin-top: 6px; }
.field .err { color: #c0392b; font-size: 13px; margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 160px; gap: 20px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 18px; height: 18px; }
.form-foot { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

.alert { padding: 13px 18px; border-radius: 8px; margin-bottom: 22px; font-size: 14px; }
.alert-success { background: #e7f6ec; color: #1e6b3a; border: 1px solid #b7e2c6; }
.alert-error { background: #fdecea; color: #a5342a; border: 1px solid #f5c6c1; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.pagination-wrap { padding: 18px 24px; }
.msg-body { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 20px; line-height: 1.7; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin-bottom: 24px; }
.kv .k { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 820px) {
    .admin { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .content { padding: 20px; }
    .topbar { padding: 14px 20px; }
    .row2 { grid-template-columns: 1fr; }
}
