:root {
  --green-900: #0f5132;
  --green-800: #13653f;
  --green-700: #1d7a4a;
  --green-100: #e8f4ee;
  --gray-900: #1f2937;
  --gray-700: #4b5563;
  --gray-500: #6b7280;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --white: #ffffff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; color: var(--gray-900); background: var(--white); line-height: 1.5; }
.container { width: min(1100px, 92%); margin: 0 auto; }
.site-header { border-bottom: 1px solid var(--gray-200); background: linear-gradient(180deg, var(--white) 0%, #f9fbfa 100%); }
.page-header { padding: 2rem 0 1.4rem; }
.page-header h1 { margin: 0; color: var(--green-900); font-size: clamp(1.5rem, 2.5vw, 2.1rem); }
.page-header p { margin: .6rem 0 1rem; color: var(--gray-700); }
.header-nav a { color: var(--green-800); text-decoration: none; font-weight: 600; }
.header-nav a:hover { text-decoration: underline; }
main { padding: 1.8rem 0 2.2rem; }
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 12px; padding: 1rem 1.1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card + .card { margin-top: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .85rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .35rem; color: var(--gray-700); }
input, select { width: 100%; border: 1px solid #cfd4dc; border-radius: 8px; padding: .6rem .7rem; font: inherit; background: #fff; }
.button { display: inline-block; border-radius: 8px; padding: .6rem .95rem; text-decoration: none; font-weight: 600; border: 1px solid transparent; }
.button-primary { background: var(--green-700); color: #fff; }
.button-primary:hover { background: var(--green-800); }
.badge { display: inline-block; background: var(--green-100); color: var(--green-900); padding: .2rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.alert { padding: .85rem 1rem; border-radius: 8px; border: 1px solid #d6e9df; background: #f4fbf7; color: var(--green-900); }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: .35rem .9rem; margin: .8rem 0; }
.meta p { margin: 0; }
.site-footer { border-top: 1px solid var(--gray-200); background: #fbfbfb; color: var(--gray-500); font-size: .92rem; }
.site-footer .container { padding: 1rem 0; }
@media (max-width: 640px) { .page-header { padding-top: 1.2rem; } .card { padding: .9rem; } }

.header-content { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; }
.brand-block { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
.brand-logo { width: 100%; max-width: 150px; height: auto; display: block; flex-shrink: 0; }
.back-link-wrapper { margin: 0 0 1rem; }
@media (max-width: 640px) { .header-content { flex-direction: column; align-items: flex-start; gap: .75rem; } .brand-logo { width: 100%; max-width: min(150px, 38vw); } }

/* Admin area */
.admin-layout {
  background: #f4f6f5;
  color: var(--gray-900);
}

.admin-container {
  width: min(1140px, 94%);
  margin: 0 auto;
}

.admin-header {
  background: var(--white);
  border-bottom: 1px solid #dce4df;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.admin-header-top {
  padding: 1.2rem 0 .9rem;
}

.admin-logo {
  display: block;
  max-width: 165px;
  width: 100%;
  height: auto;
  margin-bottom: .65rem;
}

.admin-title {
  margin: 0;
  color: var(--green-900);
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
}

.admin-subtitle {
  margin: .2rem 0 0;
  color: var(--gray-700);
  font-weight: 600;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  padding: 0 0 1rem;
}

.admin-nav a {
  text-decoration: none;
  color: var(--green-800);
  font-weight: 600;
  border: 1px solid #d6e4dc;
  background: #f7fbf9;
  padding: .42rem .7rem;
  border-radius: 8px;
}

.admin-nav a:hover {
  background: var(--green-100);
}

.admin-main {
  padding: 1.25rem 0 2rem;
}

.admin-card {
  background: var(--white);
  border: 1px solid #dde5e1;
  border-radius: 14px;
  padding: 1.1rem;
  box-shadow: 0 2px 8px rgba(20, 41, 32, .04);
}

.admin-main h2,
.admin-main h3 {
  color: var(--green-900);
  margin-top: 0;
}

.admin-main table,
.table {
  width: 100%;
  border-collapse: collapse;
  margin: .9rem 0 1.2rem;
  border: 1px solid #d9e2de;
  background: var(--white);
}

.admin-main th,
.admin-main td,
.table th,
.table td {
  border: 1px solid #e1e9e5;
  padding: .58rem .64rem;
  text-align: left;
  vertical-align: top;
}

.admin-main th,
.table th {
  background: #eef5f1;
  color: #234637;
  font-weight: 700;
  text-align: center;
}

.admin-main form {
  margin: .8rem 0;
}

.admin-main label,
.form-group label {
  display: block;
  margin-bottom: .32rem;
  font-weight: 600;
  color: var(--gray-700);
}

.admin-main input,
.admin-main select,
.admin-main textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid #cdd8d2;
  border-radius: 8px;
  padding: .58rem .66rem;
  font: inherit;
  background: #fff;
}

.form-group {
  margin-bottom: .8rem;
}

.button,
.admin-main button,
.admin-main input[type="submit"] {
  display: inline-block;
  border-radius: 8px;
  padding: .55rem .85rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.button-primary,
.admin-main button,
.admin-main input[type="submit"] {
  background: var(--green-700);
  color: #fff;
  border-color: var(--green-700);
}

.button-secondary {
  background: #edf2ef;
  color: #274437;
  border-color: #cfdad4;
}

.button-danger {
  background: #b4232f;
  color: #fff;
  border-color: #b4232f;
}

.admin-main a { color: var(--green-800); }

.alert {
  border-radius: 8px;
  padding: .75rem .9rem;
  margin: .8rem 0;
  border: 1px solid #cde2d6;
  background: #f1f9f4;
  color: #22553a;
}

.alert-success { border-color: #b8ddc7; background: #eaf7ef; color: #184c32; }
.alert-error { border-color: #ebc2c7; background: #fdf0f2; color: #7f1d1d; }
.alert-warning { border-color: #f0dfb0; background: #fff8e5; color: #6f4f00; }

.badge {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-900);
  border-radius: 999px;
  padding: .2rem .56rem;
  font-size: .82rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .admin-card { padding: .9rem; }
  .admin-nav { gap: .45rem; }
  .admin-nav a { padding: .38rem .62rem; font-size: .94rem; }
  .admin-main table { display: block; overflow-x: auto; white-space: nowrap; }
}


.admin-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.admin-header-logo {
  margin-bottom: 0;
  flex-shrink: 0;
}


.button-sm {
  padding: 6px 10px;
  font-size: .85rem;
  line-height: 1.2;
  min-height: 32px;
  border-radius: 8px;
}

.icon-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  flex: 0 0 48px;
}

.icon-button img {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  display: block;
}

.table-anexos-pdf {
  table-layout: fixed;
}

.table-anexos-pdf th,
.table-anexos-pdf td {
  overflow-wrap: anywhere;
}

.attachments-actions-column {
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  text-align: center;
}

.attachment-actions-cell {
  min-width: 210px;
  max-width: 210px;
  text-align: center;
}

.attachment-actions {
  max-width: 200px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.attachment-action-form {
  margin: 0 !important;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-action-button {
  min-height: 34px;
  padding: 5px 6px;
  font-size: 0.78rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.1;
}

.attachment-action-button.icon-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
}

.attachment-actions .button,
.attachment-actions .attachment-action-button {
  font-size: 0.78rem;
}

.attachment-order-form {
  width: 100%;
  flex: 0 0 100%;
  justify-content: center;
}

.attachment-order-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.attachment-actions .order-input {
  width: 44px !important;
  min-width: 44px;
  flex: 0 0 44px;
  text-align: center;
  padding: 5px 4px;
}

.attachment-order-row .attachment-action-button {
  width: 34px;
  flex: 0 0 34px;
  align-self: center;
}




.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-responsive table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

.usuarios-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
}

.usuarios-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}

.usuarios-table th,
.usuarios-table td {
  box-sizing: border-box;
}

.usuarios-table td {
  overflow-wrap: anywhere;
  word-break: normal;
}

.usuarios-table .actions,
.usuarios-table .actions-cell,
.usuarios-table td:last-child {
  white-space: nowrap;
}

.admin-users-table {
  table-layout: auto;
}

.admin-users-table th,
.admin-users-table td {
  padding: .38rem .42rem;
  white-space: normal;
}

.admin-users-id,
.admin-users-status,
.admin-users-date,
.admin-users-actions,
.admin-users-table .text-center {
  text-align: center;
}

.admin-users-id {
  width: 52px;
}

.admin-users-status {
  width: 64px;
}

.admin-users-date {
  width: 128px;
  min-width: 116px;
}

.admin-users-actions {
  width: 170px;
  min-width: 170px;
}

.actions-cell {
  white-space: nowrap;
  text-align: center;
  width: 170px;
  min-width: 170px;
}

.actions-cell .actions {
  display: inline-flex;
  white-space: nowrap;
}

.usuarios-table .admin-users-id,
.usuarios-table .admin-users-status,
.usuarios-table .admin-users-date,
.usuarios-table .admin-users-actions,
.usuarios-table .actions-cell,
.usuarios-table .text-center {
  vertical-align: middle;
}

.usuarios-table .admin-users-id,
.usuarios-table .admin-users-status,
.usuarios-table .admin-users-date,
.usuarios-table .admin-users-actions {
  white-space: nowrap;
}

.text-center {
  text-align: center !important;
}

.button-secondary:hover {
  background: #e2ebe6;
}

.button-danger:hover {
  background: #991b1b;
}

@media (max-width: 760px) {
  .admin-header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-header-logo {
    max-width: min(165px, 45vw);
  }
}


.button,
a.button,
a.button:visited,
a.button:hover {
  text-decoration: none;
}

a.button.button-primary,
a.button.button-primary:visited {
  color: #fff;
}

a.button.button-secondary,
a.button.button-secondary:visited {
  color: #274437;
}

a.button.button-danger,
a.button.button-danger:visited,
a.button.button-success,
a.button.button-success:visited {
  color: #fff;
}

.button-success {
  background: #166534;
  color: #fff;
  border-color: #166534;
}

.button-success:hover {
  background: #14532d;
}

.admin-section {
  margin-bottom: 1rem;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .95rem 1.1rem;
}

.details-row {
  min-width: 0;
}

.details-label {
  display: block;
  margin-bottom: .22rem;
  color: #234637;
  font-weight: 700;
}

.details-value {
  margin: 0;
  color: var(--gray-900);
  overflow-wrap: anywhere;
}

.details-item-full {
  grid-column: 1 / -1;
}

.file-upload {
  border: 1px solid #dce5e0;
  background: #f8fbf9;
  border-radius: 10px;
  padding: .8rem .9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .65rem .85rem;
  margin-bottom: .9rem;
}

.file-upload label {
  margin: 0;
  min-width: 220px;
}

.file-input {
  max-width: 380px;
  margin: 0;
  padding: .35rem .45rem;
  border: 1px solid #cdd8d2;
  border-radius: 8px;
  background: #fff;
}

.file-input::file-selector-button {
  border: 1px solid #b9cfc3;
  border-radius: 6px;
  background: #eaf3ee;
  color: #274437;
  padding: .35rem .7rem;
  margin-right: .65rem;
  cursor: pointer;
  font-weight: 600;
}

.actions-inline {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.actions input[type="number"] {
  width: 85px;
}

.button:hover {
  text-decoration: none;
}

.button-secondary:hover {
  background: #dfe8e3;
}

.button-danger:hover {
  background: #931a24;
}

.button-success {
  background: #1f8a4c;
  color: #fff;
  border-color: #1f8a4c;
}

.button-success:hover {
  background: #176b3a;
}

.text-center {
  text-align: center !important;
}

.actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
}

.actions form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.icon-button,
a.button.icon-button,
a.button.icon-button:visited,
.admin-main button.icon-button,
.admin-main button.icon-button:hover,
.button.icon-button:hover,
a.button.icon-button:hover,
.attachment-actions .button.icon-button,
.attachment-actions .attachment-action-button.icon-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}

.button.icon-button img,
a.button.icon-button img,
.admin-main button.icon-button img {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  display: block;
}

@media (max-width: 768px) {
  .actions {
    flex-wrap: wrap;
  }
}

.admin-form {
  max-width: 760px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}

.form-help {
  margin-top: .75rem;
  color: var(--gray-700);
}

.usuarios-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.usuarios-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    box-sizing: border-box;
}

.usuarios-table th,
.usuarios-table td {
    box-sizing: border-box;
}

.usuarios-table td {
    overflow-wrap: anywhere;
}

.usuarios-table td:last-child {
    white-space: nowrap;
}
