/* app/static/admin/admin.css */
:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172538;
  background: #f3f6fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(75, 167, 184, .12), transparent 28rem),
    #f3f6fa;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

.page-shell { width: min(1440px, calc(100% - 64px)); margin: 0 auto; padding: 24px 0 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 64px; padding: 0 4px 22px; border-bottom: 1px solid #dce4ed; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #102c47; font-size: 19px; font-weight: 760; letter-spacing: -.035em; }
.brand img { display: block; }
.brand small { margin-left: 5px; color: #7890a5; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: #63778b; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #20a477; box-shadow: 0 0 0 4px #dff4ec; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 680; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: #176a82; box-shadow: 0 5px 14px rgba(23, 106, 130, .18); }
.button-primary:hover { background: #115a70; }
.button-quiet { color: #38516a; background: #fff; border-color: #d9e2eb; }
.button-quiet:hover { background: #f8fbfd; border-color: #b9c9d7; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 38px 2px 22px; }
.eyebrow { margin: 0 0 8px; color: #66849b; font-size: 10px; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; color: #142d45; font-size: clamp(27px, 4vw, 36px); letter-spacing: -.045em; line-height: 1.12; }
h2 { margin: 0; color: #18334d; font-size: 19px; letter-spacing: -.025em; }
h3 { margin: 0 0 5px; color: #1a3851; font-size: 14px; letter-spacing: -.01em; }
.muted { margin-bottom: 0; color: #708296; font-size: 13px; line-height: 1.65; }
.environment-badge { padding: 8px 11px; border: 1px solid #d7e4ed; border-radius: 999px; color: #557187; background: rgba(255,255,255,.75); font-size: 11px; font-weight: 700; text-transform: uppercase; }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.summary-card, .content-card { border: 1px solid #dfe6ee; border-radius: 15px; background: rgba(255,255,255,.9); box-shadow: 0 8px 28px rgba(24, 51, 77, .035); }
.summary-card { display: flex; align-items: center; gap: 15px; min-height: 116px; padding: 20px; }
.summary-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 12px; font-size: 19px; font-weight: 760; }
.summary-logo { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 12px; object-fit: cover; }
.icon-blue { color: #176a82; background: #e5f2f5; }
.icon-green { color: #218260; background: #e5f5ed; }
.card-label { margin: 0 0 4px; color: #8393a3; font-size: 11px; font-weight: 650; }
.card-value { margin: 0 0 3px; color: #1b344d; font-size: 17px; font-weight: 730; }
.card-detail { margin: 0; color: #8494a4; font-size: 11px; }
.content-card { margin-bottom: 18px; padding: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading > .muted { font-size: 11px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.module-card { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 78px; padding: 13px; border: 1px solid #e6ebf1; border-radius: 11px; background: #fbfcfe; }
.module-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: #4c7188; background: #edf3f7; font-size: 10px; font-weight: 750; }
.module-card p { margin: 0; color: #8090a0; font-size: 11px; line-height: 1.45; }
.state-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 0 9px; border-radius: 99px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.state-pending { color: #8a7138; background: #f7f1df; }
.state-ready { color: #237b5e; background: #e5f5ed; }
.note { margin: 15px 0 0; padding: 11px 13px; border-radius: 9px; color: #647b8d; background: #f1f6f9; font-size: 11px; line-height: 1.5; }
.service-card .section-heading { margin-bottom: 10px; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; margin: 20px 0 0; padding-top: 18px; border-top: 1px solid #e7edf2; }
.details-grid div { min-width: 0; }
.details-grid dt { margin-bottom: 5px; color: #8a9aaa; font-size: 10px; font-weight: 680; }
.details-grid dd { margin: 0; overflow-wrap: anywhere; color: #35536c; font-size: 12px; font-weight: 620; }
.page-footer { display: flex; justify-content: space-between; gap: 14px; padding: 8px 3px; color: #91a0ad; font-size: 10px; }

.message-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.message-card { width: min(100%, 420px); padding: 34px; border: 1px solid #dfe6ee; border-radius: 18px; background: #fff; box-shadow: 0 18px 55px rgba(24, 51, 77, .09); text-align: center; }
.message-mark { display: block; width: 72px; height: 72px; margin: 0 auto 19px; border-radius: 17px; object-fit: cover; }
.message-card h1 { margin-bottom: 10px; font-size: 26px; }
.message-card .muted { margin-bottom: 22px; }
.action-row { display: flex; justify-content: center; gap: 10px; }
.form-error { margin: 0 0 16px; padding: 10px; border-radius: 8px; color: #9e3f3f; background: #fff0f0; font-size: 12px; }

.core-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 20px 0; padding: 18px; border: 1px solid #e5ebf1; border-radius: 12px; background: #fbfcfe; }
.admin-form label, .secret-label { display: grid; gap: 7px; color: #405b72; font-size: 12px; font-weight: 680; }
.admin-form fieldset { min-width: 0; margin: 0; padding: 13px; border: 1px solid #e0e8ef; border-radius: 9px; }
.admin-form legend { padding: 0 5px; color: #405b72; font-size: 12px; font-weight: 700; }
.admin-form input, .admin-form textarea, .admin-form select, .secret-output { width: 100%; min-width: 0; border: 1px solid #d7e1ea; border-radius: 8px; padding: 10px 11px; color: #1b344d; background: #fff; font: inherit; font-size: 13px; outline: none; }
.admin-form textarea, .secret-output { resize: vertical; line-height: 1.5; }
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus { border-color: #3b97aa; box-shadow: 0 0 0 3px rgba(59,151,170,.12); }
.form-wide { grid-column: 1 / -1; }
.form-help { margin: 2px 0 0; color: #7b8e9f; font-size: 11px; line-height: 1.55; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid #e5ebf1; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th { padding: 11px 12px; color: #7890a3; background: #f7f9fb; font-size: 10px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { max-width: 360px; padding: 11px 12px; border-top: 1px solid #edf1f4; color: #3d5870; vertical-align: middle; }
td code { color: #31516c; font-size: 11px; overflow-wrap: anywhere; }
.table-sub { display: block; margin-top: 4px; color: #8192a1; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.table-empty { color: #8796a4; text-align: center; }
.inline-form { display: inline-block; margin: 4px 8px 0 0; }
.text-button { padding: 0; border: 0; color: #176a82; background: transparent; cursor: pointer; font: inherit; font-size: 10px; font-weight: 700; }
.registry-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.registry-columns h3 { margin-bottom: 9px; }
.generated-slug { display: flex; align-items: center; gap: 10px; color: #708296; font-size: 12px; }
.generated-slug code { padding: 6px 9px; border: 1px solid #e0e8ef; border-radius: 7px; color: #31516c; background: #f7f9fb; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice-option { display: flex !important; align-items: flex-start; gap: 9px !important; min-width: 0; padding: 9px; border: 1px solid #e5ebf1; border-radius: 8px; background: #fff; cursor: pointer; }
.choice-option:has(input:checked) { border-color: #55a6b4; background: #f1fafb; }
.choice-option input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 1px 0 0; accent-color: #176a82; }
.choice-option span { display: grid; min-width: 0; gap: 3px; }
.choice-option strong { color: #38516a; font-size: 11px; overflow-wrap: anywhere; }
.choice-option small { color: #8998a5; font-size: 10px; font-weight: 500; overflow-wrap: anywhere; }
.permission-groups { display: grid; gap: 14px; }
.permission-group h3 { margin: 0 0 7px; color: #66849b; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.permission-group[hidden] { display: none; }
.choice-grid .form-help { grid-column: 1 / -1; }
.schema-form-list { display: grid; gap: 10px; margin: 18px 0; }
.schema-form-item { padding: 12px 14px; border: 1px solid #e3eaf0; border-radius: 10px; background: #fbfcfe; }
.schema-form-item > summary, .row-editor > summary { color: #35536c; cursor: pointer; font-size: 12px; font-weight: 700; }
.schema-form-item > summary .table-sub { display: inline; margin-left: 8px; }
.schema-form-item[open] > summary { margin-bottom: 8px; }
.row-editor { margin-top: 8px; }
.row-editor > summary { font-size: 10px; }
.compact-form { grid-template-columns: 1fr; margin: 10px 0 0; padding: 10px; }
.compact-form .form-wide { grid-column: 1; }
.field-note { color: #8090a0; font-size: 10px; font-weight: 500; line-height: 1.4; }
.inline-form select { max-width: 150px; padding: 4px 6px; border: 1px solid #d7e1ea; border-radius: 6px; color: #38516a; background: #fff; font: inherit; font-size: 10px; }
.provider-heading { margin: 20px 0 12px; }
.secret-card { width: min(100%, 620px); }
.secret-details { text-align: left; }
.secret-label { margin: 22px 0 8px; text-align: left; }
.secret-output { min-height: 76px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; user-select: all; }
.secret-card .form-help { margin: 12px 0 20px; text-align: left; }
.secret-card .action-row { margin-top: 20px; }

@media (max-width: 680px) {
  .page-shell { width: min(100% - 28px, 520px); padding-top: 15px; }
  .topbar { align-items: flex-start; padding-bottom: 16px; }
  .topbar-right { gap: 10px; }
  .user-chip { display: none; }
  .page-heading { align-items: flex-start; padding-top: 29px; }
  .summary-grid, .module-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 98px; }
  .content-card { padding: 17px; }
  .module-card { grid-template-columns: 32px minmax(0, 1fr); }
  .module-card .state-pill { grid-column: 2; justify-self: start; }
  .details-grid { grid-template-columns: 1fr; gap: 12px; }
  .page-footer { flex-direction: column; }
  .message-card { padding: 28px 22px; }
  .admin-form, .registry-columns, .core-stat-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .admin-form .form-wide { grid-column: 1; }
}
