.sntk-wrap { max-width: 820px; margin: 0 auto; padding: 1rem 0 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.sntk-msg { padding: 1rem; background: #f7f9fc; border-radius: 8px; border: 1px solid #e0e8f0; font-size: 14px; }
.sntk-card { background: #fff; border: 1px solid #e4e8ef; border-radius: 12px; padding: 1.5rem; }

/* Head */
.sntk-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid #eef0f4; }
.sntk-head-icon { width: 36px; height: 36px; background: #f0fae6; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sntk-title { font-size: 15px; font-weight: 600; color: #1a2744; margin: 0 0 3px; }
.sntk-sub { font-size: 12px; color: #6b7280; margin: 0; line-height: 1.5; }

/* Form layout */
.sntk-section-label { font-size: 10px; font-weight: 700; color: #9ca3af; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 8px; }
.sntk-row { display: grid; gap: 10px; margin-bottom: 12px; }
.sntk-row-2 { grid-template-columns: 1fr 1fr; }
.sntk-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.sntk-field { margin-bottom: 12px; }
.sntk-field label { display: block; font-size: 11px; font-weight: 600; color: #6b7280; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.sntk-field select {
    width: 100%;
    padding: 7px 32px 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #1a2744;
    background-color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='%231a2744' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.sntk-field select:focus { outline: none; border-color: #6AAF2C; box-shadow: 0 0 0 3px rgba(106,175,44,0.1); }
.sntk-divider { height: 1px; background: #eef0f4; margin: 14px 0; }

/* Topic field */
.sntk-topic-wrap { position: relative; }
.sntk-topic-input { width: 100%; padding: 7px 34px 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; color: #1a2744; background: #f9fafb; }
.sntk-topic-input:not([readonly]):focus { outline: none; border-color: #6AAF2C; box-shadow: 0 0 0 3px rgba(106,175,44,0.1); background: #fff; }
.sntk-topic-prefilled { background: #f0fae6 !important; border-color: #b5da7c !important; color: #2d5a0e !important; }
.sntk-topic-chosen { background: #f3f4f6 !important; border-color: #d1d5db !important; }
.sntk-topic-clear { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #9ca3af; font-size: 14px; padding: 0; line-height: 1; display: inline-flex; align-items: center; }
.sntk-topic-clear:hover { color: #374151; }

/* Hints */
.sntk-hint { font-size: 11px; margin: 4px 0 0; color: #9ca3af; line-height: 1.5; }
.sntk-hint-green { color: #6AAF2C !important; }
.sntk-hint-muted { color: #9ca3af !important; }

/* Autocomplete */
.sntk-autocomplete { position: absolute; top: calc(100% + 3px); left: 0; right: 0; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; z-index: 200; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.sntk-ac-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6; font-size: 13px; color: #1a2744; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sntk-ac-item:last-child { border-bottom: none; }
.sntk-ac-item:hover { background: #f0fae6; }
.sntk-ac-item mark { background: none; color: #6AAF2C; font-weight: 700; }
.sntk-ac-meta { font-size: 11px; color: #9ca3af; flex-shrink: 0; font-weight: 500; }
.sntk-ac-empty { padding: 12px; font-size: 12px; color: #9ca3af; text-align: center; }

/* Duration toggle */
.sntk-toggle-group { display: flex; gap: 6px; }
.sntk-tog { flex: 1; padding: 7px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; font-size: 12px; font-weight: 600; color: #6b7280; cursor: pointer; text-align: center; transition: all 0.12s; }
.sntk-tog:hover { border-color: #6AAF2C; color: #2d5a0e; }
.sntk-tog-on { background: #f0fae6 !important; border-color: #6AAF2C !important; color: #2d5a0e !important; }

/* Day buttons */
.sntk-days-group { display: flex; gap: 6px; margin-bottom: 6px; }
.sntk-day { flex: 1; padding: 7px 4px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; font-size: 11px; font-weight: 600; color: #6b7280; cursor: pointer; text-align: center; line-height: 1.3; transition: all 0.12s; }
.sntk-day:hover { border-color: #6AAF2C; color: #2d5a0e; }
.sntk-day-on { background: #f0fae6 !important; border-color: #6AAF2C !important; color: #2d5a0e !important; }
.sntk-day-fw { flex: 2; font-size: 11px; }
.sntk-day-sub { display: block; font-size: 10px; font-weight: 400; color: #9ca3af; margin-top: 2px; }
.sntk-day-on .sntk-day-sub { color: #6AAF2C; }
.sntk-days-hint { font-size: 11px; margin: 0 0 12px; }
.sntk-hint-prompt { color: #9ca3af; }
.sntk-hint-active { color: #6AAF2C; }

/* Usage bar */
.sntk-usage-bar { display: flex; justify-content: space-between; align-items: center; padding: 7px 11px; background: #f9fafb; border-radius: 6px; margin-bottom: 10px; font-size: 12px; color: #6b7280; border: 1px solid #eef0f4; }
.sntk-usage-reset { font-size: 11px; color: #9ca3af; }

/* Submit button */
.sntk-btn { width: 100%; padding: 10px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.sntk-btn-ready { background: #6AAF2C; color: #fff; }
.sntk-btn-ready:hover { background: #5a9a24; }
.sntk-btn-waiting { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; border: 1px solid #e5e7eb; }
.sntk-btn-sub { font-size: 11px; font-weight: 400; opacity: 0.85; margin-left: 5px; }

/* Loading */
.sntk-loading { text-align: center; padding: 1.5rem 0 0.5rem; }
.sntk-spinner { width: 30px; height: 30px; border: 3px solid #e5e7eb; border-top-color: #6AAF2C; border-radius: 50%; animation: sntk-spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes sntk-spin { to { transform: rotate(360deg); } }
.sntk-loading-title { font-size: 14px; font-weight: 600; color: #1a2744; margin: 0 0 4px; transition: opacity 0.3s ease; }
.sntk-loading-topic { font-size: 12px; color: #6AAF2C; font-style: italic; margin: 0 0 0; }
.sntk-jokes-wrap { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid #eef0f4; text-align: left; }
.sntk-jokes-intro { font-size: 12px; color: #6b7280; text-align: center; margin: 0 0 10px; }
.sntk-joke-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 12px; }
.sntk-joke-arrow { width: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; cursor: pointer; color: #b5da7c; font-size: 22px; line-height: 1; transition: all 0.12s; user-select: none; padding: 0; }
.sntk-joke-arrow:hover { background: #f0fae6; border-color: #6AAF2C; color: #3a6b0f; transform: scale(1.08); }
.sntk-joke-arrow:active { transform: scale(0.95); }
.sntk-joke-card { flex: 1; background: #f0fae6; border: 1px solid #b5da7c; border-radius: 8px; padding: 16px 18px; min-height: 70px; display: flex; align-items: center; justify-content: center; }
.sntk-joke-text { font-size: 13px; color: #2d5a0e; text-align: center; line-height: 1.6; margin: 0; transition: opacity 0.15s; }
.sntk-jokes-note { font-size: 11px; color: #9ca3af; text-align: center; margin: 0; padding: 8px 12px; background: #f9fafb; border-radius: 6px; border: 1px solid #f3f4f6; line-height: 1.5; }

/* Results */
.sntk-res-header { margin-bottom: 14px; }
.sntk-res-check { font-size: 14px; font-weight: 600; color: #1a2744; margin: 0 0 4px; }
.sntk-file-badge { display: inline-flex; align-items: center; padding: 2px 8px; background: #f0fae6; border-radius: 20px; font-size: 11px; font-weight: 600; color: #2d5a0e; margin-left: 8px; }
.sntk-res-meta { font-size: 12px; color: #6b7280; margin: 0; }
.sntk-week-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sntk-day-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #f9fafb; border-radius: 8px; border: 1px solid #eef0f4; }
.sntk-day-info { display: flex; flex-direction: column; gap: 2px; }
.sntk-day-name { font-size: 13px; font-weight: 600; color: #1a2744; }
.sntk-day-focus { font-size: 11px; color: #9ca3af; }
.sntk-day-btns { display: flex; gap: 6px; }
.sntk-dl-btn { padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; font-family: inherit; }
.sntk-dl-lp { background: #1a2744; color: #fff; }
.sntk-dl-lp:hover { background: #243668; }
.sntk-dl-ws { background: #6AAF2C; color: #fff; }
.sntk-dl-ws:hover { background: #5a9a24; }
.sntk-btn-again { width: 100%; padding: 8px; background: #f9fafb; color: #374151; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
.sntk-btn-again:hover { background: #f0fae6; border-color: #6AAF2C; }

/* Error */
.sntk-error { padding: 10px 14px; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 6px; color: #991b1b; font-size: 13px; margin-top: 10px; }

/* Responsive */
@media (max-width: 520px) {
    .sntk-row-4 { grid-template-columns: 1fr 1fr; }
    .sntk-row-2 { grid-template-columns: 1fr; }
    .sntk-day-fw { flex: 2; }
}


/* Restore suggested topic link */
.sntk-restore-wrap { margin: 5px 0 0; }
.sntk-restore-link { font-size: 11px; color: #6AAF2C; text-decoration: none; }
.sntk-restore-link:hover { text-decoration: underline; }

/* ========================================================================
   Credit Indicator (Layout B compact, groups of 5)
   ======================================================================== */
.sntk-credits-compact {
    background: #fafbfc;
    border: 1px solid #e0e3e8;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.sntk-credits-text { font-size: 12px; color: #555; white-space: nowrap; }
.sntk-credits-text strong { color: #1a2744; font-weight: 700; }
.sntk-credits-text.warning strong { color: #d97706; }
.sntk-credits-text.danger strong { color: #c0392b; }

.sntk-credits-bars {
    flex: 1;
    min-width: 120px;
    display: flex;
    gap: 4px;
    height: 6px;
}
.sntk-credit-group {
    flex: 1;
    background: #e8edf2;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.sntk-credit-fill {
    background: #6AAF2C;
    height: 100%;
    width: 100%;
    transition: width 0.25s, background 0.25s;
}
.sntk-credit-fill.used { background: #d1d5db; }
.sntk-credit-fill.warning { background: #f59e0b; }
.sntk-credit-fill.danger { background: #c0392b; }

.sntk-credits-reset {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

/* Mobile responsive */
@media (max-width: 540px) {
    .sntk-credits-compact { gap: 8px; }
    .sntk-credits-text, .sntk-credits-reset { font-size: 11px; }
    .sntk-credits-bars { width: 100%; min-width: 0; flex-basis: 100%; order: 3; }
}

/* ========================================================================
   Lesson Library
   ======================================================================== */
.sntk-library-wrap {
    max-width: 820px;
    margin: 24px auto 40px;
    padding: 0 20px;
}
.sntk-library-panel {
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sntk-library-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 16px;
}
.sntk-library-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a2744;
}
.sntk-library-subtitle {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* Search bar */
.sntk-library-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}
.sntk-library-search-icon {
    flex: 1;
    position: relative;
}
.sntk-library-search-icon::before {
    content: '🔍';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    opacity: 0.5;
    pointer-events: none;
}
.sntk-library-search {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #1a2744;
    background: #fff;
}
.sntk-library-search:focus {
    outline: none;
    border-color: #6AAF2C;
    box-shadow: 0 0 0 3px rgba(106,175,44,0.1);
}

/* Filter pills */
.sntk-library-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef0f4;
}
.sntk-filter-pill {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: #1a2744;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    font-family: inherit;
}
.sntk-filter-pill:hover { border-color: #6AAF2C; }
.sntk-filter-pill.sntk-filter-fav { color: #d97706; }
.sntk-filter-pill.sntk-filter-fav.active {
    background: #fef3c7;
    color: #d97706;
    border-color: #f59e0b;
}
.sntk-fav-star { font-size: 13px; }

.sntk-filter-select {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    color: #1a2744;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='%231a2744' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    font-family: inherit;
}
.sntk-filter-select:focus {
    outline: none;
    border-color: #6AAF2C;
    box-shadow: 0 0 0 3px rgba(106,175,44,0.1);
}
.sntk-filter-select.has-value {
    background-color: #1a2744;
    color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.sntk-filter-clear {
    font-size: 11px;
    color: #888;
    cursor: pointer;
    padding: 6px 8px;
    text-decoration: none;
    margin-left: auto;
}
.sntk-filter-clear:hover { color: #c0392b; }

/* Group headers */
.sntk-library-group-header {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 18px 0 8px;
    padding: 0 4px;
}
.sntk-library-group-header:first-child { margin-top: 0; }

/* Item card */
.sntk-library-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 14px;
    padding: 14px;
    border: 1px solid #eef0f4;
    border-radius: 8px;
    margin-bottom: 10px;
    align-items: center;
    transition: all 0.15s;
    background: #fff;
}
.sntk-library-item:hover {
    border-color: #c4d8a8;
    background: #fcfdfb;
}
.sntk-library-item.is-fav {
    border-color: #fde68a;
    background: #fffef5;
}
.sntk-library-item.is-fav:hover { border-color: #f59e0b; }
.sntk-library-item.expanded {
    background: #f8faf3;
    border-color: #6AAF2C;
}
.sntk-library-item-icon {
    width: 36px;
    height: 36px;
    background: #f0fae6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #6AAF2C;
    flex-shrink: 0;
    font-weight: 700;
}
.sntk-library-item-icon.science { background: #e8f4fa; color: #2980b9; }
.sntk-library-item-icon.english { background: #fef3e8; color: #d97706; }
.sntk-library-item-icon.hass { background: #f3e8fa; color: #9333ea; }
.sntk-library-item-icon.hpe { background: #fce8ec; color: #be123c; }
.sntk-library-item-icon.arts { background: #fdf2f8; color: #db2777; }
.sntk-library-item-icon.tech { background: #ecfdf5; color: #059669; }

.sntk-library-item-meta {
    font-size: 13px;
    color: #1a2744;
    font-weight: 600;
    margin-bottom: 2px;
}
.sntk-library-item-topic {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}
.sntk-library-item-info {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}
.sntk-library-item-info span { display: inline-block; margin-right: 12px; }
.sntk-library-item-info span.dot { color: #ccc; margin: 0 4px; }

/* Star button */
.sntk-fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 18px;
    line-height: 1;
    color: #d1d5db;
    transition: all 0.12s;
    font-family: inherit;
}
.sntk-fav-btn:hover { color: #f59e0b; transform: scale(1.15); }
.sntk-fav-btn.active { color: #f59e0b; }

/* Reopen button */
.sntk-reopen-btn {
    background: #1a2744;
    color: #fff;
    border: 1px solid #1a2744;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}
.sntk-reopen-btn:hover { background: #2d3a5c; color: #fff; }
.sntk-reopen-btn.expanded-state { background: #6AAF2C; border-color: #6AAF2C; }

/* Expanded panel */
.sntk-library-expand {
    background: #fff;
    border: 1px solid #6AAF2C;
    border-radius: 8px;
    padding: 14px 18px;
    margin: -8px 0 10px 14px;
}
.sntk-library-expand-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #6AAF2C;
    margin-bottom: 10px;
}
.sntk-day-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px dashed #eef0f4;
}
.sntk-day-row:last-of-type {
    border-bottom: none;
    padding-bottom: 12px;
}
.sntk-day-label {
    font-size: 13px;
    font-weight: 600;
    color: #1a2744;
    min-width: 90px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sntk-day-icon {
    width: 22px;
    height: 22px;
    background: #f0fae6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #6AAF2C;
    font-weight: 700;
}
.sntk-file-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    color: #1a2744;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}
.sntk-file-btn:hover {
    border-color: #6AAF2C;
    color: #5a9826;
    background: #f0fae6;
}
.sntk-open-all-row {
    padding-top: 12px;
    margin-top: 6px;
    border-top: 1px solid #eef0f4;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.sntk-open-all-btn {
    background: #1a2744;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.sntk-open-all-btn:hover { background: #2d3a5c; }

/* Empty / loading states */
.sntk-library-loading,
.sntk-library-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
    line-height: 1.7;
}
.sntk-library-empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }

/* Footer */
.sntk-library-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eef0f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
}
.sntk-library-footer a {
    color: #6AAF2C;
    text-decoration: none;
    font-weight: 600;
}
.sntk-library-footer a:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 540px) {
    .sntk-library-item {
        grid-template-columns: auto 1fr;
        gap: 10px;
    }
    .sntk-library-item .sntk-fav-btn,
    .sntk-library-item .sntk-reopen-btn {
        grid-column: 2;
        justify-self: end;
    }
    .sntk-library-item .sntk-fav-btn { grid-row: 1; }
    .sntk-library-item .sntk-reopen-btn { grid-row: 2; }
    .sntk-day-row {
        grid-template-columns: auto auto auto;
    }
}

.sntk-credits-hint {
    margin: -6px 0 14px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
}
