* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #0b1220;
    color: #f3f7ff;
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-page {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: #121c2e;
    border: 1px solid #24324d;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.brand {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.brand-small {
    font-size: 20px;
    margin-bottom: 4px;
}

.auth-title {
    margin: 0 0 8px;
    font-size: 26px;
}

.auth-subtitle {
    margin: 0 0 20px;
    color: #9db0d1;
    font-size: 15px;
}

.auth-form,
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-label {
    font-size: 14px;
    color: #c7d4eb;
    margin-top: 4px;
    display: block;
    margin-bottom: 8px;
}

.input {
    width: 100%;
    border: 1px solid #31415f;
    background: #0d1526;
    color: #ffffff;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 16px;
    outline: none;
}

.textarea {
    resize: vertical;
    min-height: 96px;
}

.input:focus {
    border-color: #5c8dff;
    box-shadow: 0 0 0 3px rgba(92, 141, 255, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: #4e7cff;
    color: #ffffff;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: scale(0.99);
}

.btn-secondary {
    background: #1b2940;
    color: #e8f0ff;
    border: 1px solid #324663;
}

.btn-danger {
    background: #7a2230;
    color: #fff0f2;
    border: 1px solid #aa4051;
}

.btn-danger:hover {
    filter: brightness(1.06);
}

.btn-small {
    min-height: 38px;
    padding: 10px 14px;
    font-size: 14px;
}

.btn-disabled {
    width: 100%;
    background: #23314a;
    color: #8ea3c6;
    cursor: not-allowed;
}

.alert {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: rgba(255, 92, 92, 0.12);
    border: 1px solid rgba(255, 92, 92, 0.3);
    color: #ffb3b3;
}

.alert-success {
    background: rgba(66, 211, 146, 0.12);
    border: 1px solid rgba(66, 211, 146, 0.3);
    color: #9ff3ca;
}

.page {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 16px;
}

.page-wide {
    max-width: 1200px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-subtitle {
    color: #8ea3c6;
    font-size: 14px;
}

.card {
    background: #121c2e;
    border: 1px solid #24324d;
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.card-label {
    color: #7fa0df;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.card-label-tight {
    margin-bottom: 10px;
}

.card-title {
    margin: 0 0 10px;
    font-size: 26px;
    line-height: 1.2;
}

.section-title {
    margin: 0 0 10px;
    font-size: 20px;
}

.muted {
    color: #a8b7d2;
    margin: 0 0 12px;
    line-height: 1.5;
}

.scan-muted {
    margin-bottom: 0;
}

.status-badge {
    display: inline-block;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    margin-top: 4px;
}

.status-green {
    background: rgba(66, 211, 146, 0.14);
    color: #8ff0bf;
    border: 1px solid rgba(66, 211, 146, 0.32);
}

.status-yellow {
    background: rgba(255, 201, 71, 0.14);
    color: #ffe08a;
    border: 1px solid rgba(255, 201, 71, 0.32);
}

.status-red {
    background: rgba(255, 92, 92, 0.14);
    color: #ffb5b5;
    border: 1px solid rgba(255, 92, 92, 0.32);
}

.status-gray {
    background: rgba(160, 174, 192, 0.12);
    color: #d2dceb;
    border: 1px solid rgba(160, 174, 192, 0.22);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #0d1526;
    border: 1px solid #22314d;
    border-radius: 14px;
    color: #d8e3f8;
    font-size: 14px;
}

.info-row-column {
    flex-direction: column;
}

.scan-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.scan-summary-card {
    background: #0d1526;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
}

.scan-summary-title {
    color: #95abd1;
    font-size: 13px;
    margin-bottom: 8px;
}

.scan-summary-value {
    color: #f0f5ff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

.scan-panel {
    background: #0d1526;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 16px;
}

.scan-panel-advanced {
    padding: 16px;
}

.scan-idle {
    text-align: center;
    padding: 12px 0 6px;
}

.scan-idle-icon {
    font-size: 42px;
    margin-bottom: 10px;
}

.scan-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.scan-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: center;
}

.scan-circle-wrap {
    display: flex;
    justify-content: center;
}

.scan-circle {
    position: relative;
    width: 150px;
    height: 150px;
}

.scan-circle-svg {
    width: 150px;
    height: 150px;
    transform: rotate(-90deg);
}

.scan-circle-bg {
    fill: none;
    stroke: #22314d;
    stroke-width: 8;
}

.scan-circle-progress {
    fill: none;
    stroke: #5a87ff;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.45s ease;
    filter: drop-shadow(0 0 10px rgba(90, 135, 255, 0.35));
}

.scan-circle-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scan-percent-big {
    font-size: 30px;
    font-weight: 800;
    color: #f5f8ff;
    line-height: 1;
}

.scan-percent-sub {
    margin-top: 6px;
    color: #90a6cc;
    font-size: 13px;
}

.scan-stage-card {
    background: #111d31;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 16px;
}

.scan-stage-label {
    color: #92a8d0;
    font-size: 13px;
    margin-bottom: 8px;
}

.scan-stage-value {
    font-size: 18px;
    font-weight: 700;
    color: #f4f8ff;
    line-height: 1.35;
    margin-bottom: 16px;
}

.scan-progress-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: #d8e3f8;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 14px;
    background: #18243b;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #24324d;
}

.progress-bar-large {
    height: 16px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4e7cff 0%, #73a1ff 100%);
    transition: width 0.45s ease;
}

.scan-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric-card {
    background: #111d31;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
}

.metric-title {
    color: #95abd1;
    font-size: 13px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 22px;
    font-weight: 800;
    color: #f3f7ff;
    line-height: 1.2;
}

.scan-log-card {
    background: #111d31;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
}

.scan-log-title {
    color: #9ab1d6;
    font-size: 13px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scan-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.scan-log-large {
    max-height: 250px;
}

.scan-log-row {
    padding: 10px 12px;
    border-radius: 12px;
    background: #0d1526;
    border: 1px solid #22314d;
    color: #d9e6ff;
    font-size: 14px;
    line-height: 1.4;
}

.scan-result-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scan-result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.scan-result-main {
    background: #111d31;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
}

.scan-result-text {
    color: #f1f6ff;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.scan-result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.scan-result-stat {
    background: #111d31;
    border: 1px solid #22314d;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scan-result-stat span {
    color: #95abd1;
    font-size: 13px;
}

.scan-result-stat strong {
    color: #f4f8ff;
    font-size: 18px;
}

.last-scan-card {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 16px;
    background: #0d1526;
    border: 1px solid #22314d;
}

.last-scan-list {
    margin-top: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.form-block {
    margin-bottom: 14px;
}

.form-separator {
    height: 1px;
    background: #24324d;
    margin: 12px 0 18px;
}

.admin-action-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.admin-action-bar form {
    margin: 0;
}

.admin-table-wrap {
    overflow-x: auto;
    display: none;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1120px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid #24324d;
    vertical-align: top;
    font-size: 14px;
}

.admin-table th {
    color: #aecdff;
    font-weight: 700;
}

.table-subtext {
    margin-top: 6px;
    color: #8ea3c6;
    font-size: 12px;
}

.table-subtext-strong {
    color: #8ea3c6;
    font-size: 12px;
    font-weight: 600;
}

.admin-cards {
    display: grid;
    gap: 14px;
}

.admin-user-card {
    background: #0d1526;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
}

.admin-user-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.scan-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scan-history-item {
    background: #0d1526;
    border: 1px solid #22314d;
    border-radius: 16px;
    padding: 14px;
}

.scan-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.scan-history-date {
    color: #9fb2d4;
    font-size: 13px;
}

.scan-history-text {
    color: #ecf3ff;
    line-height: 1.5;
    font-size: 14px;
}

@media (min-width: 768px) {
    .page {
        padding: 24px;
    }

    .card {
        padding: 22px;
    }

    .form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .scan-hero {
        grid-template-columns: 180px 1fr;
    }

    .scan-summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .scan-metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .scan-result-grid {
        grid-template-columns: 1.2fr 0.8fr;
    }
}

@media (min-width: 1024px) {
    .admin-table-wrap {
        display: block;
    }

    .admin-cards {
        display: none;
    }
}