:root {
  color-scheme: dark;
  --siro-bg: #0b0d10;
  --siro-panel: #12161b;
  --siro-panel-2: #181d24;
  --siro-panel-3: #20262e;
  --siro-border: #303842;
  --siro-border-soft: #252c34;
  --siro-blue: #1677ff;
  --siro-blue-hover: #328cff;
  --siro-green: #15803d;
  --siro-green-hover: #16a34a;
  --siro-red: #b4232f;
  --siro-red-hover: #d12d3b;
  --siro-gray: #343b44;
  --siro-gray-hover: #454e59;
  --siro-warning: #b86b08;
  --siro-text: #f7f9fc;
  --siro-muted: #abb5c2;
  --siro-radius-sm: 9px;
  --siro-radius: 12px;
  --siro-radius-lg: 18px;
  --siro-control-height: 42px;
  --siro-font: "Bahnschrift", "Aptos", "Segoe UI", sans-serif;
}

html { color-scheme: dark; }

body.siro-ui-standard {
  background-color: var(--siro-bg);
  color: var(--siro-text);
  font-family: var(--siro-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.siro-ui-standard *,
body.siro-ui-standard *::before,
body.siro-ui-standard *::after { box-sizing: border-box; }

body.siro-ui-standard :where(h1, h2, h3, h4) {
  color: var(--siro-text);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

body.siro-ui-standard :where(.muted, .sub, .hint, .note, small) {
  color: var(--siro-muted);
  line-height: 1.4;
}

/* Controles de formulario */
body.siro-ui-standard :where(
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="number"], input[type="date"],
  input[type="time"], input[type="datetime-local"], input[type="tel"],
  input[type="url"], input[type="file"], select, textarea
) {
  min-height: var(--siro-control-height) !important;
  max-width: 100%;
  border: 1px solid var(--siro-border) !important;
  border-radius: var(--siro-radius-sm) !important;
  background-color: var(--siro-panel-2) !important;
  color: var(--siro-text) !important;
  padding: 9px 11px !important;
  font: inherit;
  line-height: 1.25;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

body.siro-ui-standard textarea {
  min-height: 92px;
  resize: vertical;
}

body.siro-ui-standard :where(
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="number"], input[type="date"],
  input[type="time"], input[type="datetime-local"], input[type="tel"],
  input[type="url"], input[type="file"], select, textarea,
  button, a.btn, a.button, [role="button"]
):focus-visible {
  outline: 3px solid rgba(77, 166, 255, .3);
  outline-offset: 2px;
  border-color: #5aa9ff;
  box-shadow: 0 0 0 1px rgba(77, 166, 255, .5);
}

body.siro-ui-standard :where(input, select, textarea)::placeholder { color: #7f8996; }
body.siro-ui-standard :where(input, select, textarea):disabled {
  opacity: .58;
  cursor: not-allowed;
  background: #111419;
}
body.siro-ui-standard :where(input, textarea)[readonly] { background: #111419; color: #c7ced8; }
body.siro-ui-standard :where(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--siro-blue);
  cursor: pointer;
}
body.siro-ui-standard label { color: #dce6f4; }

/* Botones y enlaces de acción */
body.siro-ui-standard .siro-ui-action {
  min-height: var(--siro-control-height) !important;
  min-width: 108px;
  max-width: 100%;
  padding: 9px 15px !important;
  border: 1px solid transparent;
  border-radius: var(--siro-radius-sm) !important;
  color: #fff;
  font-family: var(--siro-font);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background-color .16s ease, border-color .16s ease, transform .08s ease, opacity .16s ease;
}

body.siro-ui-standard .siro-ui-action:hover { color: #fff; transform: translateY(-1px); }
body.siro-ui-standard .siro-ui-action:active { transform: translateY(0); }
body.siro-ui-standard .siro-ui-action:disabled,
body.siro-ui-standard .siro-ui-action[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

body.siro-ui-standard .siro-action-open {
  background: var(--siro-blue) !important;
  border-color: #3b91ff !important;
  color: #fff !important;
}
body.siro-ui-standard .siro-action-open:hover { background: var(--siro-blue-hover) !important; }

body.siro-ui-standard .siro-action-accept {
  background: var(--siro-green) !important;
  border-color: #25a655 !important;
  color: #fff !important;
}
body.siro-ui-standard .siro-action-accept:hover { background: var(--siro-green-hover) !important; }

body.siro-ui-standard .siro-action-cancel,
body.siro-ui-standard .siro-action-danger {
  background: var(--siro-red) !important;
  border-color: #db3b48 !important;
  color: #fff !important;
}
body.siro-ui-standard :where(.siro-action-cancel, .siro-action-danger):hover {
  background: var(--siro-red-hover) !important;
}

body.siro-ui-standard .siro-action-close {
  background: var(--siro-gray) !important;
  border-color: #59636f !important;
  color: #fff !important;
}
body.siro-ui-standard .siro-action-close:hover { background: var(--siro-gray-hover) !important; }

body.siro-ui-standard .siro-action-warning {
  background: var(--siro-warning) !important;
  border-color: #dd8a1b !important;
  color: #fff !important;
}

body.siro-ui-standard .siro-icon-only {
  width: var(--siro-control-height);
  min-width: var(--siro-control-height);
  height: var(--siro-control-height) !important;
  min-height: var(--siro-control-height) !important;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

body.siro-ui-standard .siro-ui-compact {
  min-width: 88px;
  min-height: 36px !important;
  padding: 7px 11px;
  font-size: 12px;
}

body.siro-ui-standard :where(.actions, .action-row, .modal-actions, .modal-foot, .form-actions) {
  gap: 9px;
  align-items: center;
}

/* Tablas */
body.siro-ui-standard .siro-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--siro-border);
  border-radius: var(--siro-radius);
  background: var(--siro-panel);
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #485361 #14181d;
}

body.siro-ui-standard table.siro-ui-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--siro-text);
  background: var(--siro-panel);
}

body.siro-ui-standard table.siro-ui-table.siro-table-wide { min-width: 760px; }

body.siro-ui-standard table.siro-ui-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 11px;
  border-bottom: 1px solid #3a4653;
  background: #111923 !important;
  color: #dceaff !important;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
}

body.siro-ui-standard table.siro-ui-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--siro-border-soft);
  color: var(--siro-text);
  font-size: 13px;
  line-height: 1.35;
  vertical-align: middle;
}

