
.udt-app {
    --udt-bg: #f6f8fc;
    --udt-card: #ffffff;
    --udt-text: #172033;
    --udt-muted: #73809a;
    --udt-border: #e7ebf2;
    --udt-primary: #5b5cf0;
    --udt-primary-2: #7c3aed;
    --udt-soft: #f0f2ff;
    --udt-danger: #e4475b;
    --udt-success: #16a46b;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--udt-text);
    background: var(--udt-bg);
    border-radius: 24px;
    padding: 22px;
    line-height: 1.45;
}

.udt-app * { box-sizing: border-box; }

.udt-hero {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: center;
    padding: 28px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.22), transparent 28%),
        linear-gradient(135deg, #23235b, #5b5cf0 56%, #7c3aed);
    color: #fff;
    box-shadow: 0 18px 40px rgba(46, 46, 115, .18);
}

.udt-kicker {
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    opacity: .8;
    margin-bottom: 8px;
}

.udt-hero h2,
.udt-card h3,
.udt-modal h3,
.udt-subject-head h4 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -.02em;
}

.udt-hero h2 { font-size: clamp(26px, 4vw, 38px); }

.udt-hero p {
    margin: 8px 0 0;
    max-width: 690px;
    opacity: .86;
    font-size: 15px;
}

.udt-btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-size: 14px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}

.udt-btn:hover { transform: translateY(-1px); }
.udt-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.udt-btn-primary {
    background: #fff;
    color: #3333aa;
    box-shadow: 0 8px 20px rgba(18, 18, 70, .14);
}

.udt-modal .udt-btn-primary {
    background: linear-gradient(135deg, var(--udt-primary), var(--udt-primary-2));
    color: #fff;
}

.udt-btn-soft { background: var(--udt-soft); color: #484ab5; }

.udt-notice {
    margin: 16px 0 0;
    background: #fff8dd;
    border: 1px solid #f2df92;
    color: #6d5a17;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 13px;
}

.udt-score-note {
    margin: 12px 0 0;
    padding: 11px 14px;
    border-radius: 12px;
    background: #eef6ff;
    border: 1px solid #d8e9ff;
    color: #496078;
    font-size: 12px;
}

.udt-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.udt-stat-card,
.udt-card {
    background: var(--udt-card);
    border: 1px solid var(--udt-border);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(27, 38, 65, .045);
}

.udt-stat-card { padding: 18px; }

.udt-stat-card > span,
.udt-stat-card small {
    display: block;
    color: var(--udt-muted);
}

.udt-stat-card > span {
    font-size: 12px;
    font-weight: 700;
}

.udt-stat-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.15;
    margin: 7px 0 4px;
    letter-spacing: -.04em;
}

.udt-stat-card small {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.udt-stat-card strong.is-positive { color: var(--udt-success); }
.udt-stat-card strong.is-negative { color: var(--udt-danger); }

.udt-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr);
    gap: 16px;
    margin-top: 16px;
}

.udt-card { padding: 20px; }

.udt-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.udt-card h3 { font-size: 18px; }

.udt-card-head p {
    margin: 4px 0 0;
    color: var(--udt-muted);
    font-size: 12px;
}

