@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

.dh-ir-page {
    --ir-blue: #2563eb;
    --ir-blue-hover: #1d4ed8;
    --ir-blue-active: #1e40af;
    --ir-blue-light: #dbeafe;
    --ir-bg: #f4f5f7;
    --ir-surface: #ffffff;
    --ir-surface-2: #f9f9fb;
    --ir-border: #e3e5e9;
    --ir-border-soft: #eceef1;
    --ir-text: #1a1c20;
    --ir-text-muted: #6b7280;
    --ir-text-faint: #adb5bd;
    --ir-success: #16a34a;
    --ir-success-bg: #dcfce7;
    --ir-warning: #d97706;
    --ir-warning-bg: #fef3c7;
    --ir-danger: #dc2626;
    --ir-danger-bg: #fee2e2;
    --ir-info: #0369a1;
    --ir-info-bg: #e0f2fe;
    --ir-info-border: #bae6fd;
    --ir-radius: 8px;
    --ir-radius-lg: 12px;
    --ir-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
    --ir-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --ir-trans: 150ms ease;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ir-text);
    background: var(--ir-bg);
    min-height: 100%;
}

html[data-theme="dark"] .dh-ir-page {
    --ir-blue: #3b82f6;
    --ir-blue-hover: #60a5fa;
    --ir-blue-active: #93c5fd;
    --ir-blue-light: #1e3a5f;
    --ir-bg: #0f1117;
    --ir-surface: #1a1d27;
    --ir-surface-2: #232637;
    --ir-border: rgba(255, 255, 255, 0.08);
    --ir-border-soft: rgba(255, 255, 255, 0.05);
    --ir-text: #e8eaf0;
    --ir-text-muted: #9299ad;
    --ir-text-faint: #4b5264;
    --ir-success: #22c55e;
    --ir-success-bg: #14432a;
    --ir-warning: #f59e0b;
    --ir-warning-bg: #44300a;
    --ir-danger: #f87171;
    --ir-danger-bg: #4b1a1a;
    --ir-info: #38bdf8;
    --ir-info-bg: #0c2a3a;
    --ir-info-border: #0e4260;
    --ir-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --ir-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dh-ir-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 28px 48px;
}

@media (max-width: 700px) {
    .dh-ir-inner {
        padding: 16px 14px 40px;
    }
}

.dh-ir-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.dh-ir-page-header h1 {
    font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.dh-ir-btn-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ir-radius);
    color: var(--ir-text-muted);
    border: 1px solid var(--ir-border);
    background: var(--ir-surface);
    cursor: pointer;
    padding: 0;
}

.dh-ir-btn-icon:hover {
    background: var(--ir-surface-2);
    color: var(--ir-text);
}

.dh-ir-info-banner {
    background: var(--ir-info-bg);
    border: 1px solid var(--ir-info-border);
    border-radius: var(--ir-radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.dh-ir-info-banner-icon {
    color: var(--ir-info);
    flex-shrink: 0;
    margin-top: 1px;
}

.dh-ir-info-banner-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dh-ir-info-banner-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ir-info);
}

.dh-ir-info-banner-text {
    font-size: 12px;
    color: var(--ir-text-muted);
    line-height: 1.6;
}

.dh-ir-info-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.dh-ir-info-pill {
    background: rgba(3, 105, 161, 0.12);
    border: 1px solid var(--ir-info-border);
    border-radius: 99px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ir-info);
}

html[data-theme="dark"] .dh-ir-info-pill {
    background: rgba(56, 189, 248, 0.12);
}

.dh-ir-workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 18px;
    align-items: start;
}

@media (max-width: 960px) {
    .dh-ir-workspace {
        grid-template-columns: 1fr;
    }
}

.dh-ir-card {
    background: var(--ir-surface);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius-lg);
    box-shadow: var(--ir-shadow-sm);
    overflow: hidden;
}

.dh-ir-card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--ir-border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dh-ir-card-head h2 {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.dh-ir-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dh-ir-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dh-ir-field > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ir-text);
}

