/* =========================================================
   City Hosting Document Designer — hoja de estilos principal
   ========================================================= */

:root {
    /* Marca */
    --navy-900: #08132c;
    --navy-800: #0b1a3a;
    --navy-700: #102450;
    --blue-600: #1d4ed8;
    --blue-500: #2563eb;
    --blue-100: #e6effe;
    --blue-050: #f4f8ff;

    /* Estados */
    --green-600: #0f8a5f;
    --green-050: #e6f6ee;
    --purple-600: #7c3aed;
    --purple-050: #f3ecfe;
    --amber-600: #b45309;
    --amber-050: #fef4e4;
    --red-600: #dc2626;
    --red-050: #fdecec;

    /* Neutros */
    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --ink-400: #94a3b8;
    --line: #e6ebf4;
    --line-soft: #eef2f8;
    --surface: #ffffff;
    --canvas: #f5f7fc;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 2px 10px rgba(15, 23, 42, .06);
    --sidebar-w: 252px;
    --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--canvas);
    color: var(--ink-900);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------
   Estructura
   --------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--navy-800);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: transform .2s ease;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 22px;
}

.sidebar__logo {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(140deg, #3b82f6, #1e40af);
    display: grid; place-items: center;
    flex: 0 0 38px;
}

.sidebar__brand-text strong {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.15;
}
.sidebar__brand-text span {
    display: block;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #7d8fb3;
    margin-top: 2px;
}

.sidebar__nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }

