* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body.a-body {
    margin: 0;
    min-width: 320px;
    background: var(--d-bg);
    color: var(--d-text);
    font-family: var(--d-body-font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.icon { width: 18px; height: 18px; flex: none; }
.icon--sm { width: 16px; height: 16px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 2px solid var(--d-primary); outline-offset: 2px; }

.a-shell { display: flex; flex-direction: column; min-height: 100vh; }

.a-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 20px;
    background: var(--d-surface);
    border-bottom: 1px solid var(--d-line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.a-top__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.a-top__logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--d-radius-s); background: var(--d-primary); color: var(--d-primary-ink); font-weight: 900; font-size: 17px; flex: none; }
.a-top__brand strong { display: block; font-size: 15.5px; letter-spacing: -0.01em; }
.a-top__brand small { display: block; color: var(--d-muted); font-size: 12px; }

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

.a-user { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--d-muted); font-weight: 600; }
.a-user__avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--d-accent-soft); color: var(--d-accent); font-weight: 800; font-size: 12.5px; }

.a-live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--d-muted); }
.a-live__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--d-muted); }
.a-live.is-running .a-live__dot { background: var(--d-accent); animation: a-pulse 1s infinite; }
.a-live.is-running { color: var(--d-accent); }
.a-live.is-done .a-live__dot { background: var(--d-primary); }
.a-live.is-done { color: var(--d-primary); }

@keyframes a-pulse { 50% { opacity: 0.35; } }

.a-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--d-radius-s);
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}

