:root {
    --ink: #17212b;
    --muted: #667085;
    --line: #d8dee8;
    --paper: #ffffff;
    --cloud: #f5f7fb;
    --brand: #0f766e;
    --brand-strong: #0b5f59;
    --geotech-red: #d71920;
    --accent: #f59e0b;
    --danger: #c2410c;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: linear-gradient(180deg, #eef3f4 0%, #f7f8fb 46%, #f1f3f6 100%);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-shell {
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        linear-gradient(90deg, rgba(215, 25, 32, 0.08), transparent 34%),
        linear-gradient(180deg, #eef3f4 0%, #f7f8fb 100%);
}

.login-panel {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    overflow: hidden;
    min-height: 620px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 28px 90px rgba(15, 23, 42, 0.16);
}

.brand-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 56px;
    color: #fff;
    background:
        linear-gradient(148deg, rgba(13, 79, 78, 0.98), rgba(20, 94, 104, 0.94)),
        linear-gradient(90deg, rgba(215, 25, 32, 0.9) 0 9px, transparent 9px 100%),
        repeating-linear-gradient(135deg, rgba(255,255,255,0.10) 0 1px, transparent 1px 18px);
}

.brand-hero {
    display: grid;
    grid-template-columns: 164px 1fr;
    gap: 28px;
    align-items: center;
}

.brand-mark,
.nav-logo {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: #0f3f3b;
    background: #fff;
    font-weight: 800;
}

.brand-logo-img {
    width: 164px;
    height: 164px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.nav-logo-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.brand-side h1 {
    margin: 4px 0 0;
    font-size: clamp(48px, 6vw, 78px);
    line-height: 1;
    letter-spacing: 0;
}

.brand-company {
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 850;
    line-height: 1;
}

.brand-copy {
    max-width: 520px;
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1.18rem;
    line-height: 1.55;
    border-left: 4px solid var(--geotech-red);
    padding-left: 18px;
}

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px;
}

.login-card-heading {
    margin-bottom: 26px;
}

.login-card h2,
.tool-panel h1,
.tool-panel h2 {
    margin: 0;
    letter-spacing: 0;
}

.login-card h2 {
    font-size: 2.15rem;
    font-weight: 800;
}

.login-card .form-label {
    color: #334155;
    font-size: 0.9rem;
    font-weight: 750;
}

.login-card .form-control {
    min-height: 48px;
    border-color: #cfd8e3;
    border-radius: 8px;
}

.login-card .form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.22rem rgba(15, 118, 110, 0.18);
}

.login-card .btn {
    min-height: 48px;
    border-radius: 8px;
    font-weight: 750;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-strong);
    --bs-btn-hover-border-color: var(--brand-strong);
    --bs-btn-active-bg: var(--brand-strong);
    --bs-btn-active-border-color: var(--brand-strong);
}

.app-nav {
    min-height: 72px;
    background: #113b3e;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 800;
}

.navbar-brand:hover {
    color: #fff;
}

