/* ----- Base ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #222;
    background: #f6f7fa;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: #0c68d6; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- Header / Footer ----- */
.site-header {
    background: #0d1b2a;
    color: #fff;
    padding: 14px 0;
    border-bottom: 3px solid #3388ff;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.site-header .brand {
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.5px;
}
.site-header .brand span {
    color: #3388ff;
    font-weight: 400;
}
.site-header nav {
    display: flex;
    align-items: center;
    gap: 18px;
}
.site-header nav a {
    color: #cfd8e3;
    font-size: 14px;
}
.site-header nav a:hover { color: #fff; text-decoration: none; }
.agent-badge {
    background: #3388ff;
    color: #fff;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.site-footer {
    margin-top: auto;
    background: #0d1b2a;
    color: #8da0b8;
    padding: 16px 0;
    text-align: center;
    font-size: 13px;
}

main.container {
    flex: 1;
    padding-top: 36px;
    padding-bottom: 48px;
}

/* ----- Login / Hero ----- */
.hero {
    text-align: center;
    padding: 40px 20px 48px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8ef;
    margin-bottom: 32px;
}
.hero h1 {
    font-size: 32px;
    margin: 0 0 16px;
    line-height: 1.2;
}
.hero .lead {
    max-width: 640px;
    margin: 0 auto 24px;
    font-size: 17px;
    color: #475569;
}
.hero .hint {
    max-width: 560px;
    margin: 20px auto 0;
    font-size: 13px;
    color: #64748b;
}

.btn-primary {
    display: inline-block;
    background: #3388ff;
    color: #fff;
    padding: 12px 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    border: 0;
    cursor: pointer;
    transition: background .15s;
}
.btn-primary:hover { background: #2673e0; text-decoration: none; }
.btn-primary:disabled {
    background: #9bb4d1;
    cursor: not-allowed;
}

/* ----- Feature grid on login ----- */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}
.feature {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 20px;
}
.feature h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #0d1b2a;
}
.feature p {
    margin: 0;
    font-size: 14px;
    color: #475569;
}

/* ----- Page head ----- */
.page-head {
    margin-bottom: 24px;
}
.page-head h1 {
    margin: 0 0 6px;
    font-size: 26px;
}
.page-head p {
    margin: 0;
    color: #64748b;
}
.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 14px;
}