.a-btn:hover { opacity: 0.9; }
.a-btn--primary { background: var(--d-primary); color: var(--d-primary-ink); }
.a-btn--ghost { background: transparent; border-color: var(--d-line); color: var(--d-text); }
.a-btn--ghost:hover { border-color: var(--d-primary); color: var(--d-primary); }
.a-btn--danger { background: transparent; border-color: transparent; color: #e5484d; }
.a-btn--small { padding: 6px 11px; font-size: 12.5px; }
.a-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.a-frame { display: flex; flex: 1; min-height: 0; }

.a-side {
    flex: none;
    width: 224px;
    padding: 16px 12px;
    background: var(--d-surface);
    border-right: 1px solid var(--d-line);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.a-side__item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 11px 13px;
    border: 0;
    border-radius: var(--d-radius-s);
    background: transparent;
    color: var(--d-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.a-side__item:hover { background: var(--d-surface-alt); color: var(--d-text); }
.a-side__item.is-active { background: var(--d-primary-soft); color: var(--d-primary); }

.a-side__note { margin: auto 4px 6px; font-size: 11.5px; color: var(--d-muted); line-height: 1.6; }

.a-main { flex: 1; min-width: 0; padding: 24px; overflow-x: hidden; }
.a-main--full { padding: 24px clamp(16px, 3vw, 34px); }

.a-screen__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.a-screen__head h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.01em; }
.a-screen__head p { margin: 0; color: var(--d-muted); font-size: 13px; }
.a-screen__tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.a-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }

.a-kpi { padding: 18px 20px; background: var(--d-surface); border: 1px solid var(--d-line); border-radius: var(--d-radius-s); }
.a-kpi__label { margin: 0 0 8px; font-size: 12px; color: var(--d-muted); font-weight: 700; }
.a-kpi__value { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -0.02em; font-family: var(--d-heading-font); }
.a-kpi__delta { margin: 6px 0 0; font-size: 12px; font-weight: 700; }
.a-kpi__delta.is-up { color: #2f9e44; }
.a-kpi__delta.is-down { color: #e5484d; }
.a-kpi__delta.is-flat { color: var(--d-muted); }

.a-panel { background: var(--d-surface); border: 1px solid var(--d-line); border-radius: var(--d-radius-s); margin-bottom: 20px; overflow: hidden; }
.a-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--d-line); flex-wrap: wrap; }
.a-panel__head h2 { margin: 0; font-size: 15px; }
.a-panel__head p { margin: 0; font-size: 12px; color: var(--d-muted); }
.a-panel__body { padding: 18px; }
.a-panel__body--flush { padding: 0; }

.a-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.a-input, .a-select {
    padding: 9px 12px;
    border: 1px solid var(--d-line);
    border-radius: var(--d-radius-s);
    background: var(--d-bg);
    color: var(--d-text);
    font: inherit;
    font-size: 13.5px;
}

.a-input:focus, .a-select:focus { outline: 2px solid var(--d-primary); outline-offset: 0; }
.a-input--search { min-width: 200px; }

.a-table-wrap { overflow-x: auto; }

.a-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.a-table th { padding: 11px 16px; text-align: left; font-size: 12px; color: var(--d-muted); font-weight: 700; border-bottom: 1px solid var(--d-line); background: var(--d-surface-alt); white-space: nowrap; }
.a-table td { padding: 12px 16px; border-bottom: 1px solid var(--d-line); vertical-align: middle; }
.a-table tbody tr:hover { background: var(--d-primary-soft); }
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.a-table .is-strong { font-weight: 700; }

.a-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--d-surface-alt); color: var(--d-muted); white-space: nowrap; }
.a-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.a-badge--blue { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.a-badge--green { background: rgba(47, 158, 68, 0.14); color: #2f9e44; }
.a-badge--amber { background: rgba(240, 140, 0, 0.14); color: #e8590c; }
.a-badge--red { background: rgba(229, 72, 77, 0.13); color: #e5484d; }
.a-badge--violet { background: rgba(139, 92, 246, 0.14); color: #8b5cf6; }
.a-badge--gray { background: var(--d-surface-alt); color: var(--d-muted); }

.a-empty { padding: 54px 20px; text-align: center; color: var(--d-muted); font-size: 13.5px; }

.a-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

.a-chart { width: 100%; }
.a-chart svg { display: block; width: 100%; height: auto; }
.a-chart .c-bar { fill: var(--d-primary); }
.a-chart .c-bar--soft { fill: var(--d-primary); opacity: 0.25; }
.a-chart .c-line { fill: none; stroke: var(--d-accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.a-chart .c-area { fill: var(--d-accent); opacity: 0.12; stroke: none; }
.a-chart .c-grid { stroke: var(--d-line); stroke-width: 1; }
.a-chart .c-label { fill: var(--d-muted); font-size: 10.5px; font-family: var(--d-body-font); }
.a-chart .c-value { fill: var(--d-text); font-size: 10.5px; font-weight: 700; font-family: var(--d-body-font); }
.a-chart .c-donut-track { stroke: var(--d-surface-alt); }
.a-chart .c-donut-value { stroke: var(--d-primary); }

.a-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--d-muted); }
.a-legend li { display: inline-flex; align-items: center; gap: 7px; }
.a-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--d-primary); }
.a-legend li:nth-child(2) i { background: var(--d-accent); }
.a-legend li:nth-child(3) i { background: var(--d-muted); }

.a-progress { height: 8px; border-radius: 999px; background: var(--d-surface-alt); overflow: hidden; }
.a-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--d-primary), var(--d-accent)); transition: width 0.3s ease; }

.a-log { margin: 0; padding: 14px 16px; list-style: none; background: var(--d-bg); border-radius: var(--d-radius-s); border: 1px solid var(--d-line); font-size: 12.5px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; display: grid; gap: 7px; max-height: 230px; overflow-y: auto; }
.a-log li { display: flex; gap: 10px; color: var(--d-muted); }
.a-log time { color: var(--d-primary); flex: none; font-weight: 700; }
.a-log li.is-ok { color: var(--d-text); }
.a-log li.is-warn { color: #e8590c; }

.a-kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }

.a-lane { background: var(--d-surface-alt); border: 1px solid var(--d-line); border-radius: var(--d-radius-s); min-width: 220px; display: flex; flex-direction: column; }
.a-lane__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-size: 13px; font-weight: 800; }
.a-lane__count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--d-surface); font-size: 11.5px; color: var(--d-muted); }
.a-lane__body { display: flex; flex-direction: column; gap: 8px; padding: 0 10px 12px; min-height: 60px; }