body.siro-ui-standard table.siro-ui-table tbody tr:last-child td { border-bottom: 0; }
body.siro-ui-standard table.siro-ui-table tbody tr:hover td { background-color: rgba(34, 111, 210, .09); }
body.siro-ui-standard table.siro-ui-table :where(button, .btn, .button).siro-ui-action {
  min-height: 34px !important;
  min-width: 82px;
  padding: 6px 10px;
  font-size: 12px;
}

/* Modales: no altera display ni la lógica de apertura de cada página. */
body.siro-ui-standard .siro-modal-backdrop {
  padding: 16px;
  background-color: rgba(0, 0, 0, .76);
  backdrop-filter: blur(2px);
}

body.siro-ui-standard .siro-modal-panel {
  max-width: calc(100vw - 24px);
  max-height: min(90dvh, 920px);
  overflow: auto;
  border: 1px solid var(--siro-border) !important;
  border-radius: var(--siro-radius-lg) !important;
  background: var(--siro-panel) !important;
  color: var(--siro-text) !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .62);
  scrollbar-color: #485361 #14181d;
}

body.siro-ui-standard .siro-modal-header {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--siro-border) !important;
  background: var(--siro-panel) !important;
}

body.siro-ui-standard .siro-modal-header :where(h2, h3, .modal-title) {
  margin: 0;
  color: #eaf2ff !important;
  font-size: clamp(18px, 2vw, 22px);
}

body.siro-ui-standard .siro-modal-panel > :where(h2, h3):first-child {
  margin: 0;
  padding: 15px 16px;
  border-bottom: 1px solid var(--siro-border);
  color: #eaf2ff;
}

body.siro-ui-standard .siro-modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--siro-border) !important;
  background: var(--siro-panel) !important;
}

/* Mensajes */
body.siro-ui-standard :where(.alert, .msg, .message, .notice) {
  border-radius: var(--siro-radius);
  border: 1px solid var(--siro-border);
}
body.siro-ui-standard :where(.alert.ok, .msg.ok, .message.ok) {
  border-color: #207c45;
  background: #0c2919;
  color: #c8f7d8;
}
body.siro-ui-standard :where(.alert.err, .msg.err, .message.err, .alert.error) {
  border-color: #8f3038;
  background: #301015;
  color: #ffd5d8;
}

/* Desplegables personalizados */
body.siro-ui-standard :where(.dd-btn, .dropdown-toggle, .select-button) {
  min-height: var(--siro-control-height);
  border: 1px solid var(--siro-border);
  border-radius: var(--siro-radius-sm);
  background: var(--siro-panel-2);
  color: var(--siro-text);
}
body.siro-ui-standard :where(.dd-menu, .dropdown-menu, .select-menu) {
  max-height: min(360px, 55dvh);
  overflow: auto;
  border: 1px solid var(--siro-border);
  border-radius: var(--siro-radius);
  background: var(--siro-panel);
  box-shadow: 0 18px 46px rgba(0,0,0,.5);
}

@media (max-width: 720px) {
  :root { --siro-control-height: 44px; }
  body.siro-ui-standard .siro-modal-backdrop { padding: 8px; }
  body.siro-ui-standard .siro-modal-panel {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: 94dvh;
    border-radius: 14px !important;
  }
  body.siro-ui-standard .siro-modal-footer > .siro-ui-action:not(.siro-icon-only) {
    flex: 1 1 132px;
  }
  body.siro-ui-standard table.siro-ui-table th,
  body.siro-ui-standard table.siro-ui-table td { padding: 9px; }
}

@media print {
  body.siro-ui-standard .siro-ui-action,
  body.siro-ui-standard .siro-modal-backdrop { print-color-adjust: exact; }
}
