:root {
  --mm-primary: #0a84ff;
  --mm-primary-2: #4aa8ff;
  --mm-dark: #0f172a;
  --mm-text: #101828;
  --mm-muted: #667085;
  --mm-bg: #f4f7fb;
  --mm-card: rgba(255,255,255,.92);
  --mm-border: rgba(15,23,42,.08);
  --mm-success: #12b76a;
  --mm-warning: #f79009;
  --mm-danger: #f04438;
  --mm-shadow: 0 10px 35px rgba(15,23,42,.08);
  --mm-shadow-soft: 0 4px 18px rgba(15,23,42,.05);
  --mm-radius: 24px;
}

html, body { min-height: 100%; }
body {
  font-family: 'Outfit', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(10,132,255,.10), transparent 28%),
    radial-gradient(circle at top right, rgba(18,183,106,.08), transparent 24%),
    linear-gradient(180deg, #f9fbff 0%, var(--mm-bg) 100%);
  color: var(--mm-text);
}

a { transition: .2s ease; }

.page-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 12px;
}

.app-container {
  width: 100%;
  flex: 1 0 auto;
}

.navbar.mm-navbar {
  background: rgba(255,255,255,.78) !important;
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 6px 30px rgba(15,23,42,.06);
  backdrop-filter: blur(18px);
  border-radius: 0 0 24px 24px;
  margin: 0 auto 1.5rem;
}

.navbar-brand { letter-spacing: -.4px; }
.navbar-toggler { border: none; box-shadow: none !important; }
.navbar-toggler:focus { box-shadow: none !important; }
.mm-nav-link {
  padding: .7rem 1rem !important;
  border-radius: 14px;
  font-size: .93rem;
  font-weight: 600;
  color: #42526b !important;
}
.mm-nav-link:hover,
.mm-nav-link.active {
  background: rgba(10,132,255,.09);
  color: var(--mm-primary) !important;
}

.mm-user-chip {
  display: inline-flex;
  align-items: center;
  gap: .85rem;
  padding: .65rem .8rem;
  background: rgba(255,255,255,.84);
  border: 1px solid var(--mm-border);
  border-radius: 18px;
  box-shadow: var(--mm-shadow-soft);
}
.mm-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--mm-dark), #1f365c);
  color: #fff;
  font-weight: 700;
}
.mm-role-badge {
  background: rgba(15,23,42,.95);
  color: #fff;
  font-size: .64rem;
  letter-spacing: .7px;
  border-radius: 999px;
  padding: .32rem .55rem;
}
.mm-logout {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(240,68,56,.08);
  color: var(--mm-danger);
}
.mm-logout:hover {
  transform: translateY(-1px);
  background: rgba(240,68,56,.14);
  color: var(--mm-danger);
}

.page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem 0 0;
  margin-bottom: 1.5rem;
}
.page-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--mm-primary);
  margin-bottom: .55rem;
}
.page-hero__title {
  font-size: clamp(1.8rem, 2vw + 1rem, 2.6rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0;
}
.page-hero__subtitle {
  color: var(--mm-muted);
  margin: .55rem 0 0;
  font-size: .96rem;
  max-width: 760px;
}
.page-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.glass-card,
.card {
  border: 1px solid var(--mm-border) !important;
  border-radius: var(--mm-radius) !important;
  background: var(--mm-card);
  box-shadow: var(--mm-shadow-soft);
}
.card:hover,
.glass-card:hover { box-shadow: var(--mm-shadow); }

.metric-card {
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -40px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(10,132,255,.15), rgba(10,132,255,0));
}
.metric-card__icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: linear-gradient(135deg, rgba(10,132,255,.12), rgba(10,132,255,.05));
  color: var(--mm-primary);
}
.metric-card__value {
  font-size: clamp(1.6rem, 1.4rem + .6vw, 2.2rem);
  font-weight: 700;
  line-height: 1;
}
.metric-card__label {
  color: var(--mm-muted);
  font-size: .92rem;
  margin-top: .35rem;
}

.soft-panel {
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,252,.92));
  border: 1px solid var(--mm-border);
  border-radius: 22px;
}

.mm-btn-primary {
  background: linear-gradient(135deg, var(--mm-primary), var(--mm-primary-2));
  border: none;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(10,132,255,.22);
}
.mm-btn-primary:hover { transform: translateY(-1px); }
.mm-btn-dark {
  border-radius: 999px;
  background: var(--mm-dark);
  color: #fff;
}
.mm-btn-light {
  border-radius: 999px;
  border: 1px solid var(--mm-border);
  background: rgba(255,255,255,.86);
}

.mm-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--mm-border);
  box-shadow: var(--mm-shadow-soft);
  border-radius: 999px;
  padding: .35rem .5rem .35rem 1rem;
}
.mm-search .form-control,
.mm-search .form-select,
.mm-filter-card .form-control,
.mm-filter-card .form-select,
.mm-form-card .form-control,
.mm-form-card .form-select,
.mm-form-card textarea,
.login-shell .form-control {
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 16px;
  min-height: 48px;
  background: #fff;
  box-shadow: none !important;
}
.mm-search .form-control { border: none; background: transparent; min-height: 42px; }
.mm-search .form-control:focus { background: transparent; }
.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: rgba(10,132,255,.35) !important;
  box-shadow: 0 0 0 .24rem rgba(10,132,255,.12) !important;
}
textarea.form-control { min-height: 110px; }

