/* ═══════════════════════════════════════════════════════
   Cardinal Data — Design System
   Basado en: Stitch Design System + Swiss Minimalist
   ═══════════════════════════════════════════════════════ */

:root {
  --surface: #fbf9f8;
  --surface-dim: #dbdad9;
  --surface-bright: #fbf9f8;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f5f3f3;
  --surface-container: #efeded;
  --surface-container-high: #e9e8e7;
  --surface-container-highest: #e4e2e2;
  --on-surface: #1b1c1c;
  --on-surface-variant: #5c4037;
  --inverse-surface: #303031;
  --inverse-on-surface: #f2f0f0;
  --primary: #a73400;
  --on-primary: #ffffff;
  --primary-container: #d14300;
  --on-primary-container: #fffbff;
  --primary-fixed: #ffdbcf;
  --primary-fixed-dim: #ffb59c;
  --inverse-primary: #ffb59c;
  --secondary: #5f5e5f;
  --on-secondary: #ffffff;
  --secondary-container: #e2dfe0;
  --on-secondary-container: #636263;
  --tertiary: #5a5c5d;
  --tertiary-container: #737576;
  --error: #ba1a1a;
  --on-error: #ffffff;
  --error-container: #ffdad6;
  --on-error-container: #93000a;
  --outline: #907065;
  --outline-variant: #e5beb2;
  --background: #fbf9f8;
  --on-background: #1b1c1c;
  --font-display: 'Hanken Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 80px;
  --gutter: 24px;
  --margin-desktop: 64px;
  --margin-tablet: 32px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow-card: 0px 12px 32px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0px 2px 8px rgba(0, 0, 0, 0.04);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px; line-height: 24px;
  color: var(--on-background);
  background: var(--background);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--on-surface); }

/* ── Login ─────────────────────────────────────────── */
#loginScreen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--space-3xl) var(--space-md);
  background: linear-gradient(160deg, var(--primary-fixed) 0%, var(--surface-bright) 60%, var(--surface) 100%);
  position: relative; overflow: hidden;
}
#loginScreen::before {
  content: ''; position: absolute; top: -20%; right: -10%;
  width: 600px; height: 600px;
  background: var(--primary);
  border-radius: 50%; filter: blur(150px); opacity: 0.08; pointer-events: none;
}
#loginScreen::after {
  content: ''; position: absolute; bottom: -15%; left: -10%;
  width: 500px; height: 500px;
  background: var(--primary-fixed-dim);
  border-radius: 50%; filter: blur(130px); opacity: 0.10; pointer-events: none;
}
#loginScreen.hidden { display: none !important; }

.login-box {
  width: 100%; max-width: 420px; position: relative; z-index: 1;
  text-align: center;
}

.login-brand { margin-bottom: var(--space-xl); }

.login-logo {
  color: var(--primary); margin-bottom: var(--space-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.login-logo svg { width: 32px; height: 32px; }

.login-brand h1 {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--on-surface); margin: 0;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: 0px 8px 40px rgba(0, 0, 0, 0.08);
  text-align: left;
}

.login-welcome {
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  color: var(--on-surface); margin-bottom: var(--space-xs);
}

.login-subtitle {
  font-size: 14px; color: var(--on-surface-variant);
  margin-bottom: var(--space-xl);
}

.login-error {
  display: none; margin-top: var(--space-md); padding: var(--space-sm) var(--space-md);
  background: var(--error-container); border: 1px solid var(--error);
  border-radius: var(--radius-md); color: var(--on-error-container); font-size: 13px;
}
.login-error.show { display: block; }

.password-wrapper {
  position: relative;
}
.password-wrapper .form-input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--outline); padding: 6px; display: flex;
  border-radius: var(--radius-sm); transition: color 0.2s;
}
.password-toggle:hover { color: var(--on-surface-variant); }
.password-toggle.showing svg { color: var(--primary); }

