/* ============================================================
   TOOLS — CSS Unificado
   Colores base: azul #026aa7 / verde #5aac44
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #026aa7;
  --blue-dark: #00365b;
  --blue-light:#e8f4fc;
  --green:     #5aac44;
  --green-dark:#519839;
  --red:       #e74c3c;
  --yellow:    #f1c40f;
  --bg:        #f4f5f7;
  --surface:   #fff;
  --border:    #ddd;
  --text:      #172b4d;
  --muted:     #6b778c;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(9,30,66,.2);
  --header-h:  56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ── */
.header {
  background: var(--blue);
  color: #fff;
  height: var(--header-h);
  padding: 0 16px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}
.header-title:hover { text-decoration: none; color: #fff; opacity: .85; }

.header-back {
  color: rgba(255,255,255,.85);
  font-size: 13px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-back:hover { color: #fff; text-decoration: none; }

/* ── CONTAINER ── */
.container {
  margin-top: var(--header-h);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
}

/* ── CARDS / BOXES ── */
.box {
  background: var(--surface);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  padding: 16px;
  margin: 8px 0;
  width: 100%;
  max-width: 800px;
  box-shadow: var(--shadow);
}

.box h2, .box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.box-gray { background: #f0f0f0; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  line-height: 1;
}
.btn:hover { text-decoration: none; opacity: .88; }

.btn-green  { background: var(--green);  color: #fff; }
.btn-blue   { background: var(--blue);   color: #fff; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-gray   { background: #e0e0e0;       color: var(--text); }
.btn-ghost  { background: transparent; border: 1px solid var(--border); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 4px; font-size: 16px; line-height: 1; }
.btn-icon.edit   { color: var(--yellow); }
.btn-icon.delete { color: var(--red); }
.btn-icon.check  { color: var(--green); }

/* ── TABLES ── */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.table th {
  background: #f2f2f2;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
}
.table tbody tr:hover { background: var(--bg); }
.table td.center { text-align: center; }
.table td.nowrap { white-space: nowrap; }
.table td.actions { white-space: nowrap; text-align: center; width: 1%; }

/* ── FORMS ── */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

input[type="text"], input[type="date"], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }

input.short  { width: 80px; }
input.medium { width: 160px; }

/* ── INACTIVE / DONE ── */
.inactive { text-decoration: line-through; color: var(--muted); }
.hidden   { display: none; }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  padding: 20px;
}

.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-logo-img {
  height: 100px !important;
  width: auto !important;
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.pin-display {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  min-height: 40px;
  margin-bottom: 20px;
  color: var(--text);
}

.pin-error {
  text-align: center;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 10px;
  min-height: 18px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  padding: 16px;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.keypad button:hover,
.keypad button:active { background: var(--blue-dark); }

.keypad button.btn-clear { background: #b0b0b0; }
.keypad button.btn-clear:hover { background: #888; }
.keypad button.btn-enter { background: var(--green); }
.keypad button.btn-enter:hover { background: var(--green-dark); }

/* ── MENU ── */
.menu-wrap {
  min-height: 100vh;
  background: var(--bg);
  padding-top: var(--header-h);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 24px 16px;
  max-width: 700px;
  margin: 0 auto;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.menu-card:hover {
  box-shadow: 0 4px 12px rgba(2,106,167,.2);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.menu-card-icon { font-size: 36px; }
.menu-card-name { font-size: 15px; font-weight: 700; }
.menu-card-desc { font-size: 12px; color: var(--muted); }

/* ── TRULLO: INDEX ── */
.delay-high   { color: var(--red);    font-weight: 700; }
.delay-medium { color: #e67e22;       font-weight: 700; }
.delay-low    { color: var(--green);  }

/* ── TRULLO: VIEW ── */
.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 12px;
}
.info-badge {
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

/* ── PROMPTS ── */
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 1000px;
}

.prompt-card {
  background: var(--surface);
  border: 2px dashed #aaa;
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
  position: relative;
}
.prompt-card:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(2,106,167,.12); }
.prompt-card.copied { border-color: var(--green); background: #f0fdf4; }

.prompt-card-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.prompt-card-desc  { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.prompt-card-body  {
  font-size: 12px; color: #444;
  background: var(--bg); border-radius: 4px;
  padding: 8px; line-height: 1.5;
  max-height: 72px; overflow: hidden;
  white-space: pre-wrap; pointer-events: none;
}
.prompt-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.prompt-copy-hint { font-size: 11px; color: var(--muted); }
.prompt-card-btns { display: none; gap: 4px; }
.prompt-card:hover .prompt-card-btns { display: flex; }

/* ── SIDEBAR (prompts) ── */
.app-layout { display: flex; min-height: calc(100vh - var(--header-h)); margin-top: var(--header-h); }

.sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted);
  padding: 0 14px 10px;
}

.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  border-left: 3px solid transparent;
  transition: background .12s;
}
.cat-item:hover { background: var(--bg); }
.cat-item.active { background: var(--blue-light); border-left-color: var(--blue); color: var(--blue); font-weight: 600; }
.cat-item-name { flex: 1; }
.cat-count { font-size: 11px; background: var(--bg); border-radius: 10px; padding: 1px 6px; color: var(--muted); }
.cat-actions { display: none; gap: 2px; }
.cat-item:hover .cat-actions { display: flex; }

.sidebar-footer { padding: 10px 14px; margin-top: auto; border-top: 1px solid var(--border); }

.app-main { flex: 1; padding: 20px 16px; overflow-y: auto; }
.app-main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.app-main-header h2 { font-size: 17px; font-weight: 700; }

/* ── MODAL ── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center; padding: 16px;
}
.overlay.open { display: flex; }

.modal {
  background: var(--surface); border-radius: 10px;
  padding: 22px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { font-size: 15px; font-weight: 700; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; }

.view-prompt-text {
  white-space: pre-wrap; font-size: 14px; line-height: 1.7;
  background: var(--bg); border-radius: var(--radius);
  padding: 14px; border: 1px solid var(--border);
  max-height: 50vh; overflow-y: auto;
  user-select: text;
}

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #172b4d; color: #fff;
  padding: 10px 20px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  transition: transform .25s ease;
  z-index: 999; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .box { padding: 12px; }

  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-direction: row; padding: 6px; overflow-x: auto;
    overflow-y: visible;
  }
  .sidebar-label, .sidebar-footer { display: none; }
  .cat-item { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .cat-item.active { border-bottom-color: var(--blue); }
  .cat-actions { display: none !important; }

  .table th, .table td { font-size: 12px; padding: 6px 8px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
}
