* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f5f7;
    color: #1f2329;
    font-size: 19px;
    --accent: #3498db;
    --accent-hover: #2f88c5;
    --header: #2c3e50;
}
/* цветовые схемы */
.theme-blue   { --accent:#3498db; --accent-hover:#2f88c5; --header:#2c3e50; }
.theme-teal   { --accent:#1abc9c; --accent-hover:#16a085; --header:#15403a; }
.theme-green  { --accent:#27ae60; --accent-hover:#1e8a4c; --header:#1e3d2b; }
.theme-olive  { --accent:#909a3c; --accent-hover:#79822f; --header:#383b1d; }
.theme-purple { --accent:#9b59b6; --accent-hover:#8e44ad; --header:#382a45; }
.theme-orange { --accent:#e67e22; --accent-hover:#cf6f12; --header:#43301c; }
.theme-red    { --accent:#e74c3c; --accent-hover:#c0392b; --header:#43221d; }
/* фоновое изображение body (карточки и шапка перекрывают его своими фонами) */
body.has-bg { background-size: cover; background-position: center; background-attachment: fixed; }
header {
    background: var(--header, #2c3e50);
    color: #fff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.brand { font-weight: 700; font-size: 22px; padding: 14px 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
    color: #cdd6e0;
    text-decoration: none;
    padding: 16px 12px;
    font-size: 17px;
}
nav a:hover { color: #fff; }
nav a.active { color: #fff; box-shadow: inset 0 -3px 0 var(--accent, #3498db); }
/* выпадающий пункт меню (Словари) */
.nav-item { position: relative; }
.nav-toggle { display: inline-block; color: #cdd6e0; padding: 16px 12px; font-size: 17px; cursor: default; user-select: none; }
.nav-item:hover .nav-toggle { color: #fff; }
.nav-item.active .nav-toggle { color: #fff; box-shadow: inset 0 -3px 0 var(--accent, #3498db); }
.nav-sub {
    position: absolute; top: 100%; left: 0;
    min-width: 190px;
    background: var(--header, #2c3e50);
    box-shadow: 0 8px 16px rgba(0, 0, 0, .28);
    border-radius: 0 0 8px 8px;
    display: none;
    z-index: 60;
}
.nav-item:hover .nav-sub { display: block; }
.nav-sub a { display: block; padding: 12px 16px; color: #cdd6e0; font-size: 16px; text-decoration: none; box-shadow: none; }
.nav-sub a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-sub a.active { color: #fff; box-shadow: inset 3px 0 0 var(--accent, #3498db); }
main { max-width: 1560px; margin: 24px auto; padding: 0 24px; }
h1 {
    font-size: 26px;
    margin: 0 0 16px;
    display: block;
    background: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
h2 { font-size: 19px; margin: 24px 0 12px; }
/* сворачиваемые/перетаскиваемые блоки дашборда */
.block-head { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.block-head h2 { margin: 0; flex: 1; }
.drag-handle { cursor: grab; color: #aab4bf; font-size: 18px; line-height: 1; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.collapse-toggle { cursor: pointer; color: #6b7785; font-size: 16px; user-select: none; padding: 0 4px; transition: transform .15s; }
.dash-block .block-body { margin-top: 12px; }
.dash-block.collapsed .block-body { display: none; }
.dash-block.collapsed .collapse-toggle { transform: rotate(-90deg); }
.block-ghost { opacity: .4; }
.card {
    background: rgba(255, 255, 255, var(--content-alpha, 1));
    backdrop-filter: blur(3px);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 18px;
}
.card-sep {
    border: 0;
    border-top: 1px solid #e6e9ee;
    margin: 18px 0 14px;
}
.banner {
    background: #e8f4ff;
    background: color-mix(in srgb, var(--accent, #3498db) 13%, #fff);
    border: 1px solid #b6dcff;
    border: 1px solid color-mix(in srgb, var(--accent, #3498db) 35%, #fff);
    color: #1d4e7a;
    color: color-mix(in srgb, var(--accent, #3498db) 55%, #10242f);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eceef0; font-size: 17px; vertical-align: top; }
th { color: #4f5b67; font-weight: 600; font-size: 14px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
.dash-table { table-layout: fixed; }
.dash-table th:nth-child(1), .dash-table td:nth-child(1) { width: 40%; }
.dash-table th:nth-child(2), .dash-table td:nth-child(2) { width: 40%; }
.dash-table th:nth-child(3), .dash-table td:nth-child(3) { width: 20%; }
.dash-table td { overflow: hidden; text-overflow: ellipsis; }
label { display: block; font-size: 16px; color: #45505d; margin: 10px 0 4px; }
input[type=text], input[type=date], input[type=number], input[type=password], textarea, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d2d8de;
    border-radius: 6px;
    font-size: 17px;
    font-family: inherit;
    background: #fff;
}
textarea { min-height: 64px; resize: vertical; }
.fab-quick { position: fixed; right: 24px; bottom: 24px; z-index: 900; }
.fab-btn {
    width: 56px; height: 56px; border-radius: 50%; padding: 0; cursor: pointer;
    background: #fff; border: 3px solid var(--accent, #3498db); color: #f5b400;
    box-shadow: 0 4px 14px rgba(0,0,0,.22);
    display: flex; align-items: center; justify-content: center;
    transition: box-shadow .2s, transform .15s;
}
.fab-btn svg { width: 27px; height: 27px; }
.fab-btn:hover { box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.fab-quick.open .fab-btn { transform: scale(.94); }
.fab-panel {
    position: absolute; right: 0; bottom: 68px;
    width: 416px; max-width: calc(100vw - 36px);
    background: #fff; border-radius: 10px; padding: 14px;
    border: 1px solid #e6e9ee; box-shadow: 0 8px 30px rgba(0,0,0,.22);
}
.fab-panel input { margin: 0; }
.fab-panel .muted { margin: 8px 0 10px; font-size: 13px; }
.fab-panel .btn { margin: 0; width: 100%; }
.pw-field { position: relative; }
.pw-field input { padding-right: 42px; }
.pw-toggle {
    position: absolute; top: 0; right: 0; height: 100%; width: 42px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
    color: #8a93a0;
}
.pw-toggle:hover { color: var(--accent, #3498db); }
.pw-toggle svg { width: 19px; height: 19px; display: block; }
.pw-toggle .i-eye-off { display: none; }
.pw-toggle.on .i-eye { display: none; }
.pw-toggle.on .i-eye-off { display: block; }
select[multiple] { height: auto; min-height: 90px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1; min-width: 160px; }
.row > div.narrow { flex: 0 0 120px; min-width: 0; }
.subhead { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: #4f5b67; font-weight: 700; margin: 24px 0 6px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.form-actions .btn { margin-top: 0; }
.spoiler > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 18px;
    color: #2c3e50;
    list-style: none;
    user-select: none;
    padding: 2px 0;
}
.spoiler > summary::-webkit-details-marker { display: none; }
.spoiler > summary:hover { color: #2f7bbd; }
.filterbar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filterbar > div { min-width: 220px; }
.filterbar label { margin-top: 0; }
.tasks-table th:nth-child(4), .tasks-table td:nth-child(4) { min-width: 240px; }
.ttag {
    display: inline-block;
    background: #eef4fb;
    background: color-mix(in srgb, var(--accent, #3498db) 12%, #fff);
    color: var(--accent, #3498db);
    border: 1px solid var(--accent, #3498db);
    border-radius: 11px;
    padding: 1px 9px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .02em;
    margin: 4px 5px 0 0;
}
.vac-warn {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #fff3cd;
    border: 1px solid #ffcf66;
    border-left: 6px solid #e67e22;
    color: #8a4b00;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(230, 126, 34, .22);
}
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.pager .btn.sm { margin: 0; }
.btn {
    display: inline-block;
    background: var(--accent, #3498db);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 17px;
    cursor: pointer;
    text-decoration: none;
    margin-top: 12px;
}
.btn:hover { background: var(--accent-hover, #2f88c5); }
.btn.gray { background: #1abc9c; }            /* вторичное действие — бирюзовый */
.btn.gray:hover { background: #15a589; }
.btn.success { background: #2ecc71; }
.btn.success:hover { background: #27ae60; }
.btn.warn { background: #f39c12; }
.btn.warn:hover { background: #e08e0b; }
.btn.danger { background: #e74c3c; color: #fff; }   /* удаление — красный заливкой */
.btn.danger:hover { background: #d0392b; }
.btn.sm { padding: 5px 10px; font-size: 16px; margin: 0; }
.btn.icon {
    width: 34px; height: 34px; padding: 0; margin: 0;
    display: inline-flex; align-items: center; justify-content: center;
    vertical-align: middle; font-size: 17px; line-height: 1;
}
.btn.icon svg { width: 17px; height: 17px; display: block; }
.actions { display: flex; gap: 6px; align-items: center; }
.inline { display: inline; }
.muted { color: #55626f; font-size: 16px; }
.task-meta { color: #3f4b57; font-size: 16px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 14px; font-weight: 600; }
.badge.overdue { background: #fdecea; color: #c0392b; }
.badge.soon { background: #fff4e0; color: #b9770e; }
.badge.ok { background: #e8f6ee; color: #1e8449; }
.badge.done { background: #eceef0; color: #6b7785; }
.done-row td { color: #9aa5b1; text-decoration: line-through; }
.today-row td { background: #eef4fb; background: color-mix(in srgb, var(--accent, #3498db) 15%, transparent); }
.today-row td:first-child { box-shadow: inset 4px 0 0 var(--accent, #3498db); }
a { color: var(--accent-hover, #2f7bbd); }
.tag { background: #eef1f4; border-radius: 4px; padding: 1px 6px; font-size: 14px; margin-right: 4px; display: inline-block; }
.linkbtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 9px;
    font-size: 14px;
    line-height: 1.6;
    color: #1f6fb2;
    text-decoration: none;
    background: #e1f0fb;
    border: 1px solid #b6d8f0;
    border-radius: 20px;
    vertical-align: middle;
    white-space: nowrap;
}
.linkbtn:hover { background: #cfe6f8; border-color: #9bc8ea; }
/* выбор цветовой схемы */
.themes { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 4px; }
.themes label { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; margin: 0; font-size: 14px; color: #4f5b67; }
.themes input { display: none; }
.swatch { width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px #d2d8de; transition: transform .1s; }
.themes label:hover .swatch { transform: scale(1.08); }
.themes input:checked + .swatch { border-color: #1f2329; box-shadow: 0 0 0 1px #1f2329; }
.sw-blue { background: #3498db; }
.sw-teal { background: #1abc9c; }
.sw-green { background: #27ae60; }
.sw-olive { background: #909a3c; }
.sw-purple { background: #9b59b6; }
.sw-orange { background: #e67e22; }
.sw-red { background: #e74c3c; }
/* выбор фонового изображения */
.bg-grid { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 4px; }
.bg-item { position: relative; cursor: pointer; margin: 0; }
.bg-item input { display: none; }
.bg-thumb {
    display: flex; align-items: center; justify-content: center;
    width: 104px; height: 64px; border-radius: 8px;
    background-size: cover; background-position: center;
    border: 3px solid transparent; box-shadow: 0 0 0 1px #d2d8de;
    color: #55626f; font-size: 14px; text-align: center;
}
.bg-none { background: #eef1f4; }
.bg-plus {
    border: 2px dashed #b9c4cf;
    box-shadow: none;
    background: #f7f9fb;
    color: #8aa0b3;
    font-size: 41px;
    font-weight: 300;
}
.bg-item:hover .bg-plus { border-color: var(--accent, #3498db); color: var(--accent, #3498db); }
/* высота и шрифт контрола Tom Select — как у обычных полей */
.ts-wrapper .ts-control {
    min-height: 38px;
    padding: 0 10px;
    font-size: 17px;
    border: 1px solid #d2d8de;
    border-radius: 6px;
    box-sizing: border-box;
}
.ts-wrapper .ts-control, .ts-wrapper .ts-control > input { line-height: 34px !important; }
/* выбранные элементы в мультивыборе (Tom Select) — удобное удаление */
.ts-wrapper.multi .item {
    display: inline-flex; align-items: center;
    background: #e1f0fb; border: 1px solid #b6d8f0; border-radius: 6px;
    margin: 2px 4px 2px 0; color: #1f4d6e; line-height: 1.3;
}
.ts-wrapper.multi.plugin-remove_button .item { padding-right: 0 !important; }
.ts-wrapper.multi.plugin-remove_button .item .remove {
    color: #c0392b !important;
    font-size: 19px !important;
    font-weight: 700;
    line-height: 1;
    border-left: 1px solid #b6d8f0 !important;
    margin-left: 8px !important;
    padding: 3px 10px !important;
    border-radius: 0 5px 5px 0;
}
.ts-wrapper.multi.plugin-remove_button .item .remove:hover { background: #f5d7d4 !important; color: #a5281b !important; }
/* кнопка очистки одиночного списка — строго справа, видна при наличии значения */
.ts-wrapper.single.plugin-clear_button .ts-control { padding-right: 34px !important; }
.ts-wrapper.plugin-clear_button .clear-button {
    left: auto !important;
    right: 10px !important;
    opacity: 0;
    color: #c0392b;
    font-size: 20px;
    line-height: 1;
}
.ts-wrapper.plugin-clear_button.has-items .clear-button { opacity: 1; }
.ts-wrapper.plugin-clear_button .clear-button:hover { color: #a5281b; }
.bg-item input:checked + .bg-thumb { border-color: var(--accent, #3498db); box-shadow: 0 0 0 1px var(--accent, #3498db); }
.bg-del {
    position: absolute; top: -7px; right: -7px;
    width: 20px; height: 20px; line-height: 18px; padding: 0; text-align: center;
    border: none; border-radius: 50%; background: #e74c3c; color: #fff;
    font-size: 14px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.bg-del:hover { background: #c0392b; }