.a-card { padding: 13px 14px; background: var(--d-surface); border: 1px solid var(--d-line); border-radius: var(--d-radius-s); text-align: left; font: inherit; cursor: pointer; transition: border-color 0.15s, transform 0.15s; color: var(--d-text); }
.a-card:hover { border-color: var(--d-primary); transform: translateY(-1px); }
.a-card strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.a-card small { display: block; color: var(--d-muted); font-size: 12px; }
.a-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.a-card__amount { font-size: 12.5px; font-weight: 800; color: var(--d-primary); }

.a-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.a-cal__dow { text-align: center; font-size: 11.5px; color: var(--d-muted); font-weight: 700; padding: 4px 0; }
.a-cal__day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 9px 4px 7px;
    border: 1px solid var(--d-line);
    border-radius: var(--d-radius-s);
    background: var(--d-surface);
    color: var(--d-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    min-height: 52px;
}
.a-cal__day:hover { border-color: var(--d-primary); }
.a-cal__day.is-empty { visibility: hidden; }
.a-cal__day.is-selected { background: var(--d-primary); color: var(--d-primary-ink); border-color: var(--d-primary); font-weight: 800; }
.a-cal__day.is-today { border-color: var(--d-accent); }
.a-cal__dots { display: flex; gap: 3px; }
.a-cal__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--d-accent); }
.a-cal__day.is-selected .a-cal__dots i { background: var(--d-primary-ink); }

.a-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.a-slot { padding: 10px 8px; border: 1px solid var(--d-line); border-radius: var(--d-radius-s); background: var(--d-surface); color: var(--d-text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-align: center; }
.a-slot:hover { border-color: var(--d-primary); color: var(--d-primary); }
.a-slot.is-booked { background: var(--d-surface-alt); color: var(--d-muted); cursor: not-allowed; text-decoration: line-through; font-weight: 500; }
.a-slot.is-selected { background: var(--d-primary); border-color: var(--d-primary); color: var(--d-primary-ink); }

.a-form { display: grid; gap: 14px; }
.a-form__row { display: grid; gap: 6px; }
.a-form__row label { font-size: 12.5px; font-weight: 700; color: var(--d-muted); }
.a-form__row input, .a-form__row select, .a-form__row textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--d-line);
    border-radius: var(--d-radius-s);
    background: var(--d-bg);
    color: var(--d-text);
    font: inherit;
    font-size: 14px;
}
.a-form__row input:focus, .a-form__row select:focus, .a-form__row textarea:focus { outline: 2px solid var(--d-primary); outline-offset: 0; }
.a-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.a-form__error { margin: 0; font-size: 12.5px; color: #e5484d; font-weight: 700; }

.a-summary { display: grid; gap: 10px; padding: 16px 18px; background: var(--d-surface-alt); border-radius: var(--d-radius-s); }
.a-summary div { display: flex; justify-content: space-between; gap: 14px; font-size: 13.5px; }
.a-summary dt { color: var(--d-muted); }
.a-summary dd { margin: 0; font-weight: 700; }
.a-summary .is-total { padding-top: 10px; border-top: 1px solid var(--d-line); font-size: 15px; }
.a-summary .is-total dd { color: var(--d-primary); font-weight: 900; }

.a-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; }
.a-modal[hidden] { display: none; }
.a-modal__backdrop { position: absolute; inset: 0; background: rgba(8, 8, 12, 0.6); backdrop-filter: blur(3px); }
.a-modal__box {
    position: relative;
    width: min(520px, 100%);
    max-height: min(84vh, 720px);
    overflow-y: auto;
    background: var(--d-surface);
    border: 1px solid var(--d-line);
    border-radius: var(--d-radius-s);
    padding: 24px;
    box-shadow: var(--d-shadow);
}
.a-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.a-modal__head h2 { margin: 0; font-size: 17px; }
.a-modal__close { border: 0; background: transparent; color: var(--d-muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.a-modal__close:hover { color: var(--d-text); background: var(--d-surface-alt); }
.a-modal__actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.a-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(16px);
    z-index: 140;
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--d-text);
    color: var(--d-bg);
    font-size: 13.5px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    max-width: calc(100vw - 40px);
    text-align: center;
}
.a-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.a-detail { display: grid; gap: 12px; }
.a-detail div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; font-size: 13.5px; }
.a-detail dt { color: var(--d-muted); font-weight: 600; }
.a-detail dd { margin: 0; font-weight: 600; }

