table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ddd; padding: 8px; }
.table-fixed { table-layout: fixed; }
.truncate-cells th, .truncate-cells td { overflow: hidden; text-overflow: ellipsis; }
.toolbar { margin-bottom: 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.actions { display: flex; gap: 8px; align-items: center; }
.toolbar .actions { margin-left: auto; }
.actions a, .actions form { margin-right: 8px; }
.sortable { cursor: pointer; user-select: none; }
.sort-dir { margin-left: 4px; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid #ccc; background: #f5f5f5; color: #333; line-height: 0; }
.icon-btn svg { display: block; width: 20px; height: 20px; }
.icon-btn.primary { border-color: #3ba255; color: #3ba255; background: #f0fff3; }
.search-wrap { position: relative; }
.clear-input { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: #eee; color: #555; width: 20px; height: 20px; border-radius: 50%; display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }
.clear-input svg { display: block; }
.cell-edit-wrap { position: relative; }
.cell-error { background: #ffecec; box-shadow: inset 0 0 0 2px #b00020; }
.lang-error { background: #ffecec; box-shadow: inset 0 0 0 2px #b00020; }
.toolbar input[type="text"] { padding: 6px 8px; width: 280px; }
.badge { background: #eef; border: 1px solid #ccd; padding: 2px 6px; border-radius: 4px; }
.badge-edit { background: #eaf7eb; border-color: #3ba255; color: #2b7a37; }
.badge-view { background: #eef; border-color: #ccd; color: #334; }
.badge-edit::before { content: "✎"; margin-right: 4px; }
.badge-view::before { content: "👁"; margin-right: 4px; }
.inline-input { width: 100%; box-sizing: border-box; padding: 0; border: 0; outline: none; background: transparent; font: inherit; }
.with-clear { padding-right: 26px; }
.cell-editing { background: #f1fff5; box-shadow: inset 0 0 0 2px #3ba255; }
.row-pending td:not(.cell-error) { background: #fff7e6; box-shadow: inset 0 0 0 2px #ff9800; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.box { max-width: 520px; margin: 0 auto; border: 1px solid #ddd; padding: 1rem; border-radius: 8px; }
.box label { display: block; margin-top: 0.75rem; }
.box input[type="text"], .box input[type="file"], .box input[type="password"] { width: 100%; padding: 0.5rem; margin-top: 0.25rem; box-sizing: border-box; }
.box select { width: 100%; padding: 0.5rem; margin-top: 0.25rem; box-sizing: border-box; }
.box button { margin-top: 1rem; }
.box-login { max-width: 360px; }
.box-login button:not(.toggle-pass) { width: 100%; padding: 0.6rem; }
.box-login h2 { text-align: center; }
.error { color: #b00020; }
th { background: #f7f7f7; }
.btn { background:#3ba255;color:#fff;padding:6px 10px;border-radius:4px;text-decoration:none; display:inline-block }
.btn-secondary { background:#555;color:#fff;padding:6px 10px;border-radius:4px;text-decoration:none; display:inline-block }
.btn .btn-icon, .btn-secondary .btn-icon { width: 14px; height: 14px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.btn-mini { font-size: 11px; padding: 2px 6px; margin-left: 6px; border-radius: 4px; border: 1px solid #ccc; background: #f8f8f8; cursor: pointer; }
.btn-mini.loading, .btn.loading, .btn-secondary.loading { opacity:.7; pointer-events:none; }
.btn-mini.loading::after, .btn.loading::after, .btn-secondary.loading::after { content:""; display:inline-block; width:10px; height:10px; border-radius:50%; border:2px solid #999; border-top-color: transparent; margin-left:6px; vertical-align:middle; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px #bde5c8; }
.tooltip-bubble { position: fixed; display: none; max-width: 280px; background: #222; color: #fff; padding: 6px 8px; border-radius: 6px; font-size: 12px; line-height: 1.4; box-shadow: 0 6px 16px rgba(0,0,0,.25); z-index: 9999; pointer-events: none; transform: translateX(-50%); }
.tooltip-bubble::after { content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-bottom-color: #222; }
.error-banner { display: none; background: #ffecec; border: 1px solid #b00020; color: #b00020; padding: 8px; border-radius: 6px; margin-bottom: 12px; }
body { font-family: system-ui, Arial; margin: 2rem; }
nav a { margin-right: 12px; text-decoration: none; padding: 4px 8px; border-radius: 4px; }
.active { background: #eef; border: 1px solid #ccd; }
main { margin-top: 1rem; }
.subnav { margin: 8px 0; }
.subnav a { margin-right: 12px; text-decoration: none; padding: 4px 8px; border-radius: 4px; }
.d-none { display: none !important; }
.opacity-50 { opacity: .5 !important; }
.pe-none { pointer-events: none !important; }
.disabled { cursor: not-allowed !important; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.m-0 { margin: 0 !important; }
.m-1 { margin: .25rem !important; }
.m-2 { margin: .5rem !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: .25rem !important; }
.p-2 { padding: .5rem !important; }
.ms-auto { margin-left: auto !important; }

/* Responsive toolbar for translations */
@media (max-width: 900px) {
  .toolbar { flex-wrap: wrap; align-items: stretch; }
  .toolbar form { order: 0; flex: 1 0 100%; }
  .toolbar .search-wrap { width: 100%; }
  .toolbar input[type="text"] { width: 100%; }
  .toolbar .actions { order: 1; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .toolbar .actions .btn,
  .toolbar .actions .btn-secondary { flex: 1 1 auto; min-width: 0; }
  .toolbar .actions .icon-btn { margin-left: 0; }
}

/* Password visibility toggle */
.input-wrap { position: relative; }
.with-toggle { padding-right: 36px; }
.box label + .input-wrap { margin-top: 0.25rem; }
.box .input-wrap > input.with-toggle { margin-top: 0 !important; }
.toggle-pass {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0;
  background: transparent;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  z-index: 3;
}
.toggle-pass:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #bde5c8;
}
.toggle-pass:hover {
  background: rgba(0,0,0,0.05);
  border-radius: 50%;
}
.toggle-pass svg { width: 16px; height: 16px; display: block; }
.toggle-pass .icon-eye,
.toggle-pass .icon-eye-off { display: none; }
.toggle-pass[data-state="hidden"] .icon-eye { display: block; }
.toggle-pass[data-state="visible"] .icon-eye-off { display: block; }

/* Mostrar botones de autocompletar solo al pasar el cursor por la celda */
.cell-val, .cell-key { position: relative; }
.btn-auto-cell, .btn-auto-row { display: none; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-left: 0; }
.cell-val:hover .btn-auto-cell { display: inline-flex; }
.cell-key:hover .btn-auto-row { display: inline-flex; }
.btn-auto-cell svg, .btn-auto-row svg { width: 14px; height: 14px; display: block; }
.btn-del-row {
  background: #f8f8f8;
  color: #333;
  border: 1px solid #ccc;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.btn-del-row:hover {
  background: #eee;
}
.btn-del-row:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #bde5c8;
}
.btn-del-row svg {
  width: 12px;
  height: 12px;
}

.btn-back-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #333;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3000;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  line-height: 0;
}
.btn-back-top:hover {
  background: #eee;
}
.btn-back-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #bde5c8;
}
.btn-back-top svg {
  width: 18px;
  height: 18px;
  display: block;
}
