@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #1B2E4B; --navy-l: #2C4A73; --blue: #3B6CB7; --blue-l: #EEF3FB;
  --slate: #5A6A7E; --gray-1: #F7F8FA; --gray-2: #E8ECF0; --gray-3: #C4CBD4; --gray-4: #8A95A3;
  --black: #1A1F28; --white: #FFFFFF; --green: #1A7A4A; --green-bg: #EAF5EE; --red: #B91C1C;
  --font-s: 'Inter', sans-serif; --font-d: 'Lora', serif;
}
body { font-family: var(--font-s); background: var(--gray-1); color: var(--black); font-size: 14px; line-height: 1.6; min-height: 100vh; }

/* HEADER */
.header { background: var(--navy); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--blue); }
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-brand span { font-family: var(--font-d); font-size: 18px; color: white; }
.header-brand small { font-size: 11px; color: rgba(255,255,255,0.4); display: block; }
.btn-back { color: rgba(255,255,255,0.6); font-size: 12.5px; text-decoration: none; border: 1px solid rgba(255,255,255,0.2); padding: 5px 12px; border-radius: 5px; transition: all 0.15s; }
.btn-back:hover { color: white; border-color: rgba(255,255,255,0.5); }
.lang-btn { background: transparent; border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.6); padding: 3px 9px; border-radius: 4px; font-size: 11.5px; font-family: var(--font-s); cursor: pointer; transition: all 0.15s; font-weight: 500; }
.lang-btn:hover, .lang-btn.active { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.5); color: white; }