.udt-select,
.udt-input,
.udt-mini-input {
    border: 1px solid var(--udt-border);
    background: #fff;
    color: var(--udt-text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.udt-select {
    border-radius: 10px;
    min-height: 38px;
    padding: 0 32px 0 11px;
    font-size: 12px;
    font-weight: 700;
}

.udt-select:focus,
.udt-input:focus,
.udt-mini-input:focus {
    border-color: rgba(91, 92, 240, .55);
    box-shadow: 0 0 0 3px rgba(91, 92, 240, .10);
}

.udt-chart {
    width: 100%;
    min-height: 270px;
}

.udt-chart svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.udt-grid-line {
    stroke: #edf0f5;
    stroke-width: 1;
}

.udt-line {
    fill: none;
    stroke: var(--udt-primary);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.udt-chart-point circle {
    fill: #fff;
    stroke: var(--udt-primary);
    stroke-width: 3;
}

.udt-axis-label {
    fill: #8a94a8;
    font-size: 10px;
    font-family: inherit;
}

.udt-chart-empty,
.udt-empty-mini,
.udt-empty-row {
    color: var(--udt-muted);
    text-align: center;
}

.udt-chart-empty {
    min-height: 250px;
    display: grid;
    place-items: center;
    font-size: 13px;
}

.udt-empty-mini { padding: 50px 12px; font-size: 13px; }

.udt-analysis-row { margin: 0 0 16px; }
.udt-analysis-row:last-child { margin-bottom: 0; }

.udt-analysis-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    margin-bottom: 7px;
}

.udt-analysis-top span { color: #4e5a70; font-weight: 700; }
.udt-analysis-top strong { font-size: 13px; }

.udt-progress {
    background: #eef1f6;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.udt-progress i {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--udt-primary), var(--udt-primary-2));
}

.udt-list-card { margin-top: 16px; }

.udt-report-profile {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(180px, .8fr) minmax(140px, .55fr);
    gap: 12px;
    align-items: end;
    margin: 0 0 14px;
    padding: 13px;
    background: linear-gradient(135deg, #f8f9ff, #f4f7ff);
    border: 1px solid #e3e7fb;
    border-radius: 14px;
}
.udt-report-profile-title { align-self: center; }
.udt-report-profile-title strong { display:block; font-size:12px; }
.udt-report-profile-title span { display:block; color:var(--udt-muted); font-size:10px; margin-top:3px; }
.udt-report-profile label > span { display:block; color:#667085; font-size:10px; font-weight:800; margin:0 0 5px; text-transform:uppercase; letter-spacing:.04em; }
.udt-report-profile .udt-input { min-height:38px; }
.udt-list-head { align-items: center; }
.udt-actions { display: flex; gap: 8px; align-items: center; }

.udt-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--udt-border);
    border-radius: 13px;
}

.udt-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 690px;
}

.udt-table th,
.udt-table td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid var(--udt-border);
    font-size: 12px;
    vertical-align: middle;
}

.udt-table th {
    background: #fafbfe;
    color: #73809a;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 800;
}

.udt-table tr:last-child td { border-bottom: 0; }

.udt-badge {
    display: inline-flex;
    background: var(--udt-soft);
    color: #5153ba;
    padding: 5px 8px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 10px;
}

.udt-net { font-size: 14px; }

.udt-row-actions {
    text-align: right !important;
    white-space: nowrap;
}

.udt-link-btn {
    border: 0;
    background: none;
    padding: 4px 6px;
    color: #5658c6;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.udt-link-btn.is-danger { color: var(--udt-danger); }

.udt-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

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

.udt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 20, 37, .62);
    backdrop-filter: blur(4px);
}

.udt-modal-panel {
    position: relative;
    width: min(920px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 30px 80px rgba(8, 12, 28, .32);
}

body.udt-modal-open { overflow: hidden; }

.udt-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.udt-modal .udt-kicker { color: var(--udt-primary); }
.udt-modal h3 { font-size: 24px; }

.udt-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--udt-border);
    background: #fff;
    color: #7b8496;
    cursor: pointer;
    font-size: 25px;
    line-height: 1;
}

.udt-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.udt-form-grid label,
.udt-notes-label {
    display: block;
}

.udt-form-grid label > span,
.udt-notes-label > span {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: #556176;
    margin-bottom: 6px;
}

.udt-input {
    width: 100%;
    min-height: 42px;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 13px;
}

textarea.udt-input { resize: vertical; }

.udt-subject-head {
    margin: 22px 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
}

.udt-subject-head h4 { font-size: 16px; }
.udt-subject-head p { margin: 4px 0 0; color: var(--udt-muted); font-size: 11px; }

.udt-live-total {
    background: #f3f3ff;
    border: 1px solid #e4e5ff;
    color: #6567c5;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.udt-live-total strong {
    display: block;
    font-size: 20px;
    color: #3436a3;
}

.udt-subject-fields {
    display: grid;
    gap: 9px;
}

