/* VoltHosting Intellectual Property
This software is the property of VoltHosting Ltd. Redistribution is prohibited. Protected under NDA and copyright law. */

:root {
    --ink: #1a1a1a;
    --surface: #ffffff;
    --muted: #e7e3da;
    --accent: #e74b3c;
    --accent-dark: #b53a2f;
    --highlight: #f7f3ea;
    --shadow: 0 20px 45px rgba(24, 24, 24, 0.08);
    --status-free: #7bc69a;
    --status-reserved: #f2b766;
    --status-allocated: #e76d60;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top left, #fef2e7, #faf7f1 50%, #f0ece3 100%);
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2.5rem;
    gap: 2rem;
    position: sticky;
    top: 0;
    background: rgba(250, 247, 241, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e8e2d6;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo-long {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.brand-logo-square {
    height: 40px;
    width: 40px;
    object-fit: contain;
    display: none;
}

.brand-subtitle {
    font-family: 'Newsreader', serif;
    font-size: 0.9rem;
    color: #6e6659;
}

.nav {
    display: flex;
    gap: 1.5rem;
    font-weight: 600;
}

.nav a {
    text-decoration: none;
    color: var(--ink);
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.2s ease;
}

.nav a:hover::after {
    width: 100%;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content {
    padding: 2.5rem;
    display: grid;
    gap: 2rem;
}

.card {
    background: var(--surface);
    border-radius: 18px;
    padding: 1.8rem;
    box-shadow: var(--shadow);
    border: 1px solid #efe7db;
    animation: rise 0.4s ease;
}

.hero {
    text-align: left;
    max-width: 640px;
}

.hero-meta {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.hero-meta h3 {
    margin-bottom: 0.35rem;
}

.hero-disclaimer {
    border: 1px solid rgba(171, 126, 82, 0.2);
    background: rgba(171, 126, 82, 0.08);
    padding: 1rem 1.2rem;
    border-radius: 14px;
}

.link {
    color: var(--accent);
    font-weight: 600;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.calc-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.table {
    display: grid;
    gap: 0.75rem;
}

.table .row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr auto;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--highlight);
    border-radius: 12px;
    align-items: center;
}

.table.table-ranges .row {
    grid-template-columns: 1.5fr 0.7fr 1fr 0.9fr 1.2fr minmax(180px, 220px);
}

.table.table-children .row {
    grid-template-columns: 1.4fr 1fr 1fr 0.7fr minmax(160px, 200px);
}

.row-actions {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
}

.table .row.header {
    background: transparent;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8b8173;
}

.table.table-ranges .row.header > div:last-child {
    text-align: right;
}

.table.table-children .row.header > div:last-child {
    text-align: right;
}

.table .row.header .sort-btn {
    appearance: none;
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font: inherit;
    letter-spacing: inherit;
    padding: 0;
    text-transform: inherit;
}

.table .row.header .sort-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.table .row.header .sort-indicator {
    font-size: 0.8em;
}

.stat {
    font-size: 1.6rem;
    font-weight: 600;
}

.list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.list li {
    padding: 0.75rem 1rem;
    background: var(--highlight);
    border-radius: 12px;
}

.mini-stats {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    gap: 0.6rem;
}

.mini-stats li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--highlight);
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    font-size: 0.95rem;
}

.chart-card {
    display: grid;
    gap: 1rem;
}

.pie-chart {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pie-svg {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.pie-bg {
    fill: none;
    stroke: var(--muted);
    stroke-width: 8;
}

.pie-segment {
    fill: none;
    stroke-width: 8;
}

.pie-segment.free {
    stroke: var(--status-free);
}

.pie-segment.reserved {
    stroke: var(--status-reserved);
}

.pie-segment.allocated {
    stroke: var(--status-allocated);
}

.pie-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.pie-legend li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.pie-swatch {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    display: inline-block;
}

.pie-swatch.free {
    background: var(--status-free);
}

.pie-swatch.reserved {
    background: var(--status-reserved);
}

.pie-swatch.allocated {
    background: var(--status-allocated);
}

.notice {
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: #fff7f6;
    color: #8f3328;
    font-weight: 600;
}

.notice-error {
    border-color: #f1b5ae;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid #d7cfc2;
}

.btn-danger {
    background: #b33a2c;
}

.btn-danger:hover {
    background: #982f24;
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.modal-grid {
    grid-template-columns: 1fr;
}

label {
    display: grid;
    gap: 0.5rem;
    font-weight: 600;
}

input, select {
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #d9d0c4;
    font-family: inherit;
}

input[readonly] {
    background: #f5efe6;
    color: #6e6659;
}

.hint {
    color: #7a7063;
}

.split-preview {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed #d5c8bb;
    border-radius: 12px;
    background: #fffdf9;
}

.consolidator-results {
    margin-top: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

.plan-card {
    border: 1px solid #efe7db;
    border-radius: 16px;
    padding: 1.25rem;
    background: #fffdfa;
    box-shadow: var(--shadow);
    display: grid;
    gap: 1rem;
}

.plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.plan-select {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.plan-select input {
    margin-top: 0.25rem;
}

.plan-title {
    font-weight: 700;
}

.plan-meta {
    color: #7a7063;
    font-size: 0.85rem;
}

.plan-table .row {
    grid-template-columns: 1.4fr 0.6fr 1fr 1fr 0.7fr;
}

.muted {
    color: #7a7063;
    font-size: 0.85rem;
}

.calc-card {
    display: grid;
    gap: 0.75rem;
    border: 1px solid #efe7db;
    border-radius: 16px;
    padding: 1.25rem;
    background: #fffdfa;
    box-shadow: var(--shadow);
}

.calc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.calc-meta {
    color: #7a7063;
    font-size: 0.85rem;
}

.calc-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: #8b8173;
}

.calc-value {
    font-size: 1.15rem;
    font-weight: 600;
    word-break: break-all;
}

.copy-btn {
    width: fit-content;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
}

.calc-card select {
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #d9d0c4;
    font-family: inherit;
}

.chip {
    display: inline-flex;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #efe5d8;
    margin: 0.2rem;
    font-size: 0.85rem;
}

.error {
    color: #b33a2c;
    font-weight: 600;
}

.modal-error {
    border: 1px solid #f1b5ae;
    background: #fff7f6;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(21, 18, 13, 0.45);
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 16px;
    width: min(420px, 90vw);
    box-shadow: var(--shadow);
}

#editRangeModal {
    z-index: 1100;
}

#confirmModal {
    z-index: 1200;
}

#errorModal {
    z-index: 1300;
}

@keyframes rise {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem 1.5rem;
        gap: 1rem;
    }

    .brand {
        justify-content: space-between;
    }

    .brand-logo-long {
        height: 32px;
        max-width: 220px;
    }

    .nav {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .user-meta {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .content {
        padding: 1.5rem;
    }

    .card {
        padding: 1.4rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions {
        flex-wrap: wrap;
    }

    .table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table .row {
        min-width: 620px;
    }

    .table.table-children .row {
        min-width: 520px;
    }

    .table.table-ranges .row {
        min-width: 720px;
    }

    .plan-table .row {
        min-width: 560px;
    }

    .calc-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .copy-btn {
        align-self: flex-start;
    }
}

@media (max-width: 720px) {
    .table {
        overflow-x: visible;
    }

    .table .row.header {
        display: none;
    }

    .table .row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        min-width: 0;
    }

    .table .row > div[data-label] {
        display: grid;
        gap: 0.25rem;
    }

    .table .row > div[data-label]::before {
        content: attr(data-label);
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-size: 0.7rem;
        color: #8b8173;
    }

    .table .row .row-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .topbar {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
        gap: 1.5rem;
    }

    .card {
        padding: 1.1rem;
        border-radius: 14px;
    }

    .nav {
        gap: 0.6rem;
        font-size: 0.95rem;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions .btn {
        width: 100%;
    }

    .user-meta {
        width: 100%;
    }

    .modal-content {
        padding: 1.5rem;
        width: min(360px, 92vw);
    }
}
}