.dh-ir-sel {
    width: 100%;
    background: var(--ir-surface-2);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    padding: 8px 28px 8px 11px;
    font-size: 13px;
    color: var(--ir-text);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--ir-trans), box-shadow var(--ir-trans);
}

.dh-ir-sel:focus {
    border-color: var(--ir-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dh-ir-period-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dh-ir-period-dates {
    font-size: 13px;
    color: var(--ir-text-muted);
}

.dh-ir-period-chip {
    background: var(--ir-blue-light);
    color: var(--ir-blue);
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
}

html[data-theme="dark"] .dh-ir-period-chip {
    color: #93c5fd;
}

.dh-ir-currency-toggle {
    display: flex;
    gap: 2px;
    background: var(--ir-bg);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    padding: 3px;
}

.dh-ir-cur-btn {
    flex: 1;
    padding: 6px 10px;
    border-radius: calc(var(--ir-radius) - 2px);
    font-size: 12px;
    font-weight: 700;
    color: var(--ir-text-muted);
    text-align: center;
    letter-spacing: 0.04em;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background var(--ir-trans), color var(--ir-trans), box-shadow var(--ir-trans);
}

.dh-ir-cur-btn--active {
    background: var(--ir-surface);
    color: var(--ir-text);
    box-shadow: var(--ir-shadow-sm);
}

.dh-ir-cur-btn:disabled {
    opacity: 0.85;
    cursor: default;
}

.dh-ir-divider {
    height: 1px;
    background: var(--ir-border-soft);
    margin: 4px 0;
}

.dh-ir-check-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dh-ir-check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.dh-ir-check-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 1px;
    cursor: pointer;
    accent-color: var(--ir-blue);
    flex-shrink: 0;
}

.dh-ir-check-text {
    font-size: 13px;
    color: var(--ir-text);
}

.dh-ir-check-desc {
    font-size: 11px;
    color: var(--ir-text-muted);
    margin-top: 2px;
    line-height: 1.5;
}

.dh-ir-expense-heading {
    font-size: 12px;
    font-weight: 700;
    color: var(--ir-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dh-ir-custom-expenses {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dh-ir-expense-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dh-ir-inp {
    width: 100%;
    background: var(--ir-surface-2);
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    padding: 8px 11px;
    font-size: 13px;
    color: var(--ir-text);
    outline: none;
    transition: border-color var(--ir-trans), box-shadow var(--ir-trans);
}

.dh-ir-inp:focus {
    border-color: var(--ir-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dh-ir-inp--name {
    flex: 1;
}

.dh-ir-inp--val {
    width: 110px;
    flex-shrink: 0;
}

.dh-ir-inp-num {
    -moz-appearance: textfield;
}

.dh-ir-inp-num::-webkit-outer-spin-button,
.dh-ir-inp-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dh-ir-expense-label {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--ir-text);
    min-width: 0;
}

.dh-ir-del-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--ir-radius);
    display: grid;
    place-items: center;
    color: var(--ir-text-faint);
    border: none;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.dh-ir-del-btn:hover {
    background: var(--ir-danger-bg);
    color: var(--ir-danger);
}

.dh-ir-add-expense {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ir-blue);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
}

.dh-ir-add-expense:hover {
    opacity: 0.75;
}

.dh-ir-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 20px;
    border-radius: var(--ir-radius-lg);
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: var(--ir-blue);
    color: #fff;
    cursor: pointer;
    transition: background var(--ir-trans), box-shadow var(--ir-trans), transform var(--ir-trans);
}

.dh-ir-btn-primary:hover:not(:disabled) {
    background: var(--ir-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--ir-shadow-md);
}

.dh-ir-btn-primary:active:not(:disabled) {
    background: var(--ir-blue-active);
    transform: none;
}

.dh-ir-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.dh-ir-btn-primary.dh-ir-btn-loading {
    position: relative;
    pointer-events: none;
}

.dh-ir-btn-primary.dh-ir-btn-loading .dh-ir-btn-text {
    opacity: 0;
}

.dh-ir-btn-primary.dh-ir-btn-loading::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dh-ir-spin 0.6s linear infinite;
}

@keyframes dh-ir-spin {
    to {
        transform: rotate(360deg);
    }
}

.dh-ir-product-scroll {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--ir-border);
    border-radius: var(--ir-radius);
    padding: 10px 12px;
    background: var(--ir-surface-2);
}

