/* ============================================
   NEXIUM Portal — Hoja de estilos unificada
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Montserrat:wght@300;400;500;600&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --bg-deep:        #0a0a0a;
  --bg-carbon:      #111111;
  --bg-card:        #161412;
  --bg-elevated:    #1c1a17;
  --bg-input:       #1a1815;
  --line-soft:      rgba(201, 169, 97, 0.18);
  --line-strong:    rgba(201, 169, 97, 0.45);
  --line-muted:     rgba(255, 255, 255, 0.06);
  --gold:           #c9a961;
  --gold-bright:    #e6c98a;
  --gold-deep:      #8a7339;
  --text-primary:   #f5f1e8;
  --text-secondary: #a8a39a;
  --text-muted:     #6e6a62;
  --danger:         #c14b4b;
  --warning:        #d99a3e;
  --success:        #6ea84a;
  --serif:          'Cormorant Garamond', 'Times New Roman', serif;
  --sans:           'Inter', -apple-system, sans-serif;
  --display:        'Montserrat', sans-serif;
  --sidebar-w:      260px;
  --topbar-h:       72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--gold); color: var(--bg-deep); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ====== App shell ====== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}
.sidebar {
  grid-row: 1 / -1;
  background: #050505;
  border-right: 1px solid var(--line-muted);
  padding: 1.6rem 0;
  display: flex; flex-direction: column;
}
.sidebar__brand {
  padding: 0 1.6rem 1.5rem;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line-muted);
  margin-bottom: 1.6rem;
}
.sidebar__mark { width: 28px; height: 28px; }
.sidebar__name {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.36em;
  color: var(--text-primary);
  font-weight: 500;
}
.sidebar__tagline {
  padding: 0 1.6rem 1.5rem;
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar__nav { display: flex; flex-direction: column; flex: 1; padding: 0 0.8rem; }
.sidebar__group-label {
  padding: 1.2rem 0.8rem 0.4rem;
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar__nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 0.8rem 0.8rem;
  margin: 0.1rem 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: all .2s ease;
  font-weight: 400;
}
.sidebar__nav a:hover { color: var(--text-primary); background: rgba(201,169,97,0.04); }
.sidebar__nav a.active {
  color: var(--gold);
  background: rgba(201,169,97,0.06);
  border-left-color: var(--gold);
}
.sidebar__nav-icon { width: 18px; height: 18px; display: inline-block; flex-shrink: 0; }
.sidebar__nav-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.4; }

.sidebar__user {
  margin-top: auto;
  padding: 1.2rem 1.6rem;
  border-top: 1px solid var(--line-muted);
  display: flex; align-items: center; gap: 12px;
}
.sidebar__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.sidebar__user-name { font-size: 0.82rem; color: var(--text-primary); }
.sidebar__user-role { font-size: 0.7rem; color: var(--text-muted); font-family: var(--display); letter-spacing: 0.18em; text-transform: uppercase; }

/* ====== Topbar ====== */
.topbar {
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-muted);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar__title {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--text-primary);
  font-weight: 400;
}
.topbar__title em { color: var(--gold); font-style: italic; }
.topbar__actions { display: flex; align-items: center; gap: 1rem; }
.topbar__search {
  background: var(--bg-input);
  border: 1px solid var(--line-muted);
  padding: 8px 14px 8px 36px;
  color: var(--text-primary);
  font-size: 0.85rem;
  width: 280px;
  outline: none;
  transition: border-color .2s;
  position: relative;
}
.topbar__search-wrap { position: relative; }
.topbar__search-wrap::before {
  content: '';
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a39a' stroke-width='1.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-size: contain;
}
.topbar__search:focus { border-color: var(--gold); }
.topbar__bell {
  width: 38px; height: 38px;
  border: 1px solid var(--line-muted);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
  cursor: pointer;
}
.topbar__bell:hover { color: var(--gold); border-color: var(--line-soft); }
.topbar__bell svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.topbar__bell-dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px;
  background: var(--gold);
  border-radius: 50%;
}

/* ====== Main content ====== */
.main {
  padding: 2.5rem;
  overflow-y: auto;
}

/* ====== Eyebrow ====== */
.eyebrow {
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow::after {
  content: '';
  display: block;
  width: 24px; height: 1px;
  background: var(--gold);
  margin-top: 12px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: 0.005em; }
h1 { font-size: 2.4rem; line-height: 1.15; }
h2 { font-size: 1.6rem; line-height: 1.25; }
h3 { font-size: 1.2rem; }

p { color: var(--text-secondary); }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }

/* ====== Cards ====== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line-muted);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
}
.card__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line-muted);
}
.card__title {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: 500;
}
.card__title-gold { color: var(--gold); }

/* ====== Metric cards ====== */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.metric {
  background: var(--bg-card);
  border: 1px solid var(--line-muted);
  padding: 1.6rem;
}
.metric__label {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}
.metric__value {
  font-family: var(--serif);
  font-size: 2.4rem;
  color: var(--text-primary);
  line-height: 1.1;
}
.metric__value em { color: var(--gold); font-style: normal; }
.metric__sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.5rem; }
.metric__trend { font-size: 0.78rem; color: var(--success); margin-top: 0.5rem; }
.metric__trend--down { color: var(--danger); }