/* TOKEN INPUT SCREEN */
.token-screen { max-width: 480px; margin: 60px auto; padding: 0 20px; }
.token-card { background: white; border-radius: 12px; padding: 36px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); text-align: center; }
.token-card h2 { font-family: var(--font-d); font-size: 22px; color: var(--navy); margin-bottom: 8px; }
.token-card p { color: var(--slate); font-size: 13px; margin-bottom: 24px; }
.token-input-row { display: flex; flex-direction: column; gap: 10px; }
.token-input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-2); border-radius: 8px; font-family: monospace; font-size: 12.5px; outline: none; transition: border-color 0.15s; }
.token-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,108,183,0.1); }
.btn-load { padding: 12px; background: var(--navy); color: white; border: none; border-radius: 8px; font-family: var(--font-s); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-load:hover { background: var(--navy-l); }
.token-err { color: var(--red); font-size: 12.5px; display: none; margin-top: 6px; }

/* MAIN LAYOUT */
.main { max-width: 820px; margin: 0 auto; padding: 28px 20px 60px; display: none; }
.main.show { display: block; }

/* CASE HEADER CARD */
.case-header { background: white; border-radius: 10px; padding: 22px 24px; margin-bottom: 16px; box-shadow: 0 1px 6px rgba(0,0,0,0.06); display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.case-ref-big { font-family: monospace; font-size: 20px; font-weight: 700; color: var(--navy); letter-spacing: 0.05em; }
.case-meta { flex: 1; }
.case-meta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.meta-chip { background: var(--gray-1); border: 1px solid var(--gray-2); padding: 3px 10px; border-radius: 20px; font-size: 11.5px; color: var(--slate); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.st-recibida, .st-pendiente { background: #FFF7ED; color: #C2410C; }
.st-en_proceso { background: #EFF6FF; color: #1D4ED8; }
.st-resuelto, .st-archivado, .st-desestimado { background: var(--green-bg); color: var(--green); }
.resolution-box { background: var(--green-bg); border: 1px solid #86EFAC; border-radius: 8px; padding: 12px 16px; margin-top: 12px; font-size: 13px; color: #166534; }
.resolution-box strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; color: #166534; opacity: 0.7; }

/* TIMELINE SECTION */
.section-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--blue); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--gray-2); }

/* MESSAGES */
.messages-wrap { background: white; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,0.06); overflow: hidden; margin-bottom: 16px; }
.messages-list { padding: 20px; display: flex; flex-direction: column; gap: 14px; min-height: 120px; max-height: 440px; overflow-y: auto; }
.msg { max-width: 80%; }
.msg.rsii { align-self: flex-start; }
.msg.denunciante { align-self: flex-end; }
.msg-bubble { padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; }
.msg.rsii .msg-bubble { background: var(--gray-1); border: 1px solid var(--gray-2); color: var(--black); border-radius: 4px 12px 12px 12px; }
.msg.denunciante .msg-bubble { background: var(--navy); color: white; border-radius: 12px 4px 12px 12px; }
.msg-meta { font-size: 10.5px; color: var(--gray-4); margin-top: 4px; }
.msg.denunciante .msg-meta { text-align: right; }
.msg-author { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.msg.rsii .msg-author { color: var(--blue); }
.msg.denunciante .msg-author { color: rgba(255,255,255,0.6); }
.no-messages { text-align: center; padding: 30px; color: var(--gray-4); font-size: 13px; }

/* COMPOSE */
.compose { border-top: 1px solid var(--gray-2); padding: 14px 20px; display: flex; gap: 10px; align-items: flex-end; }
.compose textarea { flex: 1; border: 1.5px solid var(--gray-2); border-radius: 8px; padding: 9px 12px; font-family: var(--font-s); font-size: 13.5px; resize: none; outline: none; min-height: 44px; max-height: 120px; overflow-y: auto; transition: border-color 0.15s; }
.compose textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,108,183,0.1); }
.btn-send { padding: 10px 18px; background: var(--blue); color: white; border: none; border-radius: 8px; font-family: var(--font-s); font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s; white-space: nowrap; }
.btn-send:hover { background: var(--navy); }
.btn-send:disabled { background: var(--gray-3); cursor: not-allowed; }

/* ATTACHMENTS */
.attach-wrap { background: white; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,0.06); padding: 20px; }
.attach-upload { border: 2px dashed var(--gray-2); border-radius: 8px; padding: 20px; text-align: center; cursor: pointer; position: relative; transition: all 0.15s; }
.attach-upload:hover { border-color: var(--blue); background: var(--blue-l); }
.attach-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.attach-upload-txt { font-size: 12.5px; color: var(--gray-4); }
.attach-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.attach-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--gray-1); border-radius: 7px; font-size: 13px; }
.attach-item-name { flex: 1; font-weight: 500; }
.attach-item-size { font-size: 11.5px; color: var(--gray-4); }
.attach-item-by { font-size: 11px; color: var(--blue); font-weight: 500; }
.pending-item { display: flex; align-items: center; gap: 6px; margin-top: 5px; background: var(--gray-1); border-radius: 5px; padding: 4px 8px; font-size: 12px; }
.pending-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-del { background: #e2e8f0; border: none; cursor: pointer; color: #4a5568; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 4px; line-height: 1.4; flex-shrink: 0; }
.pending-del:hover { background: #fed7d7; color: #c53030; }
.btn-upload { margin-top: 10px; padding: 8px 18px; background: var(--navy); color: white; border: none; border-radius: 7px; font-family: var(--font-s); font-size: 13px; font-weight: 500; cursor: pointer; display: none; }
.btn-upload.show { display: inline-block; }

/* LOOKUP TABS */
.lookup-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.lookup-tab { flex: 1; padding: 8px; background: var(--gray-1); border: 1.5px solid var(--gray-2); border-radius: 7px; font-family: var(--font-s); font-size: 12.5px; font-weight: 500; color: var(--slate); cursor: pointer; transition: all 0.15s; }
.lookup-tab.active { background: var(--navy); border-color: var(--navy); color: white; }
.lookup-panel { display: none; }
.lookup-panel.show { display: block; animation: fadeIn 0.2s ease; }
.lookup-row { display: flex; gap: 8px; margin-bottom: 8px; }
.lookup-row input { flex: 1; min-width: 0; padding: 10px 12px; border: 1.5px solid var(--gray-2); border-radius: 8px; font-family: var(--font-s); font-size: 13px; outline: none; }
.lookup-row input:focus { border-color: var(--blue); }
.btn-look { padding: 10px 16px; background: var(--navy); color: white; border: none; border-radius: 8px; font-family: var(--font-s); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-look:hover { background: var(--navy-l); }
.lookup-hint { font-size: 12px; color: var(--gray-4); margin-bottom: 4px; }
.recover-ok { background: var(--green-bg); border: 1px solid #86EFAC; border-radius: 7px; padding: 12px 14px; font-size: 13px; color: var(--green); display: none; margin-top: 10px; }
.recover-ok.show { display: block; }
.anon-notice { background: var(--gray-1); border: 1px solid var(--gray-2); border-radius: 7px; padding: 12px 14px; font-size: 12px; color: var(--slate); line-height: 1.6; margin-top: 14px; text-align: left; }
.anon-notice strong { color: var(--black); }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

/* ALERT */
.alert { padding: 10px 14px; border-radius: 7px; font-size: 12.5px; margin-bottom: 12px; display: none; }
.alert.show { display: block; }
.alert-ok { background: var(--green-bg); color: var(--green); border: 1px solid #86EFAC; }
.alert-err { background: #FEF2F2; color: var(--red); border: 1px solid #FECACA; }

@media (max-width: 600px) {
  .case-header { flex-direction: column; }
  .msg { max-width: 92%; }
}
