/* ============================================================
   OSDOP Digital - Web App CSS
   Direccion visual 2026: modular claro, calido y accesible.
   ============================================================ */

:root {
  --primary: #ef5f4f;
  --primary-dark: #c94336;
  --primary-soft: #fff0ed;
  --primary-ring: rgba(239, 95, 79, .18);
  --accent: #197f88;
  --accent-soft: #e7f6f7;
  --bg: #f7f8fb;
  --bg-warm: #fff8f5;
  --surface: #ffffff;
  --surface-soft: #fbfcfe;
  --border: #dde3ea;
  --border-soft: #edf0f4;
  --text: #182230;
  --text-muted: #667085;
  --text-soft: #8a94a6;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #2563eb;
  --info-light: #dbeafe;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 12px 28px rgba(16, 24, 40, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(circle at top left, rgba(239, 95, 79, .10), transparent 34rem),
    linear-gradient(180deg, var(--bg-warm) 0, var(--bg) 22rem);
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(221, 227, 234, .78);
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 1px 18px rgba(16, 24, 40, .06);
  backdrop-filter: blur(16px);
}
.header-inner {
  max-width: 1180px;
  height: 68px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.site-logo { display: flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.site-logo-img { width: 166px; max-height: 46px; object-fit: contain; }
.site-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
  min-width: 0;
}
.nav-link {
  position: relative;
  padding: .46rem .85rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 650;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.nav-link:hover { background: var(--surface-soft); color: var(--text); text-decoration: none; }
.nav-link.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(239, 95, 79, .14);
}
.header-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  margin-left: auto;
  min-width: 0;
}
.user-avatar {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  color: var(--primary-dark);
  font-size: .8rem;
  font-weight: 800;
  border: 1px solid rgba(239, 95, 79, .16);
}
.user-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .88rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Layout */
.site-main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.25rem 2.75rem;
}
.site-footer {
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, .66);
  padding: 1.15rem 1.25rem;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
}
.page-header {
  margin-bottom: 1.35rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
}
.page-header p {
  color: var(--text-muted);
  font-size: .98rem;
  margin-top: .35rem;
}
.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .55rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Cards */
.card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card + .card { margin-top: .9rem; }
.card-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: .9rem;
  color: var(--text);
}

