:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f7fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; min-width: 320px; }

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  background: #0c1730;
  color: #fff;
}

.brand { font-size: 1.05rem; font-weight: 800; text-decoration: none; }
.site-header nav { display: flex; gap: 1rem; align-items: center; }
.site-header nav a { color: #dbe6ff; text-decoration: none; }
.language-button { padding: .35rem .55rem; border: 1px solid #8092b7; border-radius: .45rem; background: transparent; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }

.hero, .page-shell { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.public-shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: 4rem 0; }
.public-intro { margin-bottom: 2rem; }
.public-intro h1 { max-width: 20ch; }
.catalog-panel { padding: clamp(1rem, 3vw, 2rem); border: 1px solid #dbe2ef; border-radius: 1rem; background: #fff; box-shadow: 0 18px 50px rgba(32, 54, 91, .08); }
.catalog-panel h2 { margin: 0; }
.public-search { width: 100%; }
.public-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem; }
.public-results > p { color: #66738b; }
.public-results button { display: grid; gap: .2rem; padding: .8rem; border: 1px solid #dce3ee; border-radius: .65rem; background: #fafbfd; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.public-results button:hover, .public-results button:focus { border-color: #315bc7; background: #edf2ff; }
.public-results span, .selected-device small { color: #66738b; }
.public-services { margin-top: 1.25rem; }
.selected-device { display: grid; gap: .2rem; padding: 1rem; border-radius: .7rem; background: #eef3ff; }
.selected-device > span { color: #315bc7; font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.service-cards { display: grid; gap: 1rem; margin-top: 1rem; }
.service-card { padding: 1.25rem; border: 1px solid #dce3ee; border-radius: .8rem; }
.service-heading { display: flex; justify-content: space-between; gap: 1rem; }
.service-heading span { color: #315bc7; font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.service-heading h3 { margin: .25rem 0 0; }
.service-heading > strong { color: #173b2e; font-size: 1.35rem; }
.service-card > p, .requirements p { color: #526078; line-height: 1.6; }
.service-card dl { display: flex; flex-wrap: wrap; gap: .75rem; }
.service-card dl div { min-width: 8rem; padding: .65rem; border-radius: .55rem; background: #f4f7fb; }
.service-card dt { color: #66738b; font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.service-card dd { margin: .2rem 0 0; font-weight: 800; }
.requirements { padding: .85rem; border-left: .25rem solid #315bc7; background: #f8faff; }
.requirements p { margin: .35rem 0 0; }
.service-request { display: grid; gap: .75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #dce3ee; }
.service-request > strong { color: #203e91; }
.request-summary { display: flex; flex-wrap: wrap; gap: .4rem .75rem; color: #43516a; font-size: .9rem; }
.request-summary span { padding-right: .75rem; border-right: 1px solid #dce3ee; }
.request-summary span:last-child { padding-right: 0; border-right: 0; }
.copy-service { justify-self: start; padding: 0; border: 0; background: transparent; color: #244aa8; font: inherit; font-weight: 750; text-decoration: underline; cursor: pointer; }
.copy-status { color: #18734d; font-size: .9rem; font-weight: 750; }
.request-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.request-link { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .75rem 1rem; border-radius: .65rem; color: #fff; font-weight: 800; text-decoration: none; }
.request-whatsapp { background: #137c4b; }
.request-telegram { background: #176b9c; }
.request-link:hover, .request-link:focus-visible { filter: brightness(.92); outline: 3px solid rgba(49, 91, 199, .22); outline-offset: 2px; }
.public-notice { margin-top: 2rem; }

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  min-height: 68vh;
  padding-block: 5rem;
}

.eyebrow { color: #315bc7; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { max-width: 18ch; margin: .5rem 0 1rem; font-size: clamp(2.4rem, 7vw, 5rem); line-height: .98; }
.lead { max-width: 62ch; font-size: clamp(1.05rem, 2vw, 1.25rem); color: #526078; line-height: 1.7; }

.notice, .panel, .empty-state {
  border: 1px solid #dbe2ef;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 18px 50px rgba(32, 54, 91, .08);
}

.notice { padding: 1.5rem; border-left: .35rem solid #315bc7; }
.notice h2 { margin-top: 0; }
.notice p { margin-bottom: 0; color: #526078; line-height: 1.6; }

.admin-header { align-items: flex-start; }
.admin-title { margin: 0; font-size: 1.3rem; }
.admin-subtitle { margin: .3rem 0 0; color: #aab9d7; }
.page-shell { padding-block: 2rem 4rem; }

.toolbar, .tabs { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.toolbar { justify-content: space-between; margin-bottom: 1.25rem; }
.tabs { margin-bottom: 1.25rem; border-bottom: 1px solid #dbe2ef; }
.tab {
  border: 0;
  border-bottom: 3px solid transparent;
  padding: .9rem .25rem;
  background: transparent;
  color: #66738b;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tab[aria-selected="true"] { border-color: #315bc7; color: #203e91; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .65rem 1rem;
  border: 1px solid #315bc7;
  border-radius: .65rem;
  background: #315bc7;
  color: #fff;
  font: inherit;
  font-weight: 750;
}

.panel { padding: clamp(1rem, 3vw, 2rem); }
.panel-header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.panel h2 { margin: 0; }
.search {
  width: min(100%, 36rem);
  margin: 1.25rem 0;
  padding: .8rem 1rem;
  border: 1px solid #cbd5e5;
  border-radius: .65rem;
  font: inherit;
}
.empty-state { padding: 2.5rem 1rem; box-shadow: none; text-align: center; color: #66738b; }
.phase-badge { display: inline-block; padding: .3rem .65rem; border-radius: 999px; background: #e8eefc; color: #203e91; font-size: .8rem; font-weight: 800; }
.fine-print { margin-top: 1.5rem; color: #66738b; font-size: .9rem; line-height: 1.6; }

@media (max-width: 720px) {
  .site-header { align-items: flex-start; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-block: 3rem; }
  .toolbar, .panel-header { align-items: stretch; flex-direction: column; }
  .button { width: 100%; }
  .request-links { grid-template-columns: 1fr; }
  .request-link { min-height: 3.25rem; width: 100%; }
}

/* Admin */
.admin-body { min-height: 100vh; background: #eef2f8; }
.admin-shell { width: min(1440px, calc(100% - 2rem)); margin-inline: auto; padding-block: 1.5rem 3rem; }
.admin-toolbar { margin-bottom: .5rem; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.text-button { padding: 0; border: 0; background: transparent; color: #dbe6ff; font: inherit; text-decoration: underline; cursor: pointer; }
.admin-toolbar h1 { margin: .35rem 0 0; font-size: clamp(1.75rem, 4vw, 2.5rem); }
.admin-workspace { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); min-height: 68vh; gap: 1rem; }
.catalog-pane, .editor-pane { border: 1px solid #d8e0ed; border-radius: 1rem; background: #fff; overflow: hidden; }
.catalog-pane { padding: .75rem; }
.catalog-pane .search { width: 100%; margin: 0 0 .75rem; }
.compact-list { display: grid; gap: .35rem; max-height: calc(100vh - 17rem); overflow-y: auto; }
.list-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .65rem; width: 100%; padding: .75rem; border: 1px solid transparent; border-radius: .7rem; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.list-item:hover, .list-item.is-selected { border-color: #9eb4eb; background: #edf2ff; }
.list-copy { display: grid; gap: .2rem; min-width: 0; }
.list-copy strong, .list-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-copy small { color: #66738b; }
.status-dot { width: .6rem; height: .6rem; border-radius: 999px; background: #9ba7ba; }
.status-dot.is-active { background: #1d9b63; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .4rem; border-radius: 999px; background: #e5ebf6; color: #43516a; font-size: .78rem; font-weight: 800; }
.list-message { padding: 1.25rem; color: #66738b; text-align: center; }
.error-text { color: #a42d36; }
.editor-pane { overflow: visible; }
.editor-placeholder { display: grid; place-content: center; min-height: 100%; padding: 3rem 1rem; color: #738097; text-align: center; }
.editor-placeholder span { margin-top: .35rem; }
.entity-form { min-width: 0; }
.editor-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: 1.25rem 1.25rem .5rem; }
.editor-header h2 { margin: .4rem 0 0; font-size: 1.35rem; }
.icon-button { width: 2.5rem; height: 2.5rem; border: 0; border-radius: .65rem; background: #eef2f8; color: #43516a; font-size: 1.6rem; cursor: pointer; }
.editor-section { border-top: 1px solid #e0e6f0; }
.editor-section > summary { padding: 1rem 1.25rem; font-weight: 800; cursor: pointer; list-style-position: outside; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; padding: 0 1.25rem 1.25rem; }
.field { display: grid; gap: .35rem; min-width: 0; color: #4d5a70; font-size: .85rem; font-weight: 700; }
.field-wide { grid-column: span 2; }
.field input, .field textarea { width: 100%; min-height: 2.55rem; padding: .65rem .75rem; border: 1px solid #cbd5e5; border-radius: .55rem; background: #fff; color: #172033; font: inherit; font-weight: 400; resize: vertical; }
.field input:focus, .field textarea:focus, .search:focus { outline: 3px solid rgba(49, 91, 199, .18); border-color: #315bc7; }
.editor-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: .65rem; padding: 1rem 1.25rem; border-top: 1px solid #dce3ef; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); }
.push-right { margin-left: auto; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-ghost { background: #fff; color: #244aa8; }
.button-danger { border-color: #bd3f49; color: #a42d36; }
.button-small { min-height: 2.25rem; padding: .45rem .7rem; font-size: .85rem; }
.relation-picker { position: relative; padding: 0 1.25rem; }
.relation-picker .search { width: 100%; margin: 0 0 .75rem; }
.autocomplete { position: absolute; z-index: 10; top: calc(100% - .75rem); left: 1.25rem; right: 1.25rem; max-height: 15rem; overflow-y: auto; border: 1px solid #bdc9dc; border-radius: .65rem; background: #fff; box-shadow: 0 16px 35px rgba(32, 54, 91, .18); }
.autocomplete button { display: grid; gap: .15rem; width: 100%; padding: .75rem; border: 0; border-bottom: 1px solid #edf0f5; background: #fff; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.autocomplete button:hover { background: #edf2ff; }
.autocomplete small { color: #66738b; }
.candidate-list { display: grid; }
.candidate-option { display: flex; gap: .65rem; align-items: center; padding: .7rem .75rem; border-bottom: 1px solid #edf0f5; cursor: pointer; }
.candidate-option:hover { background: #edf2ff; }
.candidate-option span { display: grid; gap: .15rem; }
.autocomplete .add-selected { position: sticky; bottom: 0; width: calc(100% - 1rem); margin: .5rem; }
.relations { display: grid; gap: .6rem; padding: 0 1.25rem 1.25rem; }
.relation-card { border: 1px solid #dce3ee; border-radius: .75rem; background: #fafbfd; }
.relation-card summary { display: flex; align-items: center; gap: .75rem; padding: .65rem; cursor: pointer; }
.relation-summary { color: #66738b; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-select { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; }
.edit-hint { margin-left: auto; color: #315bc7; font-size: .8rem; font-weight: 800; }
.bulk-editor { margin: 0 1.25rem 1rem; border: 1px solid #b9c8e7; border-radius: .75rem; background: #f7f9ff; }
.bulk-editor > summary { padding: .8rem 1rem; color: #203e91; font-weight: 800; cursor: pointer; }
.bulk-editor > p, .bulk-editor form { margin: 0; padding: 0 1rem 1rem; }
.bulk-editor > p { color: #66738b; font-size: .9rem; }
.bulk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.bulk-field { padding: .65rem; border: 1px solid #dce3ee; border-radius: .6rem; background: #fff; }
.bulk-field .field { margin-top: .4rem; }
.chip { display: inline-flex; align-items: center; max-width: 24rem; padding: .4rem .7rem; border-radius: 999px; background: #dfe8ff; color: #203e91; font-size: .83rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-inactive { background: #e6e9ee; color: #697487; }
.relation-form { padding: .75rem; border-top: 1px solid #dce3ee; }
.relation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; }
.toggle { display: inline-flex; align-items: center; gap: .45rem; margin-top: .75rem; color: #4d5a70; font-size: .9rem; font-weight: 700; }
.inline-actions { display: flex; gap: .6rem; margin-top: .75rem; }
.settings-panel { max-width: 850px; }
.settings-panel h2 { margin-top: 1rem; }
.compact-notice { margin-top: 1.5rem; box-shadow: none; }
.settings-section { margin-block: 1.5rem; border: 1px solid #dce3ef; border-radius: .75rem; }
.password-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; padding: 0 1.25rem 1.25rem; align-items: end; }
.user-list { display: grid; gap: .6rem; margin-top: 1rem; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .8rem; border: 1px solid #dce3ef; border-radius: .7rem; background: #fafbfd; }
.user-row button { border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.role-badge { padding: .3rem .55rem; border-radius: 999px; background: #e5ebf6; color: #43516a; font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.admin-dialog { width: min(42rem, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 1rem; color: #172033; box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.admin-dialog::backdrop { background: rgba(8, 16, 33, .62); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid #dce3ef; }
.dialog-header h2 { margin: 0; }
.dialog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 1.25rem; }
.dialog-grid select { min-height: 2.55rem; padding: .65rem .75rem; border: 1px solid #cbd5e5; border-radius: .55rem; background: #fff; font: inherit; }
.dialog-actions { position: static; }
.credential-dialog { padding-bottom: 1.25rem; text-align: center; }
.credential-dialog p { padding-inline: 1.25rem; }
.credential-dialog code { display: block; margin: 1rem 1.25rem; padding: 1rem; border-radius: .6rem; background: #eef2f8; font-size: 1.05rem; overflow-wrap: anywhere; user-select: all; }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 1rem; background: #eef2f8; }
.login-card { width: min(100%, 28rem); padding: clamp(1.5rem, 5vw, 2.5rem); border: 1px solid #d8e0ed; border-radius: 1rem; background: #fff; box-shadow: 0 18px 50px rgba(32, 54, 91, .12); }
.login-card h1 { margin: .35rem 0 1.5rem; font-size: 2rem; }
.login-card form { display: grid; gap: 1rem; }
.login-card .button { margin-top: .25rem; }
.dark-brand { display: inline-block; margin-bottom: 2rem; color: #0c1730; }
.form-error { margin: 0; padding: .7rem; border-radius: .55rem; background: #fff0f1; color: #852a33; }
.toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(28rem, calc(100% - 2rem)); padding: .85rem 1rem; border-radius: .7rem; background: #173b2e; color: #fff; box-shadow: 0 12px 35px rgba(0, 0, 0, .2); }
.toast[data-tone="error"] { background: #852a33; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .form-grid, .relation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .admin-shell { width: min(100% - 1rem, 720px); }
  .admin-workspace { grid-template-columns: 1fr; }
  .compact-list { max-height: 18rem; }
  .editor-pane { min-height: 14rem; }
}

@media (max-width: 560px) {
  .header-actions { align-items: flex-end; flex-direction: column; gap: .4rem; }
  .password-form { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr auto; }
  .user-row .status-label { grid-column: 1 / -1; }
  .dialog-grid { grid-template-columns: 1fr; }
  .form-grid, .relation-grid { grid-template-columns: 1fr; }
  .bulk-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .editor-actions .button { width: auto; flex: 1 1 calc(50% - .65rem); }
  .push-right { margin-left: 0; }
  .relation-card summary { align-items: flex-start; flex-direction: column; }
}