/* ====== Buttons ====== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 24px;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  transition: all .25s ease;
}
.btn:hover { background: var(--gold); color: var(--bg-deep); }
.btn--solid { background: var(--gold); color: var(--bg-deep); }
.btn--solid:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn--ghost { border-color: var(--line-soft); color: var(--text-primary); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: var(--text-primary); border-color: var(--danger); }
.btn--sm { padding: 7px 14px; font-size: 0.66rem; }

/* ====== Tables ====== */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table thead th {
  text-align: left;
  padding: 0.9rem 1rem;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line-soft);
}
.table tbody td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--line-muted);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.table tbody tr:hover td { background: rgba(201,169,97,0.03); color: var(--text-primary); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { color: var(--text-muted); font-family: var(--display); font-size: 0.78rem; }
.table .name { color: var(--text-primary); font-weight: 400; }
.table .rfc { font-family: var(--display); font-size: 0.78rem; letter-spacing: 0.06em; }

/* ====== Badges ====== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  font-weight: 500;
}
.badge--ok { color: var(--success); }
.badge--warn { color: var(--warning); }
.badge--danger { color: var(--danger); }
.badge--gold { color: var(--gold); }
.badge--muted { color: var(--text-muted); }

/* ====== Status dots ====== */
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 8px;
}
.dot--ok { background: var(--success); }
.dot--warn { background: var(--warning); }
.dot--danger { background: var(--danger); }
.dot--muted { background: var(--text-muted); }

/* ====== Forms ====== */
.field { margin-bottom: 1.4rem; }
.field label {
  display: block;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  font-weight: 500;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line-muted);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field textarea { min-height: 100px; resize: vertical; }

/* ====== Tabs ====== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-muted);
  margin-bottom: 2rem;
}
.tabs a {
  padding: 1rem 1.6rem;
  font-family: var(--display);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all .2s;
  font-weight: 500;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text-primary); }
.tabs a.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ====== Detail rows ====== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem 2.4rem;
}
.detail-grid .full { grid-column: 1 / -1; }
.detail__label {
  font-family: var(--display);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.detail__value {
  color: var(--text-primary);
  font-size: 0.95rem;
}
.detail__value em { color: var(--gold); font-style: normal; }

/* ====== Alerts ====== */
.alert {
  padding: 1rem 1.4rem;
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--gold);
  background: rgba(201,169,97,0.05);
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 12px;
}
.alert--danger { border-left-color: var(--danger); background: rgba(193,75,75,0.05); }
.alert--warn { border-left-color: var(--warning); background: rgba(217,154,62,0.05); }
.alert__icon { color: inherit; flex-shrink: 0; }
.alert__icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* ====== Login (sin sidebar) ====== */
.login-shell {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(201,169,97,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 70%, rgba(201,169,97,0.04) 0%, transparent 60%),
    var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  padding: 3.5rem 3rem;
  width: 100%;
  max-width: 460px;
}
.login__brand {
  text-align: center;
  margin-bottom: 2.5rem;
}
.login__brand-mark { width: 48px; height: 48px; margin: 0 auto 16px; }
.login__brand-name {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.42em;
  color: var(--text-primary);
}
.login__title {
  text-align: center;
  font-size: 1.7rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-primary);
}
.login__title em { color: var(--gold); font-style: italic; }
.login__sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}
.login__btn { width: 100%; justify-content: center; margin-top: 0.5rem; }
.login__foot {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.login__foot a { color: var(--gold); }

/* ====== Document list ====== */
.doc-list { display: flex; flex-direction: column; }
.doc-item {
  display: grid;
  grid-template-columns: 32px 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-muted);
}
.doc-item:last-child { border-bottom: none; }
.doc-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}
.doc-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.4; }
.doc-name { color: var(--text-primary); font-size: 0.92rem; }
.doc-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.doc-size { font-family: var(--display); font-size: 0.74rem; color: var(--text-muted); letter-spacing: 0.04em; }
.doc-date { font-size: 0.82rem; color: var(--text-secondary); }

/* ====== Messages ====== */
.message-thread { display: flex; flex-direction: column; gap: 1rem; max-height: 500px; overflow-y: auto; padding-right: 0.5rem; }
.msg {
  max-width: 70%;
  padding: 0.9rem 1.2rem;
  font-size: 0.92rem;
  line-height: 1.55;
  position: relative;
}
.msg--in {
  background: var(--bg-elevated);
  color: var(--text-primary);
  align-self: flex-start;
  border-left: 2px solid var(--line-soft);
}
.msg--out {
  background: rgba(201,169,97,0.08);
  color: var(--text-primary);
  align-self: flex-end;
  border-right: 2px solid var(--gold);
}
.msg__author {
  font-family: var(--display);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.msg__time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; font-family: var(--display); letter-spacing: 0.04em; }

/* ====== Bitácora ====== */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line-soft);
}
.timeline__item { position: relative; padding-bottom: 1.5rem; }
.timeline__item::before {
  content: '';
  position: absolute;
  left: -1.7rem; top: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
}
.timeline__time { font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.18em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.3rem; }
.timeline__action { font-size: 0.92rem; color: var(--text-primary); }
.timeline__action em { color: var(--gold); font-style: normal; }
.timeline__author { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.2rem; }
