@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-base: #f3eee5;
  --bg-elevated: #fcf9f3;
  --bg-soft: #f0e7da;
  --surface: #fffdf9;
  --surface-strong: #f7f1e8;
  --text-main: #1b1814;
  --text-muted: #574f45;
  --border: #d8cdbd;
  --border-strong: #bcab95;
  --primary: #1f1a16;
  --primary-hover: #332c26;
  --primary-contrast: #f7f1e8;
  --accent: #b79a73;
  --accent-soft: #e9ddca;
  --success: #28583d;
  --success-soft: #ddece2;
  --danger: #8a2f28;
  --danger-soft: #f1dfdc;
  --warning: #7a4f21;
  --warning-soft: #f3e7d5;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --control-height: 2.65rem;
  --shadow-sm: 0 2px 10px rgba(20, 16, 11, 0.06);
  --shadow-md: 0 10px 28px rgba(24, 19, 13, 0.08);
  --focus-ring: 0 0 0 3px rgba(183, 154, 115, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, rgba(183, 154, 115, 0.14), transparent 38%),
    radial-gradient(circle at 100% 100%, rgba(143, 127, 105, 0.12), transparent 34%),
    var(--bg-base);
  color: var(--text-main);
  font-family: 'Open Sans', 'Segoe UI', sans-serif;
  line-height: 1.45;
}

a {
  color: var(--primary);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-hover);
}

a:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: var(--focus-ring);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  color: var(--text-main);
}

h1 {
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.22rem, 1.7vw, 1.45rem);
  font-weight: 600;
}

label {
  display: block;
  margin-bottom: 0.42rem;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.92rem;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-main);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

textarea {
  min-height: calc(var(--control-height) * 2.2);
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #9c9387;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: #fff;
}

.field-error label {
  color: var(--danger);
}

input.input-error,
select.input-error,
textarea.input-error {
  border-color: var(--danger);
  background: #fff8f6;
}

input.input-error:focus,
select.input-error:focus,
textarea.input-error:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(143, 58, 51, 0.22);
}

.field-error-message {
  margin: 0.32rem 0 0;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  min-height: var(--control-height);
  padding: 0.64rem 1rem;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  gap: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #efe4d2;
  color: var(--primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.btn-secondary:hover {
  background: #e2d1b8;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #7c302a;
}

.btn-ghost {
  background: transparent;
  /*border: 1px solid rgba(247, 241, 232, 0.42);*/
  color: var(--bg-base);
}

.btn-ghost:hover {
  border-color: rgba(247, 241, 232, 0.8);
  background: rgba(247, 241, 232, 0.1);
  color: var(--bg-elevated);
}


.field {
  min-width: 0;
}

.message {
  min-height: 2.1rem;
  margin-top: 0.55rem;
  padding: 0.52rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
}

.message.info {
  background: #ebe4d6;
  color: #5d523f;
}

.message.success {
  background: var(--success-soft);
  color: var(--success);
}

.message.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.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;
}

.is-hidden {
  display: none !important;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pendiente {
  background: #f0dcc0;
  color: var(--warning);
}

.status-aceptada,
.status-activo,
.status-si,
.status-aprobado {
  background: #d5eadc;
  color: var(--success);
}

.status-credito {
  background: #dceaf6;
  color: #1f517c;
}

.status-rechazada,
.status-no,
.status-inactivo {
  background: #f0d6d1;
  color: var(--danger);
}

.status-no-montado,
.status-vencido {
  background: #eadff1;
  color: #6b3f83;
}

.status-incidencia {
  background: #efd8b5;
  color: #70430f;
}

.checkbox-field {
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}

.compact-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--success);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
  color: #4a4237;
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tbody td {
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #e8e0d4;
  vertical-align: top;
  font-size: 0.9rem;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #fbf6ee;
}

@media (max-width: 980px) {
  table {
    min-width: 780px;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }

  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.7rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  tbody tr:hover td {
    background: transparent;
  }

  tbody td {
    display: grid;
    grid-template-columns: minmax(112px, 40%) 1fr;
    gap: 0.6rem;
    padding: 0.62rem 0.75rem;
    border-bottom: 1px solid #eee4d6;
    align-items: start;
  }

  tbody td:last-child {
    border-bottom: none;
  }

  tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }
}