/* ----- Ops grid ----- */
.ops-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.op-card {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    transition: border-color .15s, transform .15s;
}
.op-card:hover {
    border-color: #3388ff;
    transform: translateY(-2px);
}
.op-card-link {
    display: block;
    padding: 20px;
    color: inherit;
}
.op-card-link:hover { text-decoration: none; }
.op-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #0d1b2a;
}
.op-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 8px;
}
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8ef;
    color: #334155;
}
.badge.type { background: #dbeafe; color: #1e40af; }
.badge.role { background: #ecfccb; color: #3f6212; }
.owner { font-size: 13px; color: #64748b; }
.updated { font-size: 12px; color: #94a3b8; margin-top: 8px; }

/* ----- Empty state ----- */
.empty-state {
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    color: #64748b;
}

/* ----- Op detail ----- */
.op-status {
    margin: 24px 0;
}
.notice {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.notice.info { background: #eff6ff; border-left: 4px solid #3388ff; color: #1e3a8a; }
.notice.warn { background: #fef3c7; border-left: 4px solid #f59e0b; color: #7c2d12; }
.notice.danger { background: #fee2e2; border-left: 4px solid #dc2626; color: #7f1d1d; }
.actions { margin-top: 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions .hint { color: #64748b; font-size: 13px; }

.agents-section {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.agents-section h3 {
    margin: 0 0 14px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.agents-section .notice.compact { padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.agents-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.agent-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #eef2f7;
    border-radius: 999px;
    font-size: 13px;
    color: #0d1b2a;
}
.agent-name { font-weight: 600; }

.portal-preview {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 20px;
}
.portal-preview h3 {
    margin: 0 0 14px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.portal-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.portal-row:last-child { border-bottom: 0; }
.portal-name { color: #0d1b2a; }
.portal-coords { color: #94a3b8; font-family: Consolas, monospace; font-size: 12px; }
.more { margin-top: 12px; color: #94a3b8; font-size: 13px; text-align: center; }

/* ---- Anchor picker ---- */
.picker {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: stretch;
}
.anchor-map {
    height: 520px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #e2e8ef;
}
.picker-side {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
}
.picker-side h3 {
    margin: 0 0 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.selection-list {
    padding-left: 18px;
    margin: 0 0 14px 0;
    min-height: 86px;
    font-size: 14px;
}
.selection-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.drop-btn {
    border: 0;
    background: #e2e8ef;
    border-radius: 999px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    color: #475569;
    font-weight: 700;
}
.drop-btn:hover { background: #cbd5e1; }
.picker-stats {
    margin: 8px 0 14px;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
}
.picker-stats.hidden { display: none; }
.picker-stats strong { color: #0d1b2a; }

/* ---- Scheme picker ---- */
.scheme-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.scheme-option {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    cursor: pointer;
    align-items: flex-start;
}
.scheme-option:hover { border-color: #3388ff; }
.scheme-option input[type="radio"] {
    margin-top: 4px;
    transform: scale(1.2);
}
.scheme-option strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}
.scheme-option p {
    margin: 0 0 8px;
    color: #475569;
    font-size: 14px;
}
.z-select {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.z-select select {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    max-width: 380px;
}

.agent-names {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 16px 18px;
    margin: 0;
}
.agent-names legend {
    padding: 0 6px;
    font-weight: 600;
    color: #0d1b2a;
}
.agent-names .hint {
    margin: 6px 0 12px;
}
.agent-name-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.agent-name-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #475569;
}
.agent-name-grid input {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}
.agent-name-grid input:focus {
    border-color: #3388ff;
    outline: none;
    box-shadow: 0 0 0 2px #3388ff33;
}
@media (max-width: 600px) {
    .agent-name-grid { grid-template-columns: 1fr; }
}

.muted { color: #94a3b8; }

/* ---- Result page ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat-card.highlight {
    border-color: #3388ff;
    box-shadow: 0 0 0 2px #3388ff22;
}
.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0d1b2a;
    margin: 4px 0;
}
.stat-hint { font-size: 12px; color: #94a3b8; }

.row-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.card {
    background: #fff;
    border: 1px solid #e2e8ef;
    border-radius: 10px;
    padding: 18px;
}
.card h3 {
    margin: 0 0 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.kv-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.kv-list li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.kv-list li:last-child { border-bottom: 0; }
.kv-list strong { color: #0d1b2a; }

.actions-card .actions {
    flex-wrap: wrap;
    gap: 10px;
}
.btn-secondary {
    display: inline-block;
    background: #e2e8ef;
    color: #0d1b2a;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    border: 0;
    cursor: pointer;
}
.btn-secondary:hover { background: #cbd5e1; }
.btn-secondary:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}
.anchor-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.anchor-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}
.anchor-list li:last-child { border-bottom: 0; }
.coords { color: #94a3b8; font-family: Consolas, monospace; font-size: 12px; }

/* ---- Push progress ---- */
.push-status { margin-top: 14px; }
.push-status.hidden { display: none; }
.push-bar-outer {
    height: 12px;
    background: #e2e8ef;
    border-radius: 6px;
    overflow: hidden;
}
.push-bar-inner {
    height: 100%;
    background: #3388ff;
    transition: width .4s ease;
}
.push-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 13px;
    color: #475569;
}
.push-meta #push-count { font-family: Consolas, monospace; color: #94a3b8; }

@media (max-width: 820px) {
    .picker { grid-template-columns: 1fr; }
    .row-two { grid-template-columns: 1fr; }
}