.udt-subject-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.4fr) repeat(3, 90px) 95px;
    gap: 10px;
    align-items: end;
    background: #fafbfe;
    border: 1px solid var(--udt-border);
    border-radius: 12px;
    padding: 11px;
}

.udt-subject-row.has-error {
    border-color: rgba(228,71,91,.55);
    background: #fff7f8;
}

.udt-subject-name {
    align-self: center;
}

.udt-subject-name strong {
    display: block;
    font-size: 13px;
}

.udt-subject-name small {
    color: var(--udt-muted);
    font-size: 10px;
}

.udt-subject-row label span,
.udt-subject-net span {
    display: block;
    font-size: 9px;
    color: var(--udt-muted);
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.udt-mini-input {
    width: 100%;
    height: 36px;
    border-radius: 8px;
    padding: 0 8px;
    font-size: 12px;
}

.udt-mini-input[readonly] {
    background: #f3f4f7;
    color: #8992a4;
}

.udt-subject-net {
    background: #fff;
    border: 1px solid var(--udt-border);
    border-radius: 8px;
    height: 36px;
    padding: 5px 9px;
}

.udt-subject-net span { margin: 0; line-height: 10px; }
.udt-subject-net strong { font-size: 13px; line-height: 14px; }

.udt-notes-label { margin-top: 14px; }

.udt-form-message {
    min-height: 22px;
    margin-top: 9px;
    font-size: 12px;
    font-weight: 700;
}

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

.udt-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

@media (max-width: 900px) {
    .udt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .udt-grid { grid-template-columns: 1fr; }
    .udt-subject-row {
        grid-template-columns: minmax(140px, 1fr) repeat(3, 78px) 85px;
    }
}

@media (max-width: 680px) {
    .udt-app {
        padding: 12px;
        border-radius: 16px;
    }

    .udt-hero {
        padding: 20px;
        border-radius: 16px;
        align-items: flex-start;
        flex-direction: column;
    }

    .udt-hero .udt-btn { width: 100%; }
    .udt-stats { gap: 9px; }
    .udt-stat-card { padding: 14px; }
    .udt-stat-card strong { font-size: 23px; }

    .udt-card { padding: 14px; border-radius: 15px; }
    .udt-card-head,
    .udt-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .udt-actions { width: 100%; }
    .udt-actions .udt-select { flex: 1; }
    .udt-report-profile { grid-template-columns: 1fr; }
    .udt-report-profile-title { margin-bottom: 2px; }
    .udt-actions .udt-btn { flex: 0 0 auto; }

    .udt-table {
        min-width: 0;
    }

    .udt-table thead { display: none; }
    .udt-table,
    .udt-table tbody,
    .udt-table tr,
    .udt-table td {
        display: block;
        width: 100%;
    }

    .udt-table tr {
        padding: 12px;
        border-bottom: 1px solid var(--udt-border);
    }

    .udt-table tr:last-child { border-bottom: 0; }

    .udt-table td {
        border: 0;
        padding: 6px 0;
        display: flex;
        justify-content: space-between;
        gap: 16px;
        text-align: right;
    }

    .udt-table td::before {
        content: attr(data-label);
        color: var(--udt-muted);
        font-size: 10px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .udt-table .udt-row-actions {
        justify-content: flex-end;
        padding-top: 10px;
    }

    .udt-table .udt-row-actions::before { display: none; }
    .udt-empty-row { display: block !important; text-align: center !important; }
    .udt-empty-row::before { display: none; }

    .udt-modal { padding: 0; align-items: flex-end; }
    .udt-modal-panel {
        width: 100%;
        max-height: 94vh;
        border-radius: 18px 18px 0 0;
        padding: 16px;
    }

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

    .udt-subject-head {
        align-items: stretch;
        flex-direction: column;
    }

    .udt-live-total {
        text-align: left;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .udt-live-total strong { display: inline; }

    .udt-subject-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .udt-subject-name {
        grid-column: 1 / -1;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .udt-subject-net { height: 36px; }
}

@media (max-width: 420px) {
    .udt-stats { grid-template-columns: 1fr 1fr; }
    .udt-stat-card small { white-space: normal; }
    .udt-subject-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .udt-subject-name { grid-column: 1 / -1; }
}