/* Buttons */
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .55rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: .9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:focus-visible,
.nav-link:focus-visible,
.btn-logout:focus-visible,
.form-control:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-ring);
}
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(239, 95, 79, .24);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 8px 18px rgba(217, 119, 6, .18);
}
.btn-warning:hover { background: #b45309; }
.btn-outline {
  background: #fff;
  color: var(--primary-dark);
  border-color: rgba(239, 95, 79, .38);
}
.btn-outline:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-ghost {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: #fff; border-color: var(--text-soft); }
.btn-sm { min-height: 34px; padding: .42rem .75rem; font-size: .82rem; }
.btn-logout {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: .3rem .7rem;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.btn-logout:hover { border-color: rgba(220, 38, 38, .35); color: var(--danger); background: var(--danger-light); }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  margin-bottom: .38rem;
  color: var(--text);
  font-size: .88rem;
  font-weight: 750;
}
.form-control {
  width: 100%;
  min-height: 42px;
  padding: .62rem .82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: .95rem;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.form-control:hover { border-color: #cbd5e1; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
select.form-control {
  padding-right: 2.2rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  appearance: none;
}
textarea.form-control { min-height: 108px; resize: vertical; }
.form-hint { margin-top: .32rem; color: var(--text-muted); font-size: .8rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

/* Password toggle */
.input-password-wrap { position: relative; display: flex; align-items: center; }
.input-password-wrap .form-control { padding-right: 2.75rem; }
.btn-show-password {
  position: absolute;
  right: .45rem;
  min-width: 42px;
  height: 32px;
  padding: 0 .45rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
}
.btn-show-password:hover { background: var(--surface-soft); color: var(--text); }

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  margin-bottom: 1rem;
  padding: .82rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .92rem;
  font-weight: 600;
}
.alert-icon {
  min-width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .72);
  font-size: .72rem;
  font-weight: 900;
  flex-shrink: 0;
}
.alert-success { background: var(--success-light); border-color: rgba(22, 163, 74, .18); color: #166534; }
.alert-error { background: var(--danger-light); border-color: rgba(220, 38, 38, .18); color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: rgba(217, 119, 6, .2); color: #92400e; }
.alert-info { background: var(--info-light); border-color: rgba(37, 99, 235, .18); color: #1d4ed8; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
thead tr { background: var(--surface-soft); border-bottom: 1px solid var(--border); }
th {
  text-align: left;
  padding: .72rem .85rem;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}
td { padding: .78rem .85rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fffaf8; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .22rem .58rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 850;
  line-height: 1;
}
.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-success { background: var(--success-light); color: #166534; }
.badge-info { background: var(--info-light); color: #1d4ed8; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-neutral { background: #eef2f6; color: #475467; }
.badge-warning { background: var(--warning-light); color: #92400e; }

/* Tabs */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: 1.2rem;
  padding: .25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .8);
}
.tab-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: .52rem .95rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  border: 0;
  background: transparent;
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
}
.tab-link:hover { color: var(--text); background: var(--surface-soft); text-decoration: none; }
.tab-link.active { color: var(--primary-dark); background: var(--primary-soft); }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at 18% 16%, rgba(25, 127, 136, .18), transparent 26rem),
    radial-gradient(circle at 78% 82%, rgba(239, 95, 79, .18), transparent 30rem),
    linear-gradient(135deg, #fff8f5, #f7f8fb 62%, #eef8f9);
}
.login-card {
  width: 100%;
  max-width: 430px;
  padding: 2.2rem;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}
.login-logo { text-align: center; margin-bottom: 1.55rem; }
.login-logo-img { width: min(270px, 88%); height: auto; margin: 0 auto; }
.login-card h2 {
  margin-bottom: 1.35rem;
  text-align: center;
  font-size: 1.32rem;
  line-height: 1.2;
  font-weight: 850;
}
.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-top: 1rem;
}
.login-actions .btn { width: 100%; text-align: center; }

/* Home */
.home-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.2rem;
  padding: 1.45rem;
  border: 1px solid rgba(239, 95, 79, .12);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 240, 237, .95), rgba(231, 246, 247, .78)),
    #fff;
  box-shadow: var(--shadow);
}
.home-hero::after {
  content: "";
  position: absolute;
  right: -52px;
  top: -64px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
}
.home-hero > * { position: relative; z-index: 1; }
.home-hero h1 {
  max-width: 700px;
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1.1;
  font-weight: 900;
}
.home-hero p { max-width: 680px; margin-top: .45rem; color: var(--text-muted); }
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.module-card {
  min-height: 182px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.module-card:hover {
  transform: translateY(-3px);
  border-color: rgba(239, 95, 79, .26);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.module-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.module-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}
.module-card:nth-child(2) .module-icon { background: var(--accent-soft); color: var(--accent); }
.module-card:nth-child(3) .module-icon { background: var(--info-light); color: var(--info); }
.module-name { font-size: 1.05rem; font-weight: 850; }
.module-desc { margin-top: .25rem; color: var(--text-muted); font-size: .88rem; }

/* Domain sections */
.bono-status { color: var(--text-muted); font-size: .82rem; }
.bono-status span { display: block; }
.tramite-card {
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.tramite-card.requires-feedback {
  position: relative;
  overflow: hidden;
  border-color: rgba(217, 119, 6, .48);
  background:
    linear-gradient(90deg, rgba(254, 243, 199, .94), rgba(255, 251, 235, .96) 44%, rgba(255, 255, 255, .98));
  box-shadow: 0 12px 28px rgba(146, 64, 14, .14);
}
.tramite-card.requires-feedback::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--warning);
}
.tramite-card.requires-feedback .tramite-item {
  position: relative;
  z-index: 1;
}
.tramite-card.requires-feedback .tramite-title {
  color: #92400e;
}
.tramite-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tramite-info { flex: 1 1 280px; }
.tramite-title { font-weight: 850; font-size: .98rem; }
.tramite-meta { margin-top: .2rem; color: var(--text-muted); font-size: .84rem; }
.tramite-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.feedback-summary-card.is-pending {
  border-color: rgba(217, 119, 6, .26);
  background: linear-gradient(180deg, rgba(254, 243, 199, .72), rgba(255, 255, 255, .96));
}
.feedback-summary-card.is-complete {
  border-color: rgba(22, 163, 74, .22);
  background: linear-gradient(180deg, rgba(220, 252, 231, .78), rgba(255, 255, 255, .96));
}
.feedback-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.feedback-summary-title {
  font-size: 1.08rem;
  line-height: 1.2;
  font-weight: 850;
  color: var(--text);
}
.feedback-summary-text {
  margin-top: .35rem;
  color: var(--text-muted);
  font-size: .92rem;
}
.feedback-box {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.feedback-box.is-pending {
  border-color: rgba(217, 119, 6, .26);
  background: linear-gradient(180deg, rgba(255, 251, 235, .95), rgba(251, 252, 254, .96));
}
.feedback-box.is-answered {
  border-color: rgba(22, 163, 74, .2);
  background: linear-gradient(180deg, rgba(240, 253, 244, .96), rgba(251, 252, 254, .96));
}
.feedback-header {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
}
.feedback-number {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: .82rem;
  font-weight: 850;
  flex-shrink: 0;
}
.feedback-box.is-answered .feedback-number { background: var(--success); }
.feedback-header-copy { flex: 1; min-width: 0; }
.feedback-section {
  margin-bottom: .38rem;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.feedback-question {
  margin-bottom: .75rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.55;
}
.feedback-answered {
  margin-top: .15rem;
  padding: .85rem .95rem;
  border-radius: var(--radius);
  background: rgba(22, 163, 74, .10);
  color: var(--text);
  font-size: .9rem;
}
.feedback-answered-label {
  margin-bottom: .28rem;
  color: #166534;
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.feedback-adjuntos {
  margin-top: .6rem;
  display: grid;
  gap: .35rem;
}
.feedback-adjunto-item {
  color: var(--text-muted);
  font-size: .84rem;
}
.prestador-card {
  position: relative;
  padding-left: 1rem;
  border-left: 4px solid var(--primary);
}
.prestador-name { font-size: 1rem; font-weight: 850; }
.prestador-spec { margin: .15rem 0 .3rem; color: var(--accent); font-size: .84rem; font-weight: 800; }
.prestador-detail { color: var(--text-muted); font-size: .87rem; }
.prestador-detail + .prestador-detail { margin-top: .18rem; }
.prestador-detail a { color: var(--text-muted); }
.prestador-detail a:hover { color: var(--primary-dark); }
.section-title {
  margin-bottom: .75rem;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.empty-state {
  text-align: center;
  padding: 2.6rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto .85rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: .78rem;
  font-weight: 900;
}
.empty-state p { font-size: .95rem; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .95rem 1.5rem;
  margin-bottom: 1rem;
  font-size: .92rem;
}
.detail-label {
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.detail-value { margin-top: .15rem; }
.detail-observaciones { margin-top: .35rem; line-height: 1.55; white-space: normal; }
.divider { border: 0; border-top: 1px solid var(--border-soft); margin: 1.25rem 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

@media (max-width: 860px) {
  .header-inner { height: auto; min-height: 68px; align-items: flex-start; flex-wrap: wrap; padding-block: .7rem; }
  .site-logo-img { width: 148px; }
  .site-nav { order: 3; width: 100%; flex: 1 0 100%; overflow-x: auto; padding-bottom: .1rem; }
  .nav-link { white-space: nowrap; }
  .module-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-main { padding: 1.25rem 1rem 2rem; }
  .header-inner { gap: .75rem; padding-inline: 1rem; }
  .header-user { margin-left: 0; }
  .user-name { display: none; }
  .page-header { display: block; }
  .feedback-header { gap: .75rem; }
  .form-row, .detail-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.45rem; }
  .login-actions { grid-template-columns: 1fr; }
  .tabs { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .tab-link { justify-content: center; }
}