.mm-filter-card,
.mm-form-card,
.mm-table-card,
.mm-content-card {
  border-radius: 24px;
  overflow: hidden;
}
.mm-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.mm-card-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: -.02em;
}
.mm-card-subtitle {
  color: var(--mm-muted);
  font-size: .92rem;
  margin-top: .25rem;
}

.table > :not(caption) > * > * { border-bottom-color: rgba(15,23,42,.06); }
.table thead th {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #667085;
  border-bottom-width: 1px;
  background: rgba(248,250,252,.92);
  white-space: nowrap;
}
.table tbody td { vertical-align: middle; }
.table tbody tr:hover { background: rgba(10,132,255,.03); }

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: rgba(10,132,255,.08);
  color: var(--mm-primary);
  border-radius: 999px;
  padding: .45rem .8rem;
  font-size: .82rem;
  font-weight: 600;
}

.kv-list {
  display: grid;
  gap: .85rem;
}
.kv-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.kv-item:last-child { border-bottom: none; padding-bottom: 0; }
.kv-item span { color: var(--mm-muted); font-size: .9rem; }
.kv-item strong { text-align: right; }

.timeline-grid > div a > div,
.file-card,
.quick-link {
  transition: .18s ease;
}
.timeline-grid > div a > div:hover,
.file-card:hover,
.quick-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--mm-shadow-soft);
}
.quick-link {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(15,23,42,.06) !important;
}
.quick-link:last-child { border-bottom: none !important; }

.analysis-content {
  font-size: 1rem !important;
  line-height: 1.8 !important;
}
.analysis-content h3,
.analysis-content h4,
.analysis-content h5 {
  margin-top: 1.6rem;
  margin-bottom: .8rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.analysis-content p,
.analysis-content li { color: #1d2939; }
.analysis-content ul,
.analysis-content ol { padding-left: 1.25rem; }
.analysis-content hr { opacity: .08; }

.chat-shell { border-radius: 26px; overflow: hidden; }
#chat-box {
  scroll-behavior: smooth;
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(246,249,252,.92)),
    radial-gradient(circle at top right, rgba(10,132,255,.05), transparent 30%);
}
.msg-ia,
.msg-user {
  max-width: min(88%, 720px);
  padding: 14px 18px;
  margin-bottom: 15px;
  font-size: .94rem;
  line-height: 1.6;
  white-space: pre-wrap;
  border: 1px solid rgba(15,23,42,.05);
}
.msg-ia {
  align-self: flex-start;
  background: #fff;
  color: #172033;
  border-radius: 22px 22px 22px 8px;
}
.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--mm-primary), var(--mm-primary-2));
  color: #fff;
  border-radius: 22px 22px 8px 22px;
}
.chat-composer {
  border-top: 1px solid rgba(15,23,42,.06);
  background: rgba(255,255,255,.92);
}
.chat-input {
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 999px;
  background: #f8fafc;
  padding: .45rem;
}
.chat-input .form-control { min-height: 44px; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 32px;
  backdrop-filter: blur(20px);
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(15,23,42,.10);
}
.login-panel-hero {
  padding: 3rem;
  background: linear-gradient(145deg, #0f172a 0%, #112240 46%, #0a84ff 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.login-panel-hero::before,
.login-panel-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.login-panel-hero::before { width: 220px; height: 220px; top: -50px; right: -70px; }
.login-panel-hero::after { width: 160px; height: 160px; bottom: -60px; left: -40px; }
.login-panel-form { padding: 3rem; background: rgba(255,255,255,.96); }
.login-kpis { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 2rem; }
.login-kpi {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 1rem;
}
.login-kpi strong { display: block; font-size: 1.2rem; margin-bottom: .2rem; }

.mm-footer {
  margin-top: 3rem;
  padding: 1rem 0 2rem;
  color: var(--mm-muted);
}
.mm-footer .footer-card {
  border: 1px solid var(--mm-border);
  border-radius: 22px;
  padding: 1.2rem 1.5rem;
  background: rgba(255,255,255,.78);
}

@media (max-width: 991.98px) {
  .navbar.mm-navbar { border-radius: 0 0 18px 18px; }
  .page-hero { align-items: flex-start; flex-direction: column; }
  .login-shell { grid-template-columns: 1fr; }
  .login-panel-hero { display: none; }
}

@media (max-width: 767.98px) {
  .page-shell { padding: 0 10px; }
  .app-container { padding: 0; }
  .page-hero__title { font-size: 1.7rem; }
  .metric-card__icon { width: 52px; height: 52px; }
  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive th,
  .table-responsive td,
  .table-responsive tr { display: block; width: 100%; }
  .table-responsive thead { display: none; }
  .table-responsive tbody tr {
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(15,23,42,.06);
    border-radius: 18px;
    padding: .5rem;
    margin: 0 0 .75rem;
    box-shadow: var(--mm-shadow-soft);
  }
  .table-responsive tbody td {
    border: none !important;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: .55rem .8rem !important;
    text-align: right !important;
  }
  .table-responsive tbody td::before {
    content: attr(data-label);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--mm-muted);
    font-weight: 700;
    text-align: left;
  }
  .table-responsive tbody td > * { text-align: right; }
  .msg-ia,
  .msg-user { max-width: 94%; font-size: .9rem; }
  .login-panel-form { padding: 2rem 1.25rem; }
}
