.widget-dashboard {
    padding: 16px 20px 40px;
    background: #f8fafc;
    min-height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.widget-dashboard__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.widget-dashboard [hidden] {
    display: none !important;
}

.widget-dashboard__header h1 {
    margin: 0;
    color: #0f172a;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.widget-dashboard__header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13.5px;
    font-weight: 500;
}

.widget-dashboard__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.widget-dashboard__button {
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid #1d4ed8;
    border-radius: 3px;
    background: #2563eb;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.widget-dashboard__button--secondary {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #334155;
}

.widget-dashboard__button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.widget-dashboard__save-status {
    min-width: 110px;
    color: #64748b;
    font-size: 12px;
    text-align: right;
}

.widget-dashboard__save-status[data-status='error'] {
    color: #b91c1c;
}

.widget-dashboard__save-status[data-status='saved'] {
    color: #15803d;
}

.widget-dashboard__notice {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #f59e0b;
    border-radius: 3px;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
}

.widget-dashboard__catalog {
    margin-bottom: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.widget-dashboard__catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.widget-dashboard__catalog-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
}

.widget-dashboard__catalog-header button {
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 22px;
}

.widget-dashboard__catalog-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px 14px;
}

.widget-dashboard__catalog-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 650;
}

.widget-dashboard__catalog-item img {
    width: 18px;
    height: 18px;
}

.widget-dashboard__catalog-empty {
    margin: 3px 0;
    color: #64748b;
    font-size: 13px;
}

.widget-dashboard__grid {
    margin: -7px;
}

.dashboard-widget {
    position: relative;
    height: calc(100% - 14px);
    min-height: 0;
    margin: 7px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.05);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dashboard-widget[data-widget-select-url] {
    cursor: pointer;
}

.widget-dashboard--editing .dashboard-widget[data-widget-select-url] {
    cursor: default;
}

.widget-dashboard__item--selected .dashboard-widget {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16), 0 2px 5px rgba(15, 23, 42, 0.05);
}

.widget-dashboard__grid > .grid-stack-item > .grid-stack-item-content.dashboard-widget {
    overflow-x: hidden;
    overflow-y: hidden;
}

.dashboard-widget::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #64748b;
}

.dashboard-widget--danger::before {
    background: #dc2626;
}

.dashboard-widget--warning::before {
    background: #d97706;
}

.dashboard-widget--info::before {
    background: #2563eb;
}

.dashboard-widget--success::before {
    background: #16a34a;
}

.dashboard-widget__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 14px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-widget__heading {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-widget__icon {
    display: flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 3px;
    background: #f1f5f9;
}

.dashboard-widget__icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.dashboard-widget__header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 15px;
    font-weight: 750;
    white-space: normal;
}

.dashboard-widget__header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: normal;
}

.dashboard-widget__body {
    min-height: 112px;
    padding: 6px 16px 4px 20px;
}

.dashboard-widget__summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}

.dashboard-widget__summary > div {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
}

.dashboard-widget__summary strong {
    color: #0f172a;
    font-size: 21px;
    line-height: 1;
}

.dashboard-widget__scope {
    overflow: hidden;
    color: #64748b;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-widget__items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-widget__items li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 25px;
    border-top: 1px solid #f1f5f9;
}