.a-source { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--d-line); border-radius: var(--d-radius-s); background: var(--d-surface); }
.a-source__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--d-primary-soft); color: var(--d-primary); font-weight: 800; font-size: 13px; flex: none; }
.a-source__body { flex: 1; min-width: 0; }
.a-source__body strong { display: block; font-size: 13px; }
.a-source__body small { color: var(--d-muted); font-size: 11.5px; }
.a-sources { display: grid; gap: 8px; }

.d-watermark {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 9px 9px 16px;
    border-radius: 999px;
    background: rgba(25, 31, 40, 0.94);
    color: #ffffff;
    box-shadow: 0 12px 32px rgba(2, 9, 40, 0.24);
    font-size: 12.5px;
}

.d-watermark__brand { font-weight: 700; }
.d-watermark a { padding: 8px 14px; border-radius: 999px; background: #3182f6; color: #ffffff; font-weight: 700; white-space: nowrap; }
.d-watermark a:hover { background: #1b64da; }

body.d-skin-minimal { --d-radius-s: 3px; }
.d-skin-minimal .a-panel, .d-skin-minimal .a-kpi { box-shadow: none; }

body.d-skin-editorial { --d-radius-s: 0px; }
.d-skin-editorial .a-top { border-bottom-width: 2px; }
.d-skin-editorial .a-panel__head h2 { font-family: var(--d-heading-font); }

body.d-skin-bold { --d-radius-s: 0px; }
.d-skin-bold .a-panel, .d-skin-bold .a-kpi { border-width: 2px; border-color: var(--d-text); }
.d-skin-bold .a-btn--primary { box-shadow: 3px 3px 0 var(--d-text); }
.d-skin-bold .a-kpi__value { font-weight: 900; }

body.d-skin-glow { background: radial-gradient(circle at 82% -8%, var(--d-primary-soft), transparent 34rem), var(--d-bg); }
.d-skin-glow .a-panel, .d-skin-glow .a-kpi { background: color-mix(in srgb, var(--d-surface) 78%, transparent); backdrop-filter: blur(10px); border-color: color-mix(in srgb, var(--d-primary) 24%, transparent); }
.d-skin-glow .a-btn--primary { background: linear-gradient(120deg, var(--d-primary), var(--d-accent)); box-shadow: 0 0 20px var(--d-primary-soft); }
.d-skin-glow .a-kpi__value { color: var(--d-primary); }

body.d-skin-classic .a-btn { letter-spacing: 0.08em; }
.d-skin-classic .a-panel__head { background: var(--d-surface-alt); }

@media (max-width: 960px) {
    .a-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .a-grid-2 { grid-template-columns: 1fr; }
    .a-kanban { grid-template-columns: repeat(4, minmax(230px, 1fr)); }
}

@media (max-width: 760px) {
    .a-frame { flex-direction: column; }
    .a-side { width: 100%; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--d-line); padding: 10px 12px; }
    .a-side__item { width: auto; white-space: nowrap; }
    .a-side__note { display: none; }
    .a-main { padding: 16px 14px 90px; }
    .a-top { flex-wrap: wrap; }
    .a-user { display: none; }
    .a-form__grid { grid-template-columns: 1fr; }
    .a-kpis { grid-template-columns: 1fr 1fr; }
    .d-watermark { left: 16px; right: 16px; justify-content: space-between; }
}