.login-options {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.checkbox-label {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  font-size: 14px; color: var(--on-surface-variant); cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.checkbox-label input[type="checkbox"] {
  display: none;
}
.checkbox-custom {
  width: 18px; height: 18px; border: 2px solid var(--outline);
  border-radius: var(--radius-sm); display: inline-flex;
  align-items: center; justify-content: center; transition: all 0.2s;
  flex-shrink: 0;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--primary); border-color: var(--primary);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: ''; display: block; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
  margin-top: -1px;
}
.forgot-link {
  font-size: 14px; color: var(--primary); text-decoration: none;
  font-weight: 500;
}
.forgot-link:hover { text-decoration: underline; }

.upload-steps {
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.upload-steps .step {
  display: flex; align-items: center; gap: var(--space-sm);
  font-size: 13px; color: var(--on-surface-variant); transition: color 0.3s;
}
.upload-steps .step .step-icon {
  width: 20px; text-align: center; flex-shrink: 0;
  font-size: 14px; color: var(--outline); transition: color 0.3s;
}
.upload-steps .step.active {
  color: var(--primary); font-weight: 500;
}
.upload-steps .step.active .step-icon {
  color: var(--primary);
}
.upload-steps .step.done {
  color: #166534;
}
.upload-steps .step.done .step-icon {
  color: #166534;
}
.upload-steps .step.error {
  color: #991b1b;
}
.upload-steps .step.error .step-icon {
  color: #991b1b;
}

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }
.form-group label {
  display: block; font-size: 14px; font-weight: 500;
  color: var(--on-surface-variant); margin-bottom: var(--space-xs);
}
.form-input {
  width: 100%; height: 40px; padding: 0 var(--space-md);
  background: var(--surface); border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md); font-family: var(--font-body);
  font-size: 15px; color: var(--on-surface); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
  border-color: var(--primary-container);
  box-shadow: 0 0 0 2px rgba(209, 67, 0, 0.2);
  background: var(--surface-bright);
}
.form-input::placeholder { color: var(--outline); opacity: 0.6; }
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c4037' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px; cursor: pointer;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm); height: 44px; padding: 0 var(--space-lg);
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  border: none; border-radius: var(--radius-lg); cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-container); }
.btn-secondary { background: var(--surface-container-high); color: var(--on-surface); border: 1px solid var(--outline-variant); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-container-highest); }
.btn-danger { background: var(--error); color: var(--on-error); }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-sm { height: 36px; padding: 0 var(--space-md); font-size: 14px; border-radius: var(--radius-md); }
.btn-sm.btn-danger { border-radius: var(--radius-md); }
.btn-full { width: 100%; }

/* ── App Layout ────────────────────────────────────── */
#app { display: none; width: 100%; height: 100vh; flex-direction: column; overflow: hidden; }
#app.show { display: flex; }

.topbar {
  background: var(--surface-container-lowest);
  border-bottom: 1px solid var(--outline-variant);
  height: 56px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 var(--gutter); flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: var(--space-lg); }
.topbar-brand { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--primary); }
.topbar-tenant { font-size: 13px; color: var(--secondary); padding-left: var(--space-lg); border-left: 1px solid var(--outline-variant); }
.topbar-right { display: flex; align-items: center; gap: var(--space-md); }
.topbar-user { font-size: 13px; color: var(--on-surface-variant); }
.topbar-user strong { font-weight: 600; color: var(--on-surface); }
.topbar-logout { font-size: 13px; color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 500; }
.topbar-logout:hover { text-decoration: underline; }

.nav {
  display: flex; gap: 0; border-bottom: 1px solid var(--outline-variant);
  background: var(--surface-container-lowest); padding: 0 var(--gutter); flex-shrink: 0;
}
.nav a {
  display: flex; align-items: center; height: 44px; padding: 0 var(--space-lg);
  font-size: 14px; font-weight: 500; color: var(--on-surface-variant);
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s; cursor: pointer;
}
.nav a:hover { color: var(--on-surface); border-bottom-color: var(--outline-variant); }
.nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

.content { flex: 1; overflow: hidden; display: flex; flex-direction: column; background: var(--surface-container-low); }

/* ── Chat ──────────────────────────────────────────── */
.chat-area { flex: 1; display: flex; overflow: hidden; }
.chat-layout { display: flex; flex: 1; overflow: hidden; }