.dashboard-widget__item-main,
.dashboard-widget__date {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.dashboard-widget__item-main strong,
.dashboard-widget__item-main small,
.dashboard-widget__date small,
.dashboard-widget__date time {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-widget__item-main strong {
    color: #0f172a;
    font-size: 11.5px;
}

.dashboard-widget__item-main small,
.dashboard-widget__date small {
    color: #94a3b8;
    font-size: 9.5px;
}

.dashboard-widget__date {
    flex: 0 0 auto;
    align-items: flex-end;
}

.dashboard-widget__date time {
    color: #475569;
    font-size: 11px;
    font-weight: 650;
}

.dashboard-widget__link {
    display: inline-block;
    margin-top: 2px;
    color: #2563eb;
    font-size: 10.5px;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-widget__link:hover {
    text-decoration: underline;
}

.dashboard-widget__data-empty {
    min-height: 42px;
    margin: 10px 0 0;
    color: #64748b;
    font-size: 12px;
}

.dashboard-widget[data-widget-density='compact'] .dashboard-widget__header {
    gap: 9px;
    padding: 12px 14px 9px 17px;
}

.dashboard-widget[data-widget-density='compact'] .dashboard-widget__header p,
.dashboard-widget[data-widget-density='compact'] .dashboard-widget__scope,
.dashboard-widget[data-widget-density='compact'] .dashboard-widget__items li:nth-child(n + 2) {
    display: none;
}

.dashboard-widget[data-widget-density='compact'] .dashboard-widget__body {
    min-height: 0;
    padding: 7px 14px 4px 17px;
}

.dashboard-widget[data-widget-density='compact'] .dashboard-widget__data-empty {
    min-height: 24px;
    margin-top: 7px;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__header {
    align-items: center;
    gap: 8px;
    padding: 9px 12px 3px 15px;
    border-bottom: 0;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__icon {
    flex-basis: 27px;
    width: 27px;
    height: 27px;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__icon img {
    width: 16px;
    height: 16px;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__header h2 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.2;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__header p,
.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__scope,
.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__items,
.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__link,
.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__data-empty,
.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__summary > div > span {
    display: none;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__body {
    min-height: 0;
    padding: 1px 12px 7px 15px;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__summary {
    margin: 0;
}

.dashboard-widget[data-widget-density='minimal'] .dashboard-widget__summary strong {
    font-size: 18px;
}

.dashboard-widget[data-widget-columns='1'] .dashboard-widget__header {
    gap: 0;
    padding: 7px 7px 1px 10px;
}

.dashboard-widget[data-widget-columns='1'] .dashboard-widget__icon {
    display: none;
}

.dashboard-widget[data-widget-columns='1'] .dashboard-widget__header h2 {
    font-size: 11px;
    line-height: 1.12;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 3;
}

.dashboard-widget[data-widget-columns='1'] .dashboard-widget__body {
    padding: 1px 7px 5px 10px;
}

.dashboard-widget[data-widget-columns='1'] .dashboard-widget__summary strong {
    font-size: 16px;
}

.widget-dashboard--editing .dashboard-widget[data-widget-columns='1'] .dashboard-widget__heading {
    padding-right: 20px;
}

.widget-dashboard--editing .dashboard-widget[data-widget-columns='1'] .dashboard-widget__hide {
    position: absolute;
    top: 4px;
    right: 3px;
    width: 20px;
    height: 20px;
    margin: 0;
    font-size: 15px;
}

.dashboard-widget__hide {
    display: none;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    margin: 1px -5px 0 0;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.widget-dashboard--editing .dashboard-widget__hide {
    display: block;
}

.widget-dashboard--editing .dashboard-widget__header {
    cursor: move;
}

.widget-dashboard--editing .grid-stack-item {
    outline: 1px dashed rgba(37, 99, 235, 0.45);
    outline-offset: -7px;
}

.dashboard-widget__placeholder,
.widget-dashboard__empty {
    color: #64748b;
    font-size: 13px;
    overflow-wrap: anywhere;
    text-align: center;
    white-space: normal;
}

.widget-dashboard__empty {
    padding: 36px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
}

.widget-dashboard__results {
    min-height: 118px;
    margin-top: 22px;
    scroll-margin-top: 18px;
    border: 1px solid #dbe3ee;
    border-radius: 3px;
    background: #ffffff;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 220ms ease;
}

.widget-dashboard__results--loading {
    pointer-events: none;
    opacity: 0.55;
    transform: translateY(4px);
}

.widget-dashboard__results--entering {
    opacity: 0;
    transform: translateY(8px);
}

.widget-dashboard__results-placeholder {
    padding: 26px 22px;
    text-align: center;
}

.widget-dashboard__results-placeholder h2,
.widget-dashboard__results-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
}

.widget-dashboard__results-placeholder p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
}

.widget-dashboard__results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.widget-dashboard__results-header span {
    display: block;
    margin-bottom: 2px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.widget-dashboard__results-header a {
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.widget-dashboard__results-header a:hover {
    color: #1d4ed8;
}

.widget-dashboard__results-table {
    padding: 0 12px 14px;
}

.widget-dashboard__results-table .default-table-header-area {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-widget,
    .widget-dashboard__results {
        transition: none;
    }
}

@media (max-width: 680px) {
    .widget-dashboard {
        padding: 12px 10px 28px;
    }

    .widget-dashboard__header {
        display: block;
    }

    .widget-dashboard__toolbar {
        justify-content: flex-start;
        margin-top: 14px;
    }

    .widget-dashboard__save-status {
        flex-basis: 100%;
        min-width: 0;
        text-align: left;
    }

    .widget-dashboard__results-header {
        align-items: flex-start;
        padding: 12px;
    }

    .widget-dashboard__results-table {
        padding: 0 4px 10px;
    }
}
