/* Club SEOM Web | Integración de SEOM UI */
:root {
  --seom-primary: var(--primary);
  --seom-primary-hover: var(--primary-strong);
  --seom-primary-soft: var(--primary-soft);
  --seom-dark: var(--text);
  --seom-text: var(--text);
  --seom-text-muted: var(--text-muted);
  --seom-bg: var(--bg);
  --seom-surface: var(--surface);
  --seom-surface-soft: var(--surface-alt);
  --seom-border: var(--border);
  --seom-success: var(--success);
  --seom-success-soft: var(--success-soft);
  --seom-warning: var(--warning);
  --seom-warning-soft: var(--warning-soft);
  --seom-danger: var(--danger);
  --seom-danger-soft: var(--danger-soft);
  --seom-info: var(--info);
  --seom-info-soft: var(--info-soft);
  --seom-radius-sm: var(--radius-sm);
  --seom-radius: var(--radius-card);
  --seom-radius-lg: var(--radius-modal);
  --seom-shadow: var(--shadow-sm);
  --seom-font: var(--font);
}

body { min-height: 100vh; }
body.nav-open { overflow: hidden; }
form { margin: 0; }

/* Accesibilidad y shell */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 300;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100vh; }
.app-layout { min-height: 100vh; }
.app-main { min-height: 100vh; }
.app-container { width: 100%; max-width: 1460px; margin: 0 auto; }
.app-container-narrow { width: 100%; max-width: 520px; margin: 0 auto; }
.app-content { min-height: calc(100vh - 66px); }
.app-sidebar .brand { position: sticky; top: 0; z-index: 2; background: var(--sidebar-bg); }
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy small { color: var(--sidebar-muted); font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.sidebar-footer {
  position: absolute;
  right: 12px;
  bottom: 14px;
  left: 12px;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 5%);
}
.sidebar-footer strong, .sidebar-footer span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer strong { color: var(--sidebar-text); font-size: var(--fs-sm); }
.sidebar-footer span { margin-top: 2px; color: var(--sidebar-muted); font-size: var(--fs-xs); }
.nav-item .nav-mark {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: rgb(255 255 255 / 8%);
  color: var(--brand-yellow);
  font-size: 10px;
  font-weight: 800;
}
.mobile-menu-button { display: none; }
.sidebar-backdrop { display: none; }
.topbar-context { min-width: 0; }
.topbar-eyebrow { color: var(--text-label); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.topbar-context strong { display: block; overflow: hidden; margin-top: 2px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-3); }
.app-topbar-meta { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
.flash-stack { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }

/* Encabezados y superficies */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.page-title { margin: 0; color: var(--text); font-size: 24px; line-height: 1.18; }
.page-subtitle { max-width: 760px; margin: 6px 0 0; color: var(--text-muted); }
.panel {
  margin-bottom: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel > .panel-header:first-child { margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) var(--sp-5); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.panel-title { margin: 0; color: var(--text); font-size: 15px; font-weight: 700; }
.panel-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* Dashboard y accesos */
.dashboard-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: var(--sp-5);
  padding: 24px 26px;
  border: 1px solid #E3B0A9;
  border-radius: var(--radius-card);
  background: linear-gradient(125deg, var(--primary), #991F1F);
  color: #fff;
  box-shadow: 0 10px 28px rgb(198 40 40 / 18%);
}
.dashboard-hero::after { position: absolute; top: -55px; right: -35px; width: 190px; height: 190px; border: 28px solid rgb(251 192 45 / 24%); border-radius: 50%; content: ""; }
.dashboard-hero .page-header { margin-bottom: 0; }
.dashboard-hero .label-up { color: rgb(255 255 255 / 68%); }
.dashboard-hero .page-title { position: relative; z-index: 1; color: #fff; }
.dashboard-hero .page-subtitle { position: relative; z-index: 1; color: rgb(255 255 255 / 78%); }
.dashboard-hero .status-pill { position: relative; z-index: 1; border-color: rgb(255 255 255 / 25%); background: rgb(255 255 255 / 12%); color: #fff; }
.tile {
  position: relative;
  display: block;
  min-height: 154px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.tile-link { transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
.tile-link:hover { border-color: #D7A64B; background: #FFFDF4; box-shadow: 0 6px 18px rgb(43 33 27 / 8%); }
.tile-mark { display: grid; width: 38px; height: 38px; margin-bottom: 14px; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; }
.tile:nth-child(4n+2) .tile-mark { background: var(--accent-soft); color: var(--accent-strong); }
.tile:nth-child(4n+3) .tile-mark { background: var(--highlight-soft); color: var(--info-text); }
.tile-title { margin: 0; color: var(--text); font-size: 15px; font-weight: 700; }
.tile-body { margin: 6px 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.tile-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); }
.tile-arrow { color: var(--primary); font-size: 20px; line-height: 1; }

/* Compatibilidad de formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.form-field-full { grid-column: 1 / -1; }
.form-label { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
.form-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.form-help { color: var(--text-muted); font-size: var(--fs-xs); }
.form-control, .form-select, .form-textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control::placeholder, .form-textarea::placeholder { color: var(--text-label); }
.form-textarea { min-height: 92px; resize: vertical; }
.form-control:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgb(255 143 0 / 17%); }
.form-control[aria-invalid="true"], .form-select[aria-invalid="true"], .form-textarea[aria-invalid="true"] { border-color: var(--danger); }
.inline-form { display: flex; align-items: end; gap: var(--sp-3); }
.inline-form .form-field { flex: 1; }
.form-actions, .card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.form-actions { justify-content: flex-end; margin-top: var(--sp-5); }
.icon-btn { display: inline-grid; width: 36px; height: 36px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--primary); cursor: pointer; font-size: 16px; font-weight: 700; }
.icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.radio-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; border: 0; }
.radio-group .form-label { flex-basis: 100%; }
.radio-option { display: inline-flex; min-height: 38px; align-items: center; gap: var(--sp-2); padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 600; }
.radio-option input { accent-color: var(--primary); }
.money-input-wrap { position: relative; }
.money-input-wrap .form-control { padding-right: 34px; }
.money-input-wrap > span { position: absolute; top: 50%; right: 12px; color: var(--text-muted); font-weight: 700; transform: translateY(-50%); }
.payment-entry { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(160px, .8fr) 90px; gap: var(--sp-4); align-items: end; }
.payment-add-button { min-height: 38px; font-size: 18px; }

/* Estados, caja y totales */
.text-muted { color: var(--text-muted); }
.status-pill, .badge { display: inline-flex; min-height: 24px; align-items: center; justify-content: center; gap: 5px; padding: 3px 9px; border: 1px solid transparent; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.status-success { border-color: #B7DCC2; background: var(--success-soft); color: var(--success-text); }
.status-warning { border-color: #E6B371; background: var(--warning-soft); color: var(--warning-text); }
.status-danger { border-color: #E2AAAA; background: var(--danger-soft); color: var(--danger-text); }
.status-info { border-color: #E6C36C; background: var(--info-soft); color: var(--info-text); }
.status-muted { border-color: var(--border); background: var(--surface-alt); color: var(--text-muted); }
.alert { border-left-width: 4px; }
.cash-status { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.cash-status-open { border-color: #B7DCC2; background: var(--success-soft); }
.cash-status-closed { border-color: #E2AAAA; background: var(--danger-soft); }
.totals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.total-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-sm); }
.total-card:first-child { border-color: #E3B0A9; background: var(--primary-soft); }
.total-card-voucher { border-color: #E6C36C; background: var(--highlight-soft); }
.total-label { color: var(--text-label); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.total-value { margin-top: 7px; overflow: hidden; color: var(--text); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }

/* Tablas, filtros y detalle */
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { background: var(--surface-alt); color: var(--text-muted); font-size: var(--fs-sm); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #FFFDF2; }
.sortable-table th a { color: var(--text-muted); text-decoration: none; }
.sortable-table th a:hover { color: var(--primary); }
.cell-number, .cell-money, .cell-actions { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-money, .cell-actions { text-align: right !important; }
.cell-actions .card-actions { justify-content: flex-end; }
.payment-table tfoot td { border-top: 2px solid var(--border); background: var(--surface-alt); }
.filter-panel { margin-bottom: var(--sp-4); padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
.filter-summary { cursor: pointer; color: var(--text); font-size: var(--fs-sm); font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: minmax(150px, .4fr) minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.detail-grid dt { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
.detail-grid dd { min-width: 0; margin: 0; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

/* Dialog nativo */
dialog.modal {
  position: fixed;
  inset: 0;
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-modal);
  background: transparent;
  overflow: visible;
}
dialog.modal::backdrop { background: rgb(43 33 27 / 58%); }
.modal-panel { width: 100%; max-height: calc(100vh - 32px); overflow: auto; padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--radius-modal); background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-panel > .panel-header:first-child { margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) var(--sp-5); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }

/* Login */
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(300px, 42%) 1fr; background: var(--surface); }
.auth-brand-panel { position: relative; display: flex; min-height: 100%; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 44px; background: linear-gradient(145deg, #5B1717, #8C2020); color: #fff; }
.auth-brand-panel::before { position: absolute; top: -90px; right: -70px; width: 280px; height: 280px; border: 44px solid rgb(251 192 45 / 25%); border-radius: 50%; content: ""; }
.auth-brand-panel::after { position: absolute; right: 52px; bottom: -75px; width: 170px; height: 170px; border-radius: 50%; background: rgb(255 143 0 / 26%); content: ""; }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.auth-brand .dot { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--brand-orange); color: #3A2300; }
.auth-message { position: relative; z-index: 1; max-width: 460px; }
.auth-message h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; }
.auth-message p { max-width: 410px; margin: 16px 0 0; color: rgb(255 255 255 / 75%); font-size: 16px; }
.auth-footnote { position: relative; z-index: 1; color: rgb(255 255 255 / 62%); font-size: var(--fs-xs); }
.auth-form-panel { display: grid; min-height: 100%; place-items: center; padding: 32px; background: var(--bg); }
.login-card { width: min(440px, 100%); padding: 28px; border: 1px solid var(--border); border-radius: var(--radius-modal); background: var(--surface); box-shadow: var(--shadow-md); }
.login-card .page-header { margin-bottom: 24px; }
.login-card .form-grid { grid-template-columns: 1fr; }

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .totals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app-sidebar { display: block; transform: translateX(-105%); transition: transform var(--t-base); }
  body.nav-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; display: block; border: 0; background: rgb(43 33 27 / 48%); opacity: 0; pointer-events: none; transition: opacity var(--t-base); }
  body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .mobile-menu-button { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--primary); cursor: pointer; font-size: 19px; }
  .app-main { width: 100%; margin-left: 0; }
  .topbar { padding-right: var(--sp-5); padding-left: var(--sp-5); }
  .topbar-context { margin-right: auto; }
  .app-content { padding-right: var(--sp-5); padding-left: var(--sp-5); }
}
@media (max-width: 720px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { min-height: 230px; padding: 28px; }
  .auth-message h1 { font-size: 30px; }
  .auth-footnote { display: none; }
  .auth-form-panel { padding: 22px 16px; }
  .app-topbar-meta { display: none; }
  .page-header, .panel-header, .cash-status { align-items: stretch; flex-direction: column; }
}
@media (max-width: 620px) {
  .form-grid, .payment-entry, .totals-grid { grid-template-columns: 1fr; }
  .form-actions, .card-actions, .inline-form { align-items: stretch; flex-direction: column; }
  .form-actions .btn, .card-actions .btn, .inline-form .btn { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 21px; }
  .panel, .login-card { padding: var(--sp-4); }
  .panel > .panel-header:first-child, .modal-panel > .panel-header:first-child { margin: calc(var(--sp-4) * -1) calc(var(--sp-4) * -1) var(--sp-4); padding: var(--sp-4); }
}