.chat-sidebar { width: 260px; min-width: 260px; background: var(--surface-container-low); border-right: 1px solid var(--outline-variant); display: flex; flex-direction: column; flex-shrink: 0; padding-top: var(--space-md); transition: width 0.25s ease, min-width 0.25s ease, opacity 0.25s ease; overflow: hidden; }
.chat-sidebar.collapsed { width: 0; min-width: 0; opacity: 0; padding: 0; border: none; }
.chat-sidebar-header { padding: 0 var(--space-md) var(--space-md); border-bottom: 1px solid var(--outline-variant); }
.chat-sidebar-header .new-conv-btn { width: 100%; height: 36px; background: var(--primary); color: var(--on-primary); border: none; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; cursor: pointer; }
.chat-sidebar-header .new-conv-btn:hover { background: var(--primary-container); }
.chat-sidebar-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; color: var(--secondary); padding: var(--space-md) var(--space-md) var(--space-sm); text-transform: uppercase; white-space: nowrap; }
#convList { flex: 1; overflow-y: auto; padding: var(--space-xs) var(--space-md); }
.conv-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); font-size: 14px; color: var(--on-surface-variant); cursor: pointer; transition: background 0.15s; border: none; background: none; width: 100%; text-align: left; border-bottom: 1px solid var(--outline-variant); }
.conv-item.active { background: var(--surface-container-high); color: var(--on-surface); font-weight: 500; }
.conv-item .conv-title { flex-grow: 1; }
.conv-del-btn { background: none; border: none; color: var(--error); font-size: 10px; font-weight: 600; cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm); transition: background 0.15s; flex-shrink: 0; }
.conv-item:hover .conv-del-btn { background: var(--error-container); }
.conv-del-btn:hover { text-decoration: underline; }

.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--surface-container-lowest); min-width: 0; }
.chat-header { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--outline-variant); flex-shrink: 0; }
.chat-header .sidebar-toggle { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; color: var(--on-surface-variant); flex-shrink: 0; line-height: 1; border-radius: var(--radius-sm); transition: background 0.15s; }
.chat-header .sidebar-toggle:hover { background: var(--surface-container); }
.chat-header .conv-titulo { font-size: 16px; font-weight: 600; color: var(--on-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-titulo-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.conv-titulo-wrap .edit-title-btn { background: none; border: none; color: var(--outline); font-size: 13px; cursor: pointer; padding: 2px; opacity: 0; transition: opacity 0.15s, color 0.15s; flex-shrink: 0; line-height: 1; }
.conv-titulo-wrap:hover .edit-title-btn { opacity: 1; }
.conv-titulo-wrap .edit-title-btn:hover { color: var(--primary); }
.title-input { font: inherit; font-size: 16px; font-weight: 600; background: var(--surface-container); border: 1px solid var(--primary); border-radius: var(--radius-sm); padding: 2px 6px; color: var(--on-surface); outline: none; width: 100%; min-width: 60px; }
.chat-header .conv-timestamp { font-size: 12px; color: var(--secondary); white-space: nowrap; flex-shrink: 0; }

.empty-chat { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--secondary); gap: var(--space-md); }
.empty-chat .icon { font-size: 48px; opacity: 0.3; }
.empty-chat .text { font-size: 14px; }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md); scroll-behavior: smooth; }
@keyframes msgFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message { display: flex; gap: var(--space-sm); max-width: 80%; animation: msgFadeIn 0.25s ease-out; }
.message.user { align-self: flex-end; }
.message.user .message-bubble { max-width: 100%; }
.message.assistant { align-self: flex-start; }
.message-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.message-avatar.user { background: var(--inverse-surface); color: var(--inverse-on-surface); }
.message-avatar.assistant { background: var(--primary-container); color: var(--on-primary); }
.message-bubble { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-lg); font-size: 14px; line-height: 1.5; min-width: 60px; max-width: 100%; word-break: break-word; }
.message-bubble p { margin: 0 0 6px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 4px 0; padding-left: 20px; }
.message-bubble li { margin-bottom: 2px; }
.message-bubble pre { margin: 6px 0; border-radius: var(--radius-sm); background: var(--surface-container); padding: var(--space-sm); overflow-x: auto; position: relative; }
.message-bubble pre .copy-btn { position: absolute; top: 4px; right: 4px; background: var(--surface-container-high); border: 1px solid var(--outline-variant); color: var(--on-surface-variant); font-size: 10px; padding: 2px 8px; border-radius: var(--radius-sm); cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s; font-family: inherit; }
.message-bubble pre:hover .copy-btn { opacity: 1; }
.message-bubble pre .copy-btn:hover { background: var(--surface-container-highest); }
.message-bubble code { font-size: 13px; background: var(--surface-container-high); padding: 1px 4px; border-radius: 3px; }
.message-bubble .msg-copy-btn { display: block; margin-top: var(--space-sm); background: none; border: 1px solid var(--outline-variant); color: var(--secondary); font-size: 11px; padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; font-family: inherit; }
.message-bubble .msg-copy-btn:hover { background: var(--surface-container); color: var(--on-surface); border-color: var(--primary); }
.message.user .message-bubble { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: var(--radius-sm); }
.message.assistant .message-bubble { background: var(--surface-container-low); color: var(--on-surface); border: 1px solid var(--outline-variant); border-bottom-left-radius: var(--radius-sm); }
.message-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em; color: var(--secondary); margin-bottom: var(--space-xs); text-transform: uppercase; }