.dh-ir-product-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
}

.dh-ir-product-row input {
    margin-top: 3px;
    accent-color: var(--ir-blue);
}

.dh-ir-product-row label {
    font-size: 13px;
    color: var(--ir-text);
    cursor: pointer;
    line-height: 1.4;
}

.dh-ir-muted {
    font-size: 12px;
    color: var(--ir-text-muted);
    text-align: center;
    padding: 8px;
}

.dh-ir-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
}

.dh-ir-badge--blue {
    background: var(--ir-blue-light);
    color: var(--ir-blue);
}

html[data-theme="dark"] .dh-ir-badge--blue {
    color: #93c5fd;
}

.dh-ir-result-sub {
    font-size: 11px;
    color: var(--ir-text-muted);
    margin-top: 2px;
    font-weight: 400;
}

.dh-ir-report-result {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dh-ir-report-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ir-text-faint);
    padding: 0 0 8px;
    margin-top: 4px;
}

.dh-ir-report-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--ir-border-soft);
}

.dh-ir-report-row:last-child {
    border-bottom: none;
}

.dh-ir-report-row--subtotal {
    border-bottom: 1px solid var(--ir-border);
}

.dh-ir-report-row--subtotal .dh-ir-report-label {
    font-weight: 600;
    color: var(--ir-text);
    font-size: 13px;
}

.dh-ir-report-row--subtotal .dh-ir-report-val {
    font-weight: 600;
}

.dh-ir-report-row--total {
    border-top: 2px solid var(--ir-border);
    border-bottom: none;
    margin-top: 4px;
    padding-top: 10px;
}

.dh-ir-report-row--total .dh-ir-report-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--ir-text);
}

.dh-ir-report-row--total .dh-ir-report-val {
    font-size: 16px;
    font-weight: 700;
}

.dh-ir-report-label {
    font-size: 13px;
    color: var(--ir-text-muted);
}

.dh-ir-report-label--auto {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dh-ir-report-label--auto::after {
    content: "авто";
    font-size: 10px;
    font-weight: 700;
    color: var(--ir-success);
    background: var(--ir-success-bg);
    padding: 1px 5px;
    border-radius: 99px;
}

.dh-ir-report-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--ir-text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dh-ir-report-val--positive {
    color: var(--ir-success);
}

.dh-ir-report-val--negative {
    color: var(--ir-danger);
}

.dh-ir-report-val--neutral {
    color: var(--ir-text-muted);
}

.dh-ir-renewal-block {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--ir-border);
}

.dh-ir-renewal-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ir-text-faint);
    margin-bottom: 8px;
}

.dh-ir-renewal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
    color: var(--ir-text-muted);
}

.dh-ir-renewal-count {
    font-weight: 600;
    color: var(--ir-text);
    flex-shrink: 0;
}

.dh-ir-auto-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--ir-border-soft);
}

.dh-ir-auto-legend-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--ir-success);
    background: var(--ir-success-bg);
    padding: 1px 6px;
    border-radius: 99px;
}

.dh-ir-auto-legend-text {
    font-size: 11px;
    color: var(--ir-text-faint);
}

.dh-ir-empty-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 16px;
    text-align: center;
}

.dh-ir-empty-result svg {
    color: var(--ir-text-faint);
}

.dh-ir-empty-result p {
    margin: 0;
    font-size: 13px;
    color: var(--ir-text-muted);
    max-width: 28ch;
    line-height: 1.55;
}
