/* =========================================================
   AURUM private — Home page
   Clean consolidated stylesheet
   ========================================================= */

/* ---------- Home viewport ---------- */

.content:has(.home-portal) {
    box-sizing: border-box;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content:has(.home-portal) .site-topbar,
.content:has(.home-portal) .alert {
    flex: 0 0 auto;
}

.home-portal {
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- Hero ---------- */

.home-portal-hero {
    flex: 0 0 auto;
    width: min(620px, 100%);
    margin: 18px auto 28px;
    text-align: center;
}

.home-portal-logo {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    color: #f4f7fb;
    white-space: nowrap;
}

.home-portal-logo-main {
    font-family: Inter, Arial, sans-serif;
    font-size: 50px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
}

.home-portal-logo-private {
    color: #d7a8ff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 22px;
    font-style: italic;
    line-height: 1;
}

.home-portal-subtitle {
    margin: 0;
}

/* ---------- Main link cards ---------- */

.home-links-grid {
    flex: 0 0 auto;
    width: min(620px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.home-link-card {
    box-sizing: border-box;
    min-width: 0;
    min-height: 62px;
    padding: 10px 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ecf3ff;
    text-decoration: none;
    background: #101b2d;
    border: 1px solid #29425f;
    border-radius: 8px;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

.home-link-card:hover {
    background: #14243a;
    border-color: #3b638f;
    transform: translateY(-1px);
}

.home-link-icon {
    box-sizing: border-box;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #56a2ff;
    background: #112b4d;
    border: 1px solid #254c78;
    border-radius: 8px;
    font-family: Inter, Arial, sans-serif;
    font-size: 16px;
    font-weight: 800;
}

.home-link-icon svg {
    width: 18px;
    height: 18px;
}

.home-link-icon-vk {
    color: #fff;
    background: #2586e7;
    border-color: #3e9af0;
}

.home-link-content {
    min-width: 0;
    flex: 1 1 auto;
    display: grid;
    gap: 3px;
}

.home-link-content strong {
    overflow: hidden;
    color: #f2f6fc;
    font-family: Inter, Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-link-content > span {
    overflow: hidden;
    color: #84a0c6;
    font-family: Inter, Arial, sans-serif;
    font-size: 9px;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.home-link-arrow {
    flex: 0 0 auto;
    color: #5ba8ff;
    font-size: 13px;
    font-weight: 700;
}

/* ---------- Bottom widgets ---------- */

.home-updates-grid {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    margin: auto 0 0;
    padding: 18px 0 8px;
    display: grid;
    grid-template-columns: 360px 200px;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
}

.home-info-card,
.home-info-card * {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

.home-info-card {
    min-width: 0;
    padding: 10px 12px;
    color: #ecf3ff;
    background: #101b2d;
    border: 1px solid #29425f;
    border-radius: 9px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
}

.home-updates-card {
    width: 360px;
    height: 205px;
    min-height: 205px;
    max-height: 205px;
    justify-self: start;
    overflow: hidden;
}

.home-version-card {
    width: 200px;
    justify-self: end;
    align-self: end;
}

.home-info-card-header {
    min-width: 0;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.home-info-card-header h2 {
    margin: 2px 0 0;
    color: #f2f6fc;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.home-info-eyebrow {
    display: block;
    color: #7f99bc;
    font-size: 7px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.home-info-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
}

.home-info-icon {
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    background: #15345a;
    border: 1px solid #315d8f;
    border-radius: 7px;
    font-size: 12px;
}

/* ---------- Journal ---------- */

.home-update-list {
    height: 142px;
    min-height: 142px;
    max-height: 142px;
    display: grid;
    align-content: start;
    gap: 7px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: #52627b transparent;
}

.home-update-list::-webkit-scrollbar {
    width: 5px;
}

.home-update-list::-webkit-scrollbar-track {
    background: transparent;
}

.home-update-list::-webkit-scrollbar-thumb {
    background: #52627b;
    border-radius: 999px;
}

.home-update-list::-webkit-scrollbar-thumb:hover {
    background: #71839c;
}

.home-update-item {
    min-height: 134px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    color: #eaf1fb;
    background: #101b2d;
    border: 1px solid #29425f;
    border-radius: 8px;
}

.home-update-item.is-pinned {
    border-color: #3b82f6;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.home-update-meta,
.home-update-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.home-update-meta time,
.home-update-footer,
.home-update-footer span {
    color: #89a0bf;
    font-size: 8px;
    font-weight: 400;
    line-height: 1.2;
}

.home-update-category {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 3px 6px;
    color: #60a5fa;
    background: rgb(59 130 246 / 15%);
    border-radius: 999px;
    font-size: 7px;
    font-weight: 700;
    line-height: 1;
}

.home-update-category.category-new {
    color: #4ade80;
    background: rgb(34 197 94 / 15%);
}

.home-update-category.category-fix {
    color: #fbbf24;
    background: rgb(245 158 11 / 15%);
}

.home-update-category.category-important {
    color: #fb7185;
    background: rgb(239 68 68 / 15%);
}

.home-update-category.category-security {
    color: #c084fc;
    background: rgb(168 85 247 / 15%);
}

.home-update-item h3 {
    margin: 7px 0 3px;
    color: #f2f6fc;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
}

.home-update-item p {
    margin: 0;
    color: #8da3c0;
    font-size: 8.5px;
    font-weight: 400;
    line-height: 1.35;
    white-space: pre-line;
}

.home-update-footer {
    margin-top: auto;
    padding-top: 7px;
}

.home-update-delete-form {
    margin: 6px 0 0;
    display: flex;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.home-update-delete {
    min-height: 23px !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    color: #fb7185 !important;
    background: transparent !important;
    border: 1px solid rgb(239 68 68 / 55%) !important;
    border-radius: 5px !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.home-update-delete:hover {
    color: #fff !important;
    background: #b91c1c !important;
    border-color: #ef4444 !important;
}

.home-info-empty {
    min-height: 142px;
    padding: 12px;
    display: grid;
    place-items: center;
    color: #8498b4;
    border: 1px dashed #344a67;
    border-radius: 8px;
    font-size: 10px;
    text-align: center;
}

/* ---------- Version ---------- */

.home-version-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #4ade80;
    font-size: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.home-version-status::before {
    content: "";
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 7px rgb(34 197 94 / 65%);
}

.home-version-value {
    margin: 9px 0 11px;
    color: #f2f6fc;
    font-size: 19px;
    font-weight: 700;
    line-height: 1;
    overflow-wrap: anywhere;
}

.home-version-details {
    display: grid;
    gap: 6px;
}

.home-version-details > div {
    padding-top: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid #29425f;
}

.home-version-details span {
    color: #8298b6;
    font-size: 7px;
    font-weight: 400;
}

.home-version-details strong {
    color: #f2f6fc;
    font-size: 8px;
    font-weight: 700;
}

/* ---------- Buttons ---------- */

.home-small-action,
.home-version-edit {
    min-height: 26px !important;
    padding: 4px 8px !important;
    color: #dbeafe !important;
    background: #17365f !important;
    border: 1px solid #315b8a !important;
    border-radius: 7px !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.home-small-action:hover,
.home-version-edit:hover {
    color: #fff !important;
    background: #204a7e !important;
    border-color: #4d82b8 !important;
}

.home-version-edit {
    width: 100%;
    margin: 0 0 11px;
}

/* ---------- Dialogs ---------- */

.home-manage-dialog,
.home-manage-dialog * {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

.home-manage-dialog {
    width: min(510px, calc(100vw - 30px));
    padding: 0;
    color: #e6edf7;
    background: #101b2d;
    border: 1px solid #344a67;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgb(0 0 0 / 55%);
}

.home-manage-dialog::backdrop {
    background: rgb(2 6 14 / 72%);
    backdrop-filter: blur(4px);
}

.home-manage-dialog form {
    padding: 21px;
}

.home-version-dialog {
    width: min(390px, calc(100vw - 30px));
}

.home-dialog-header {
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.home-dialog-header span {
    color: #7f96b5;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.home-dialog-header h2 {
    margin: 4px 0 0;
    font-size: 20px;
}

.home-dialog-close {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    font-size: 20px !important;
}

.home-dialog-field {
    display: block;
    margin-bottom: 14px;
}

.home-dialog-field > span {
    display: block;
    margin-bottom: 6px;
    color: #a7b6ca;
    font-size: 11px;
    font-weight: 650;
}

.home-dialog-field input,
.home-dialog-field select,
.home-dialog-field textarea {
    width: 100%;
    margin: 0;
    color: #eef4ff;
    background: #17253a;
    border: 1px solid #344a67;
}

.home-dialog-field textarea {
    min-height: 105px;
    resize: vertical;
}

.home-dialog-checkbox {
    margin: 5px 0 18px;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 11px;
}

.home-dialog-checkbox input {
    width: 17px;
    height: 17px;
    margin: 0;
}

.home-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

.home-dialog-actions button {
    min-width: 105px;
}

/* ---------- Light theme ---------- */

html[data-theme="light"] .home-portal-logo-main {
    color: #172033;
}

html[data-theme="light"] .home-link-card,
html[data-theme="light"] .home-info-card {
    color: #172033;
    background: #fff;
    border-color: #d8e1ec;
    box-shadow: 0 10px 26px rgb(15 23 42 / 10%);
}

html[data-theme="light"] .home-link-card:hover {
    background: #f5f8fc;
    border-color: #b9c9dc;
}

html[data-theme="light"] .home-link-content strong,
html[data-theme="light"] .home-info-card-header h2,
html[data-theme="light"] .home-update-item h3,
html[data-theme="light"] .home-version-value,
html[data-theme="light"] .home-version-details strong {
    color: #172033;
}

html[data-theme="light"] .home-link-content > span,
html[data-theme="light"] .home-info-eyebrow,
html[data-theme="light"] .home-update-item p,
html[data-theme="light"] .home-update-meta time,
html[data-theme="light"] .home-update-footer,
html[data-theme="light"] .home-update-footer span,
html[data-theme="light"] .home-version-details span {
    color: #64748b;
}

html[data-theme="light"] .home-update-item,
html[data-theme="light"] .home-info-empty {
    background: #f8fafc;
    border-color: #d8e1ec;
}

html[data-theme="light"] .home-version-details > div {
    border-color: #d8e1ec;
}

html[data-theme="light"] .home-small-action,
html[data-theme="light"] .home-version-edit {
    color: #fff !important;
    background: #2563eb !important;
    border-color: #3b82f6 !important;
}

html[data-theme="light"] .home-info-icon {
    color: #2563eb;
    background: #eaf2ff;
    border-color: #bfd4f4;
}

html[data-theme="light"] .home-update-delete {
    color: #dc2626 !important;
    background: #fff !important;
    border-color: #ef4444 !important;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .content:has(.home-portal) {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    .home-portal {
        overflow: visible;
    }

    .home-portal-logo-main {
        font-size: 42px;
    }

    .home-portal-logo-private {
        font-size: 20px;
    }

    .home-links-grid,
    .home-updates-grid {
        grid-template-columns: 1fr;
    }

    .home-updates-grid {
        margin-top: 28px;
    }

    .home-updates-card,
    .home-version-card {
        width: 100%;
        justify-self: stretch;
    }
}

@media (max-width: 600px) {
    .home-portal-hero {
        margin-top: 12px;
        margin-bottom: 20px;
    }

    .home-links-grid {
        grid-template-columns: 1fr;
    }

    .home-portal-logo-main {
        font-size: 36px;
    }

    .home-portal-logo-private {
        font-size: 18px;
    }
}

@media (max-height: 650px) and (min-width: 901px) {
    .content:has(.home-portal) {
        height: auto;
        min-height: 100dvh;
        overflow-y: auto;
    }

    .home-portal {
        overflow: visible;
    }

    .home-updates-grid {
        margin-top: 28px;
    }
}

/* =========================================================
   Final layout and light-theme corrections
   ========================================================= */

.home-portal {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

.home-portal-hero,
.home-links-grid {
    width: min(620px, 100%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.home-updates-grid {
    width: 100% !important;
    max-width: none !important;
    margin: auto 0 0 !important;
    padding: 18px 12px 10px !important;
    grid-template-columns: 320px 180px !important;
    justify-content: space-between !important;
    align-items: end !important;
    gap: 24px !important;
}

.home-updates-card {
    width: 320px !important;
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
    justify-self: start !important;
}

.home-version-card {
    width: 180px !important;
    min-height: 166px !important;
    justify-self: end !important;
    align-self: end !important;
}

.home-update-list {
    height: 118px !important;
    min-height: 118px !important;
    max-height: 118px !important;
}

.home-update-item {
    min-height: 110px !important;
    padding: 8px !important;
}

.home-update-delete-form {
    margin-top: 5px !important;
}

.home-version-value {
    margin: 8px 0 10px !important;
    font-size: 18px !important;
}

.home-version-edit {
    min-height: 25px !important;
    margin-bottom: 9px !important;
    padding: 4px 7px !important;
}

.home-version-details {
    gap: 5px !important;
}

.home-version-details > div {
    padding-top: 6px !important;
}

html[data-theme="light"] .home-info-card {
    color: #172033 !important;
    background: #ffffff !important;
    border-color: #cfd9e6 !important;
    box-shadow: 0 10px 24px rgb(15 23 42 / 10%) !important;
}

html[data-theme="light"] .home-update-item {
    color: #172033 !important;
    background: #f8fafc !important;
    border-color: #d7e0eb !important;
}

html[data-theme="light"] .home-info-card-header h2,
html[data-theme="light"] .home-update-item h3,
html[data-theme="light"] .home-version-value,
html[data-theme="light"] .home-version-details strong {
    color: #172033 !important;
}

html[data-theme="light"] .home-info-eyebrow,
html[data-theme="light"] .home-update-item p,
html[data-theme="light"] .home-update-meta time,
html[data-theme="light"] .home-update-footer,
html[data-theme="light"] .home-update-footer span,
html[data-theme="light"] .home-version-details span {
    color: #64748b !important;
}

html[data-theme="light"] .home-version-details > div {
    border-color: #d7e0eb !important;
}

html[data-theme="light"] .home-small-action,
html[data-theme="light"] .home-version-edit {
    color: #ffffff !important;
    background: #2563eb !important;
    border-color: #3b82f6 !important;
}

html[data-theme="light"] .home-small-action:hover,
html[data-theme="light"] .home-version-edit:hover {
    background: #1d4ed8 !important;
    border-color: #2563eb !important;
}

html[data-theme="light"] .home-info-icon {
    color: #2563eb !important;
    background: #eaf2ff !important;
    border-color: #bfd4f4 !important;
}

html[data-theme="light"] .home-update-delete {
    color: #dc2626 !important;
    background: #ffffff !important;
    border-color: #ef4444 !important;
}

html[data-theme="light"] .home-update-list {
    scrollbar-color: #94a3b8 transparent;
}

html[data-theme="light"] .home-update-list::-webkit-scrollbar-thumb {
    background: #94a3b8;
}

@media (max-width: 900px) {
    .home-updates-grid {
        grid-template-columns: 1fr !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .home-updates-card,
    .home-version-card {
        width: 100% !important;
        min-height: 0 !important;
        justify-self: stretch !important;
    }

    .home-updates-card {
        height: auto !important;
        max-height: none !important;
    }
}

/* ===== Fix update delete button position ===== */

.home-update-item {
    position: relative !important;
    min-height: 110px !important;
    padding: 8px 8px 34px !important;
}

.home-update-footer {
    margin-top: auto !important;
    padding-right: 0 !important;
}

.home-update-delete-form {
    position: absolute !important;
    right: 8px !important;
    bottom: 8px !important;

    margin: 0 !important;
    padding: 0 !important;
}

.home-update-delete {
    min-height: 22px !important;
    margin: 0 !important;
    padding: 3px 8px !important;
}

/* ===== End delete button fix ===== */