.chat-input-area { padding: var(--space-md) var(--gutter); border-top: 1px solid var(--outline-variant); background: var(--surface-container-lowest); flex-shrink: 0; display: flex; justify-content: center; }
.chat-input-wrap { display: flex; gap: var(--space-sm); align-items: center; max-width: 800px; width: 100%; }
.chat-input-wrap .chat-input { flex: 1; background: var(--surface-container-low); border-radius: var(--radius-lg); border: 1px solid var(--outline-variant); padding: var(--space-sm) var(--space-md); font-family: inherit; font-size: 14px; color: var(--on-surface); resize: none; min-height: 40px; max-height: 120px; outline: none; line-height: 1.4; }
.chat-input-wrap .chat-input:focus { background: var(--surface-bright); border-color: var(--primary-container); box-shadow: 0 0 0 2px rgba(209, 67, 0, 0.2); }
.chat-input-wrap .btn-send { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary); color: var(--on-primary); border: none; cursor: pointer; flex-shrink: 0; font-size: 18px; transition: background 0.2s; }
.chat-input-wrap .btn-send:hover { background: var(--primary-container); }
.chat-input-wrap .btn-send:disabled { opacity: 0.5; }

/* ── Admin Sections ────────────────────────────────── */
.admin-area { flex: 1; overflow-y: auto; padding: var(--space-lg) var(--space-3xl); }
@media (max-width: 1024px) { .admin-area { padding: var(--space-lg) var(--gutter); } }
.admin-area h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-bottom: var(--space-lg); }
.section-title { font-size: 13px; font-weight: 600; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-sm); }

.card { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--radius-lg); padding: var(--space-lg); margin-bottom: var(--space-lg); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table thead th { text-align: left; padding: var(--space-sm) var(--space-md); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--secondary); border-bottom: 1px solid var(--outline-variant); white-space: nowrap; }
.admin-table tbody td { padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--outline-variant); color: var(--on-surface); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--surface-container-low); }
.admin-table .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; }
.admin-table .btn-sm { height: 32px; font-size: 13px; padding: 0 12px; }

.filter-group { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-md); }
.filter-btn { height: 36px; padding: 0 var(--space-md); font-size: 13px; font-weight: 500; border: 1px solid var(--outline-variant); border-radius: var(--radius-md); background: var(--surface-container-lowest); color: var(--on-surface-variant); cursor: pointer; transition: all 0.2s; }
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-md); margin-bottom: var(--space-lg); }
.stat-card { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--radius-lg); padding: var(--space-lg); text-align: center; }
.stat-card .num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-card .label { font-size: 12px; color: var(--secondary); margin-top: var(--space-xs); text-transform: uppercase; letter-spacing: 0.05em; }

