:root {
    --bg-main: #f4f7ff;
    --bg-accent: #e9fbff;
    --text-main: #12323a;
    --text-muted: #4a6870;
    --primary: #22abc6;
    --primary-dark: #188ea5;
    --secondary: #6bd6de;
    --danger: #de5a71;
    --success: #22b887;
    --surface: #ffffff;
    --surface-border: #cfeff4;
    --shadow-soft: 0 12px 30px rgba(24, 112, 126, 0.14);
    --radius-lg: 22px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text-main);
    font-family: "Manrope", "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 10% -10%, rgba(34, 171, 198, 0.28), transparent 32%),
        radial-gradient(circle at 95% -20%, rgba(107, 214, 222, 0.26), transparent 30%),
        linear-gradient(180deg, #f4fcfe 0%, var(--bg-main) 100%);
    min-height: 100vh;
}

.container {
    width: min(1120px, 92%);
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    color: #fff;
    backdrop-filter: blur(8px);
    background: linear-gradient(90deg, #157e93, #1f9db5 50%, #22abc6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 24px rgba(21, 126, 147, 0.28);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
}

.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
    padding: 6px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.brand-logo {
    height: 44px;
    width: auto;
    display: block;
    vertical-align: middle;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topnav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 999px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.topnav a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

main.container {
    padding-bottom: 24px;
}

.card {
    margin: 22px 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.card h1,
.card h2 {
    margin-top: 0;
    letter-spacing: -0.01em;
}

.card p {
    color: var(--text-muted);
}

.narrow {
    width: min(580px, 100%);
}

.form-grid label {
    display: block;
    margin-bottom: 14px;
    font-weight: 700;
    color: #1d2d59;
}

.field-hint {
    margin: -4px 0 12px;
    font-size: 13px;
    color: #4a6870;
}

.field-hint code {
    background: #eef5f7;
    border-radius: 6px;
    padding: 1px 6px;
}

.chart-card .chart-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    color: #365d66;
    font-size: 14px;
}

.chart-card .chart-meta span {
    background: #f1fbfd;
    border: 1px solid #d2eff3;
    border-radius: 999px;
    padding: 6px 10px;
}

.chart-wrap {
    position: relative;
    width: min(100%, 700px);
    height: 430px;
    margin: 0 auto;
}

.chart-wrap-circle {
    width: min(100%, 560px);
    height: 560px;
}

.chart-wrap-wide {
    width: min(100%, 980px);
    height: 420px;
}

.day-progress-block + .day-progress-block {
    margin-top: 18px;
}

.day-progress-block h3 {
    margin: 0 0 6px;
}

.current-day-badge {
    display: inline-block;
    margin-left: 6px;
    color: #1a9d6b;
    font-weight: 700;
}

.day-summary {
    margin: 0 0 10px;
    font-size: 14px;
    color: #48666e;
}

.day-progress-table {
    table-layout: fixed;
    min-width: 670px;
}

.day-progress-table th:nth-child(1),
.day-progress-table td:nth-child(1) { width: 220px; min-width: 220px; }
.day-progress-table th:nth-child(2),
.day-progress-table td:nth-child(2) { width: 80px;  min-width: 80px;  }
.day-progress-table th:nth-child(3),
.day-progress-table td:nth-child(3) { width: 110px; min-width: 110px; }
.day-progress-table th:nth-child(4),
.day-progress-table td:nth-child(4) { width: 72px;  min-width: 72px;  }
.day-progress-table th:nth-child(5),
.day-progress-table td:nth-child(5) { width: 100px; min-width: 100px; }
.day-progress-table th:nth-child(6),
.day-progress-table td:nth-child(6) { width: 88px;  min-width: 88px;  }

/* Плавающий баннер результатов действий в задачах (админ) */
.admin-float-flash {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.admin-float-flash-inner {
    pointer-events: auto;
    background: #1b2838;
    color: #fff;
    border-radius: 999px;
    padding: 10px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    font-size: 14px;
    font-weight: 600;
    max-width: min(90vw, 420px);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.18);
}

.admin-float-flash-success {
    background: #1f8f5a;
}

.admin-float-flash-error {
    background: #c44747;
}

.admin-float-flash-info {
    background: #1b5fa8;
}

.admin-float-flash-warning {
    background: #c78432;
}

.admin-float-flash.is-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}

/* Главная: плавающие математические символы */
.home-page-wrap {
    position: relative;
}

.math-symbols-layer {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.math-symbols-layer .math-float-symbol {
    pointer-events: auto;
    position: absolute;
    font-size: clamp(38px, 8vw, 64px);
    font-family: "Open Sans", "Segoe UI", Arial, sans-serif;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    opacity: 0.9;
    animation: math-symbol-drift linear infinite;
    transition: transform 0.15s ease;
    -webkit-text-stroke: 0.5px currentColor;
}

.math-symbols-layer .math-float-symbol:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes math-symbol-drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    12% { transform: translate(18vw, -22vh) rotate(15deg); }
    25% { transform: translate(-25vw, 12vh) rotate(-18deg); }
    38% { transform: translate(15vw, 28vh) rotate(10deg); }
    52% { transform: translate(-20vw, -18vh) rotate(-12deg); }
    68% { transform: translate(28vw, 8vh) rotate(20deg); }
    82% { transform: translate(-15vw, -25vh) rotate(-8deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes math-symbol-drift-b {
    0% { transform: translate(0, 0) rotate(0deg); }
    15% { transform: translate(-28vw, 18vh) rotate(-20deg); }
    30% { transform: translate(22vw, -25vh) rotate(16deg); }
    48% { transform: translate(-18vw, -28vh) rotate(-10deg); }
    62% { transform: translate(25vw, 20vh) rotate(22deg); }
    78% { transform: translate(-22vw, 10vh) rotate(-14deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes math-symbol-drift-c {
    0% { transform: translate(0, 0) rotate(0deg); }
    18% { transform: translate(24vw, 24vh) rotate(12deg); }
    35% { transform: translate(-20vw, -22vh) rotate(-18deg); }
    55% { transform: translate(-22vw, 20vh) rotate(14deg); }
    72% { transform: translate(26vw, -15vh) rotate(-10deg); }
    88% { transform: translate(-18vw, -18vh) rotate(25deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.math-symbols-layer .math-float-particle {
    position: fixed;
    font-size: 12px;
    font-family: "Open Sans", "Segoe UI", Arial, sans-serif;
    font-weight: 700;
    pointer-events: none;
    margin-left: -0.5em;
    margin-top: -0.5em;
    opacity: 1;
    z-index: 1;
}

.math-symbols-layer .math-float-particle.math-particle-fly {
    animation: math-particle-fly 0.9s ease-out forwards;
}

@keyframes math-particle-fly {
    to {
        transform: translate(var(--dx), var(--dy)) scale(0.3);
        opacity: 0;
    }
}

.math-symbols-layer .math-spark {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    margin-left: -3px;
    margin-top: -3px;
}

.math-symbols-layer .math-spark.math-spark-fly {
    animation: math-spark-fly 0.8s ease-out forwards;
}

@keyframes math-spark-fly {
    to {
        transform: translate(var(--dx), var(--dy)) scale(0);
        opacity: 0;
    }
}

.home-card-above {
    position: relative;
    z-index: 1;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.theme-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 84px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 800;
    color: #ffffff;
    font-size: 18px;
    box-shadow: 0 12px 20px rgba(34, 171, 198, 0.23);
    text-align: center;
    padding: 10px;
}

.theme-button:hover { transform: translateY(-1px); }

.theme-fraction {
    background: linear-gradient(120deg, #22abc6, #28b7d0);
    box-shadow: 0 12px 20px rgba(34, 171, 198, 0.23);
}

.theme-fraction:hover {
    background: linear-gradient(120deg, #1892aa, #1da6be);
}

.theme-fsu {
    background: linear-gradient(120deg, #7b5bff, #6a4ef0);
    box-shadow: 0 12px 20px rgba(106, 78, 240, 0.24);
}

.theme-fsu:hover {
    background: linear-gradient(120deg, #6548dc, #583ed0);
}

.theme-divisibility {
    background: linear-gradient(120deg, #f39a29, #e88a1a);
    box-shadow: 0 12px 20px rgba(232, 138, 26, 0.24);
}

.theme-divisibility:hover {
    background: linear-gradient(120deg, #d77f15, #c5700f);
}

.waiting-illustration {
    width: min(100%, 270px);
    margin: 10px 0 14px 0;
}

.waiting-illustration img.waiting-illustration-img,
.waiting-illustration svg {
    width: 100%;
    height: auto;
    display: block;
}

.checkbox {
    display: flex !important;
    align-items: center;
    gap: 9px;
    font-weight: 600 !important;
}

.checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

input,
textarea,
button {
    width: 100%;
    margin-top: 7px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #bfe8ef;
    font-size: 15px;
    font-family: inherit;
}

input,
textarea {
    color: var(--text-main);
    background: #f8feff;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #22abc6;
    box-shadow: 0 0 0 3px rgba(34, 171, 198, 0.2);
}

button,
.button {
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    width: auto;
    color: #fff;
    font-weight: 700;
    border-radius: 12px;
    padding: 9px 14px;
    background: linear-gradient(90deg, var(--primary), #35bfd3);
    box-shadow: 0 6px 12px rgba(34, 171, 198, 0.26);
    transition: all 0.2s ease;
    font-size: 14px;
}

.button-large {
    padding: 11px 20px;
    font-size: 15px;
    min-width: 230px;
    text-align: center;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    background: linear-gradient(90deg, var(--primary-dark), #1ea0b8);
}

.secondary {
    background: linear-gradient(90deg, #4f8893, #427781);
}

.danger {
    background: linear-gradient(90deg, #de5a71, #c84f65);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 16px;
}

.current-day-label {
    margin: 0 0 8px;
    font-size: 14px;
    color: #48666e;
}

.current-day-chooser {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.current-day-form {
    margin: 0;
    display: inline;
}

.current-day-item {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #cce9ef;
    background: #f0fafc;
    color: #235862;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.current-day-form .current-day-item:hover {
    background: #e0f4f8;
    border-color: #22abc6;
}

.current-day-item.is-current {
    background: #e0f4e8;
    border-color: #1a9d6b;
    color: #1a9d6b;
    cursor: default;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 12px 0 16px;
}

.button-continue,
.button-solve {
    background: linear-gradient(90deg, #1a9d6b, #22b87a);
    box-shadow: 0 8px 20px rgba(26, 157, 107, 0.3);
}

.button-continue:hover,
.button-solve:hover {
    background: linear-gradient(90deg, #158558, #1a9d6b);
    box-shadow: 0 10px 24px rgba(26, 157, 107, 0.35);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-box {
    background: linear-gradient(125deg, #ecfbfd, #e5f7fa);
    border: 1px solid #c5eaf0;
    border-radius: var(--radius-md);
    padding: 14px;
    color: #1a4f5a;
}

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 14px;
    border: 1px solid #d4edf2;
    background: #fff;
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

table.score-table {
    table-layout: fixed;
    min-width: max-content;
}

table.score-table th,
table.score-table td {
    width: 78px;
    min-width: 78px;
}

table.score-table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
}

table.score-table th:first-child,
table.score-table td:first-child {
    width: 180px;
    min-width: 180px;
}

table.score-table th:nth-child(2),
table.score-table td:nth-child(2) {
    width: 78px;
    min-width: 78px;
}

th,
td {
    border: 1px solid #d9e9ec;
    padding: 12px;
    vertical-align: middle;
}

th {
    text-align: center;
    white-space: normal;
    line-height: 1.2;
}

td {
    text-align: left;
}

th {
    background: linear-gradient(180deg, #eefbfd, #e6f6f8);
    color: #235862;
    font-size: 0.92rem;
}

tr:hover td {
    background: #f5fdff;
}

.score-cell,
.score-total {
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
}

th.total-col,
td.total-col {
    background: #ffd7a3 !important;
    color: #7a3200;
    font-weight: 800;
}

.score-cell {
    position: relative;
    overflow: visible;
}

.score-value {
    display: inline-block;
    min-width: 24px;
}

.note-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    color: #1b7283;
    background: #dff6fa;
    border: 1px solid #b8e8f0;
    cursor: help;
    vertical-align: middle;
}

.note-tooltip-layer {
    display: none;
    position: fixed;
    z-index: 9999;
    min-width: 260px;
    max-width: calc(100vw - 24px);
    width: min(900px, calc(100vw - 24px));
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #173a42;
    color: #eafcff;
    border: 1px solid #2a6470;
    box-shadow: 0 10px 22px rgba(8, 34, 40, 0.35);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    line-height: 1.3;
    white-space: normal;
    opacity: 0;
    pointer-events: auto;
    max-height: min(70vh, 460px);
    overflow: auto;
}

.note-tooltip-layer::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 14px;
    border: 6px solid transparent;
    border-right-color: #173a42;
}

.note-tooltip-layer.tooltip-left::before {
    left: auto;
    right: -10px;
    border-right-color: transparent;
    border-left-color: #173a42;
}

.note-horizontal-layout {
    min-width: 240px;
}

.note-title {
    font-weight: 800;
    margin-bottom: 8px;
}

.note-task-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, max-content);
    gap: 10px;
    align-items: start;
    width: max-content;
    padding-right: 10px;
}

.note-task-block {
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(234, 252, 255, 0.22);
    line-height: 1.35;
    white-space: pre-line;
}

.note-total {
    margin-top: 8px;
    font-weight: 800;
}

.flash-wrap {
    margin-top: 18px;
}

.student-rule-banner {
    margin-top: 18px;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 700;
}

/* Alternative 1: brighter complementary coral */
.student-rule-banner.banner-bright {
    background: linear-gradient(90deg, #ffd6c7, #ffe5d8);
    color: #743021;
    box-shadow: 0 6px 14px rgba(181, 87, 57, 0.18);
}

/* Alternative 2: softer pastel peach */
.student-rule-banner.banner-pastel {
    background: linear-gradient(90deg, #d4ecff, #f0f8ff);
    color: #0b3450;
    box-shadow: 0 8px 18px rgba(20, 76, 118, 0.22);
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 8px 0;
    font-weight: 600;
    border: 1px solid transparent;
}

.student-success-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    pointer-events: none;
}

.student-success-overlay.is-visible {
    display: flex;
}

.student-success-dialog {
    pointer-events: auto;
    max-width: 420px;
    width: calc(100vw - 40px);
    border-radius: 999px;
    padding: 12px 20px;
    background: linear-gradient(90deg, #1f8f5a, #29b771);
    color: #ffffff;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 18px 40px rgba(6, 68, 36, 0.5);
    font-size: 14px;
}

.theme-dropdowns-wrap {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.theme-dropdown {
    position: absolute;
    display: none;
    pointer-events: auto;
}

.theme-dropdown.is-open {
    display: block;
}

.theme-dropdown-card {
    min-width: 260px;
    max-width: 340px;
    border-radius: 14px;
    padding: 10px 10px 8px;
    background: radial-gradient(circle at top left, #173e46, #0f262c);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color: #e9fdff;
}

.theme-dropdown-title {
    font-size: 14px;
    font-weight: 800;
    margin: 0 0 4px;
}

.theme-dropdown-item {
    display: block;
    padding: 6px 8px;
    border-radius: 9px;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.theme-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.theme-dropdown-item.is-disabled {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.theme-dropdown-label {
    font-weight: 700;
    font-size: 13px;
}

.theme-dropdown-caption {
    display: block;
    font-size: 11px;
    opacity: 0.9;
}

.flash-success {
    color: #0f5f4a;
    background: #dbfff4;
    border-color: #8fe8c9;
}

.flash-error {
    color: #8e2640;
    background: #ffe9ee;
    border-color: #ffc1cc;
}

.status {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.status.ok {
    background: #dafdf2;
    color: #0f8a66;
}

.status.bad {
    background: #ffe7ec;
    color: #b82d50;
}

.status.wait {
    background: #ecfbfd;
    color: #2f7e8c;
}

.inline-form {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 4px 4px 0;
    align-items: center;
}

.inline-form input,
.inline-form button {
    width: auto;
    margin-top: 0;
}

.inline-form input[name="new_code"] {
    width: 96px;
    min-width: 96px;
    text-align: center;
}

.inline-form input[name="full_name"] {
    width: 240px;
    min-width: 240px;
}

.students-actions {
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.students-actions .inline-form {
    margin: 2px 4px 2px 0;
    flex-wrap: nowrap;
}

.students-actions .icon-action {
    width: 40px;
    min-width: 40px;
    height: 40px;
}

.admin-tasks-table th,
.admin-tasks-table td {
    text-align: center;
    vertical-align: middle;
    border-top: none;
    border-bottom: none;
}

.admin-tasks-table th:nth-child(2),
.admin-tasks-table td:nth-child(2) {
    min-width: 260px;
    max-width: 320px;
    text-align: center;
    white-space: nowrap;
}

.admin-tasks-table th:nth-child(3),
.admin-tasks-table td:nth-child(3) {
    width: 110px;
    min-width: 110px;
}

.admin-tasks-table th:nth-child(6),
.admin-tasks-table td:nth-child(6) {
    width: 72px;
    min-width: 72px;
}

.admin-tasks-table td.cell-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding-left: 12px;
    padding-right: 12px;
}

.admin-tasks-table .inline-form {
    justify-content: center;
}

.task-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.task-actions .task-action-form {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin: 0;
    flex-shrink: 0;
    padding: 0;
}

.task-actions .task-action-form .icon-edit {
    height: 100%;
    width: 36px;
    min-width: 36px;
}

.task-actions .icon-edit,
.task-actions .icon-toggle,
.task-actions .icon-delete {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-family: inherit;
    line-height: 36px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.task-actions .icon-toggle {
    border: none;
}

.task-actions .icon-edit {
    background: linear-gradient(90deg, #1a9bad, #22abc6);
    box-shadow: 0 6px 14px rgba(24, 142, 158, 0.24);
    color: #fff;
    border: none;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.task-actions .icon-edit:hover {
    background: linear-gradient(90deg, #158192, #188ea5);
    box-shadow: 0 8px 18px rgba(24, 142, 158, 0.32);
    transform: translateY(-1px);
}

.task-actions .icon-toggle,
.task-actions .icon-delete {
    border: none;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.task-actions form.task-action-form {
    transform: translateY(-4px);
}

.task-actions .icon-delete {
    background: linear-gradient(90deg, #e85a6b, #de5a71);
    box-shadow: 0 6px 14px rgba(222, 90, 113, 0.35);
    color: #fff;
}

.task-actions .icon-delete:hover {
    background: linear-gradient(90deg, #c93d4e, #c04a5a);
    box-shadow: 0 8px 18px rgba(222, 90, 113, 0.4);
    transform: translateY(-1px);
}

.task-actions .icon-toggle:hover {
    transform: translateY(-1px);
}

.task-actions .icon-open:hover {
    background: linear-gradient(90deg, #168a5f, #15996a);
    box-shadow: 0 8px 18px rgba(25, 150, 106, 0.32);
}

.task-actions .icon-close:hover {
    background: linear-gradient(90deg, #b85a18, #c96b22);
    box-shadow: 0 8px 18px rgba(194, 112, 40, 0.32);
}

.icon-toggle {
    min-width: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1;
    font-weight: 800;
}

.icon-open {
    background: linear-gradient(90deg, #1ca773, #1bb984);
    box-shadow: 0 6px 14px rgba(25, 150, 106, 0.24);
}

.icon-close {
    background: linear-gradient(90deg, #d56a1f, #e3832f);
    box-shadow: 0 6px 14px rgba(194, 112, 40, 0.24);
}

.icon-action {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.icon-reset {
    background: linear-gradient(90deg, #22abc6, #35bfd3);
    box-shadow: 0 6px 14px rgba(34, 171, 198, 0.24);
}

.icon-block {
    background: linear-gradient(90deg, #3f7682, #34656f);
    box-shadow: 0 6px 14px rgba(52, 101, 111, 0.2);
}

.icon-unblock {
    background: linear-gradient(90deg, #1ca773, #1bb984);
    box-shadow: 0 6px 14px rgba(25, 150, 106, 0.24);
}

.icon-delete {
    background: linear-gradient(90deg, #de5a71, #c84f65);
    box-shadow: 0 6px 14px rgba(200, 79, 101, 0.24);
}

.tooltip-trigger {
    position: relative;
}

.tooltip-trigger::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: #173a42;
    color: #eafcff;
    border: 1px solid #2a6470;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 80;
    transition: opacity 0.12s ease;
}

.tooltip-trigger::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #173a42;
    opacity: 0;
    transition: opacity 0.12s ease;
    z-index: 80;
}

.tooltip-trigger:hover::after,
.tooltip-trigger:hover::before {
    opacity: 1;
}


.icon-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
    color: #0f6f80;
    background: #ddf5f9;
    border: 1px solid #bce9f1;
}

.icon-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #a82d3d;
    background: #fce8eb;
    border: 1px solid #f0c4ca;
}

.icon-delete:hover {
    background: #f5d0d6;
    border-color: #e8a8b2;
}

.task-actions .icon-delete {
    color: #fff;
}

.task-actions .icon-delete-svg svg {
    display: block;
    margin: 0 auto;
}

.task-thumb {
    width: 56px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #cce9ef;
}

.thumb-btn {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: zoom-in;
    line-height: 0;
}

.image-preview-modal {
    display: none;
}

.image-preview-modal.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.image-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 23, 28, 0.7);
}

.image-preview-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(21vw, 205px);
    max-height: 20vh;
    background: #ffffff;
    border-radius: 14px;
    padding: 36px 16px 16px;
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.35);
}

.image-preview-dialog img {
    display: block;
    width: 100%;
    max-height: calc(20vh - 52px);
    object-fit: contain;
    border-radius: 10px;
}

.image-preview-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 8px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    background: #f2f6f8;
    color: #23444d;
    border: 1px solid #d2e7ec;
    box-shadow: none;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.form-inline input {
    flex: 1 1 260px;
}

.task-image {
    display: block;
    width: min(100%, 640px);
    border-radius: 14px;
    margin: 14px 0;
    border: 1px solid #d5eef3;
    box-shadow: 0 8px 18px rgba(27, 119, 135, 0.14);
}

.task-image-student {
    width: min(100%, 320px);
}

.attempts-table .col-task-number {
    width: 58px;
    min-width: 58px;
    text-align: center;
}

.attempts-table .col-task-title {
    min-width: 200px;
}

a {
    color: #1e95ad;
}

@media (max-width: 820px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 0;
        gap: 10px;
    }

    .topnav {
        flex-wrap: wrap;
    }
}