.nav-label {
    padding: 18px 10px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #6b7d9e;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #c3cfe3;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--blue-600); color: #fff; font-weight: 600; }
.nav-item svg { flex: 0 0 18px; opacity: .9; }

.sidebar__footer { padding: 14px; }

.system-card {
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--radius);
    padding: 14px;
}
.system-card__row { display: flex; align-items: center; gap: 7px; color: #a7d8c0; font-size: 12px; font-weight: 600; }
.system-card__version { color: #fff; font-size: 20px; font-weight: 700; margin: 6px 0 0; }
.system-card__edition { color: #7d8fb3; font-size: 11.5px; }
.system-card__badge {
    display: block;
    margin-top: 12px;
    text-align: center;
    background: rgba(16, 185, 129, .16);
    border: 1px solid rgba(16, 185, 129, .3);
    color: #6ee7b7;
    border-radius: var(--radius-sm);
    padding: 7px;
    font-size: 12px;
    font-weight: 600;
}

.sidebar__legal {
    padding: 8px 20px 20px;
    color: #61759a;
    font-size: 11px;
    line-height: 1.6;
}

/* Contenido */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.icon-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 50%;
    color: var(--ink-500);
    cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink-900); }

.topbar__search {
    flex: 1;
    max-width: 420px;
    position: relative;
}
.topbar__search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
    font-size: 13.5px;
    color: var(--ink-900);
}
.topbar__search input:focus { outline: none; border-color: var(--blue-500); background: #fff; }
.topbar__search svg { position: absolute; left: 12px; top: 10px; color: var(--ink-400); }

.topbar__spacer { flex: 1; }

.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(140deg, #3b82f6, #1e3a8a);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 13px;
}
.user-chip__name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.user-chip__role { color: var(--ink-500); font-size: 11.5px; }

.content { padding: 26px 28px 40px; }

/* ---------------------------------------------------------
   Componentes
   --------------------------------------------------------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--ink-500); font-size: 14px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.card__head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card__body { padding: 18px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--blue-600); color: #fff; }
.btn--primary:hover { background: #1a44be; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink-700); }
.btn--ghost:hover { background: var(--line-soft); }
.btn--danger { background: var(--red-600); color: #fff; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge--green { background: var(--green-050); color: var(--green-600); }
.badge--blue { background: var(--blue-100); color: var(--blue-600); }
.badge--purple { background: var(--purple-050); color: var(--purple-600); }
.badge--amber { background: var(--amber-050); color: var(--amber-600); }
.badge--red { background: var(--red-050); color: var(--red-600); }
.badge--slate { background: #eef2f7; color: var(--ink-500); }

.alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 18px;
    border: 1px solid;
}
.alert--success { background: var(--green-050); border-color: #b9e5d0; color: #0b6b4a; }
.alert--error { background: var(--red-050); border-color: #f5c2c2; color: #a51b1b; }
.alert--info { background: var(--blue-050); border-color: #cfe0fd; color: #1b3fa8; }

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.kpi__icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid; place-items: center;
    flex: 0 0 46px;
}
.kpi__icon--blue { background: var(--blue-100); color: var(--blue-600); }
.kpi__icon--green { background: var(--green-050); color: var(--green-600); }
.kpi__icon--purple { background: var(--purple-050); color: var(--purple-600); }
.kpi__icon--amber { background: var(--amber-050); color: var(--amber-600); }
.kpi__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-500);
}
.kpi__value { font-size: 26px; font-weight: 700; line-height: 1.15; margin: 1px 0; }
.kpi__value--sm { font-size: 20px; }
.kpi__hint { font-size: 12px; color: var(--ink-500); }

/* Rejilla del dashboard */
.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 16px;
    align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Zona de carga */
.dropzone {
    border: 2px dashed #b8ccf5;
    background: var(--blue-050);
    border-radius: var(--radius-lg);
    padding: 34px 24px;
    text-align: center;
    transition: border-color .15s, background .15s;
    min-height: 356px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.dropzone.is-dragging { border-color: var(--blue-600); background: #e9f0ff; }
.dropzone.is-loaded { border-style: solid; border-color: #a9d8c1; background: #f3fbf7; }
.dropzone h2 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .01em;
    margin: 18px 0 4px;
    text-transform: uppercase;
}
.dropzone p { margin: 0; color: var(--ink-500); font-size: 13.5px; }
.dropzone__formats {
    display: inline-block;
    margin: 16px 0 18px;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    color: var(--ink-500);
}
.dropzone__file {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px;
    font-size: 13px;
}
.dropzone__progress {
    width: 100%; max-width: 320px; height: 6px;
    background: #dbe6fb; border-radius: 999px; overflow: hidden; margin-top: 14px;
}
.dropzone__bar { height: 100%; width: 0; background: var(--blue-600); transition: width .2s; }

/* Acciones principales */
.action {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    margin-bottom: 12px;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.action:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); }
.action:last-child { margin-bottom: 0; }
.action--blue { background: var(--blue-050); border-color: #d5e3fd; }
.action--green { background: #f2fbf6; border-color: #cfeadd; }
.action--purple { background: #faf7ff; border-color: #e6dbfb; }
.action__icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 40px; background: #fff; }
.action--blue .action__icon { color: var(--blue-600); }
.action--green .action__icon { color: var(--green-600); }
.action--purple .action__icon { color: var(--purple-600); }
.action__body { flex: 1; min-width: 0; }
.action__title { font-weight: 650; font-size: 14px; margin-bottom: 2px; }
.action--blue .action__title { color: var(--blue-600); }
.action--green .action__title { color: var(--green-600); }
.action--purple .action__title { color: var(--purple-600); }
.action__desc { color: var(--ink-500); font-size: 12.5px; line-height: 1.45; }
.action__chevron { color: var(--ink-400); flex: 0 0 auto; align-self: center; }

/* Guía rápida */
.guide { display: flex; gap: 12px; margin-bottom: 16px; }
.guide:last-child { margin-bottom: 0; }
.guide__num {
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11.5px; font-weight: 700; color: #fff; flex: 0 0 24px;
}
.guide__title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.guide__text { color: var(--ink-500); font-size: 12.5px; line-height: 1.45; }

/* Listas */
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #fbfcfe; }
.list-row__icon {
    width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center; flex: 0 0 34px;
    background: var(--red-050); color: var(--red-600);
    font-size: 9px; font-weight: 800; letter-spacing: .02em;
}
.list-row__icon--img { background: var(--blue-100); color: var(--blue-600); }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__meta { color: var(--ink-500); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__side { text-align: right; flex: 0 0 auto; }
.list-row__date { font-size: 12.5px; color: var(--ink-500); margin-bottom: 3px; }

.thumb {
    width: 46px; height: 34px; border-radius: 6px;
    background: linear-gradient(160deg, #eef3fb, #dfe8f7);
    border: 1px solid var(--line);
    flex: 0 0 46px;
}

.empty { padding: 34px 18px; text-align: center; color: var(--ink-500); }
.empty h3 { margin: 12px 0 4px; font-size: 14.5px; color: var(--ink-900); }
.empty p { margin: 0 auto; font-size: 13px; max-width: 320px; }

/* Consejos */
.tip { display: flex; gap: 9px; font-size: 12.8px; color: var(--ink-700); margin-bottom: 10px; }
.tip:last-child { margin-bottom: 0; }
.tip svg { flex: 0 0 16px; color: var(--green-600); margin-top: 2px; }

/* Tablas */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-500);
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfe; }

/* Formularios */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-700); }
.field input, .field select, .field textarea {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink-900);
    background: #fff;
}
.field textarea { height: auto; padding: 11px 13px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.field__hint { font-size: 12px; color: var(--ink-500); margin-top: 5px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

/* Login */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(1100px 520px at 50% -10%, #16305f, var(--navy-900));
    padding: 24px;
}
.auth__box { width: 100%; max-width: 404px; }
.auth__brand { text-align: center; margin-bottom: 22px; color: #fff; }
.auth__brand .sidebar__logo { margin: 0 auto 12px; width: 52px; height: 52px; border-radius: 15px; }
.auth__brand strong { font-size: 19px; letter-spacing: .05em; display: block; }
.auth__brand span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #93a4c4; }
.auth__card { background: #fff; border-radius: var(--radius-lg); padding: 28px; box-shadow: 0 20px 45px rgba(4, 12, 30, .35); }
.auth__card h1 { font-size: 19px; margin: 0 0 4px; }
.auth__card > p { margin: 0 0 22px; color: var(--ink-500); font-size: 13.5px; }
.auth__foot { text-align: center; margin-top: 18px; color: #7f92b5; font-size: 12px; }

/* Utilidades */
.link-muted { color: var(--ink-500); font-size: 13px; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.text-muted { color: var(--ink-500); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* Responsive */
@media (max-width: 1280px) {
    .dash-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
    .dash-col--aside { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
    .dash-col--aside > * { flex: 1 1 300px; }
}
@media (max-width: 980px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .dash-col--aside { flex-direction: column; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    body.sidebar-open .sidebar { transform: none; }
    .main { margin-left: 0; }
    .content { padding: 18px 16px 32px; }
    .topbar__search { display: none; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: minmax(0, 1fr); }
    .user-chip__name, .user-chip__role { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