.stats-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-lg); margin-bottom: var(--space-lg); }
@media (max-width: 768px) { .stats-row { grid-template-columns: 1fr; } }
.stats-col { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--radius-lg); padding: var(--space-lg); }
.stats-col h3 { font-size: 14px; font-weight: 600; margin-bottom: var(--space-md); }
.stats-col ul { list-style: none; }
.stats-col ul li { display: flex; justify-content: space-between; padding: var(--space-sm) 0; border-bottom: 1px solid var(--outline-variant); font-size: 13px; color: var(--on-surface-variant); }
.stats-col ul li:last-child { border-bottom: none; }
.stats-col ul li span { font-weight: 600; color: var(--on-surface); }

.consulta-list { max-height: 360px; overflow-y: auto; }
.consulta-item { padding: var(--space-sm) 0; border-bottom: 1px solid var(--outline-variant); }
.consulta-item:last-child { border-bottom: none; }
.consulta-usuario { font-weight: 600; font-size: 12px; color: var(--primary); }
.consulta-fecha { font-size: 11px; color: var(--secondary); float: right; }
.consulta-texto { font-size: 13px; color: var(--on-surface-variant); margin-top: 2px; line-height: 1.4; }

.assets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-md); }
.asset-card { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--radius-lg); overflow: hidden; }
.asset-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.asset-card .info { padding: var(--space-sm) var(--space-md); }
.asset-card .ref { font-size: 13px; font-weight: 600; color: var(--on-surface); margin-bottom: var(--space-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .meta { font-size: 11px; color: var(--secondary); }

.drop-zone { border: 2px dashed var(--outline-variant); border-radius: var(--radius-lg); padding: var(--space-xl) var(--space-lg); text-align: center; background: var(--surface-container-low); cursor: pointer; transition: border-color 0.2s, background 0.2s; margin-bottom: var(--space-md); }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: var(--surface-container-lowest); }
.drop-zone p { font-size: 14px; color: var(--on-surface-variant); margin: 0; }

.tag { display: inline-flex; align-items: center; padding: 2px 10px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.03em; border-radius: var(--radius-full); white-space: nowrap; text-transform: uppercase; }
.tag-staff { background: var(--surface-container-high); color: var(--on-surface-variant); }
.tag-supervisores { background: var(--primary-fixed); color: var(--primary); }
.tag-gerencia { background: var(--primary-container); color: var(--on-primary); }
.tag-admin { background: var(--inverse-surface); color: var(--inverse-on-surface); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: var(--space-md); }
.modal-overlay.hidden { display: none; }
.modal-content { background: var(--surface-container-lowest); border-radius: var(--radius-xl); padding: var(--space-xl); width: 100%; max-width: 480px; box-shadow: 0 24px 48px rgba(0,0,0,0.12); position: relative; max-height: 80vh; overflow-y: auto; }
.modal-content h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-bottom: var(--space-lg); }
.modal-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; margin-top: var(--space-lg); }

.hidden { display: none !important; }

.asset-url { font-size: 11px; color: var(--secondary); margin: 4px 0; word-break: break-all; }
.asset-url-text { color: var(--on-surface); user-select: all; }
.no-margin { margin: 0; }

.loading-dots { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.loading-dots span { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; animation: dotPulse 1.4s ease-in-out infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse { 0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

.status-msg { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); font-size: 13px; margin: var(--space-sm) 0; }
.status-msg.info { background: var(--surface-container-high); color: var(--on-surface-variant); }
.status-msg.error { background: var(--error-container); color: var(--on-error-container); }
.status-msg.success { background: #d9f0e1; color: #0d6b3a; }

/* ── Button overrides for JS-generated inline styles ── */
/* Botones creados desde app.js que tienen inline styles hardcodeados */
.admin-area .btn-sm[style*="D64E2A"] {
  background: var(--primary) !important;
  color: var(--on-primary) !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  height: 36px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 0 var(--space-md) !important;
}
.admin-area .btn-sm[style*="D64E2A"]:hover {
  background: var(--primary-container) !important;
}

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