.nav-logo {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-chip,
.storage-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.user-chip {
    color: #d9fffb;
    background: rgba(255,255,255,0.1);
}

.storage-pill {
    color: #39505e;
    background: #eef3f6;
}

.status-pill.active {
    color: #14532d;
    background: #dcfce7;
}

.status-pill.blocked {
    color: #7f1d1d;
    background: #fee2e2;
}

.app-wrap {
    padding: 28px;
}

.tool-panel {
    padding: 24px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.sub-panel {
    height: 100%;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.sub-panel h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 850;
}

.sub-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.sub-panel-heading h3 {
    margin-bottom: 6px;
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 650;
}

.notification-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.notification-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.notification-option:hover {
    border-color: var(--brand);
}

.notification-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.notification-option strong,
.notification-option small {
    display: block;
}

.notification-option small {
    margin-top: 2px;
    color: var(--muted);
    font-weight: 650;
}

.space-list {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

.space-card {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    text-align: left;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.space-card:hover,
.space-card.active {
    border-color: var(--brand);
    box-shadow: 0 12px 30px rgba(15, 118, 110, 0.12);
    transform: translateY(-1px);
}

.space-card strong,
.space-card small {
    display: block;
}

.space-card small {
    margin-top: 4px;
    color: var(--muted);
    font-weight: 650;
}

.empty-state {
    padding: 28px;
    border: 1px dashed #b8c4cf;
    border-radius: 8px;
    color: #52606d;
    background: #f8fafc;
    font-weight: 700;
}

.empty-state.compact {
    padding: 14px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--brand);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.dropzone {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 34px;
    text-align: center;
    border: 2px dashed #9ab8b2;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(245, 158, 11, 0.07)),
        var(--cloud);
    transition: border-color 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.scope-toolbar {
    padding: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.folder-form {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto auto;
    gap: 8px;
    margin-bottom: 14px;
}

.folder-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 32px;
    margin-bottom: 12px;
}

.crumb-btn {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.crumb-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.folder-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 800;
    padding: 0;
}

.folder-name:hover {
    color: var(--brand);
}

.folder-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.9rem;
}

.scope-toolbar .form-label {
    color: #4b5563;
    font-size: 0.82rem;
    font-weight: 800;
}

.dropzone.dragging,
.dropzone:focus {
    outline: none;
    border-color: var(--accent);
    transform: translateY(-2px);
}

.dropzone-disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.drop-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    border-radius: 8px;
    color: #fff;
    background: var(--brand);
    font-size: 2.2rem;
    font-weight: 300;
}

.dropzone h2 {
    font-size: 1.55rem;
}

.dropzone p {
    margin: 8px 0 18px;
    color: var(--muted);
}

.upload-queue {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.upload-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.upload-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.upload-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.progress {
    height: 10px;
    border-radius: 999px;
}

.progress-bar {
    background: var(--brand);
}

.file-table-wrap {
    min-height: 380px;
}

.table {
    margin-bottom: 0;
}

.table th {
    color: #52606d;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.table td,
.table th {
    border-color: #edf0f4;
}

.file-name {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.client-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    color: #0f3f3b;
    background: #dff6f1;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.uploader-name {
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.action-group {
    display: inline-flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-danger-soft {
    color: #9a3412;
    border-color: #fed7aa;
    background: #fff7ed;
}

.btn-danger-soft:hover {
    color: #fff;
    border-color: var(--danger);
    background: var(--danger);
}

.stacked-form .form-label {
    color: #4b5563;
    font-weight: 700;
}

.form-message {
    min-height: 24px;
    margin: 14px 0 0;
    color: var(--muted);
}

.form-message.error {
    color: var(--danger);
}

.form-message.ok {
    color: var(--brand);
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.app-modal.is-open {
    display: flex;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.56);
}

.app-modal-dialog {
    position: relative;
    width: min(520px, 100%);
    padding: 24px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.app-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.modal-close {
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 1.8rem;
    line-height: 1;
}

.app-modal-copy {
    margin: 0 0 14px;
    color: #334155;
    font-weight: 700;
}

.app-modal-warning {
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #9a3412;
    background: #fff7ed;
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 760px) {
    .login-panel {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .brand-side {
        min-height: 230px;
        padding: 30px;
        gap: 26px;
    }

    .brand-hero {
        grid-template-columns: 92px 1fr;
        gap: 18px;
    }

    .brand-logo-img {
        width: 92px;
        height: 92px;
        padding: 8px;
    }

    .login-card,
    .tool-panel,
    .app-wrap {
        padding: 20px;
    }

    .app-nav .container-fluid,
    .panel-heading,
    .sub-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-actions {
        justify-content: flex-start;
    }

    .dropzone {
        min-height: 240px;
        padding: 22px;
    }

    .folder-form {
        grid-template-columns: 1fr;
    }

    .app-modal-dialog {
        padding: 20px;
    }
}
