/* ==========================================================================
   Admin area
   Builds on the teacher shell (css/teacher.css) and adds the pieces the
   admin pages need: stat cards, panels, tables and status pills.
   ========================================================================== */

/* ---- sidebar extras ------------------------------------------------------ */

.admin_badge {
    align-self: flex-start;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(91, 140, 106, 0.28);
    color: #d9f0e1;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ts_nav__link--soft {
    color: rgba(255, 255, 255, 0.62);
}

.admin_nav_count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ts_nav__link.is-active .admin_nav_count {
    background: rgba(255, 255, 255, 0.26);
}

/* ---- stat row ------------------------------------------------------------ */

.admin_stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.admin_stats--compact {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.admin_stat {
    padding: 16px 18px;
}

.admin_stat--live {
    border-color: #bcd8c7;
    background: #f3faf6;
}

.admin_stat__label {
    margin: 0;
    color: var(--ts-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin_stat__value {
    margin: 6px 0 2px;
    color: var(--ts-navy);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.admin_stat__note {
    margin: 0;
    color: var(--ts-muted);
    font-size: 12.5px;
}

.admin_stat__note a {
    color: var(--ts-green-dark);
    font-weight: 600;
    text-decoration: none;
}

.admin_stat__note a:hover {
    text-decoration: underline;
}

/* ---- layout -------------------------------------------------------------- */

.admin_two {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 18px;
    align-items: start;
}

.admin_stack {
    display: grid;
    gap: 18px;
}

.admin_panel {
    padding: 18px;
    margin-bottom: 18px;
}

.admin_two .admin_panel,
.admin_stack .admin_panel {
    margin-bottom: 0;
}

.admin_panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.admin_panel__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.admin_panel__meta,
.admin_panel__link {
    color: var(--ts-muted);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}

.admin_panel__link:hover {
    color: var(--ts-green-dark);
}

/* ---- simple lists -------------------------------------------------------- */

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

.admin_list__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-top: 1px solid #f0f3f7;
}

.admin_list__row:first-child {
    border-top: 0;
}

.admin_list--tight .admin_list__row {
    padding: 7px 0;
}

.admin_list__time {
    flex: 0 0 52px;
    color: var(--ts-navy);
    font-size: 13px;
    font-weight: 700;
}

.admin_list__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
    font-size: 13.5px;
    font-weight: 600;
}

.admin_list__sub {
    color: var(--ts-muted);
    font-size: 12.5px;
    font-weight: 500;
}

.admin_empty {
    margin: 0;
    padding: 6px 0;
    color: var(--ts-muted);
    font-size: 13px;
}

.admin_subhead {
    margin: 14px 0 2px;
    padding-top: 10px;
    border-top: 1px solid #f0f3f7;
    color: var(--ts-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin_muted {
    color: var(--ts-muted);
}

/* ---- "worth a look" ------------------------------------------------------ */

.admin_flags {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.admin_flag__title {
    margin: 0 0 6px;
    color: var(--ts-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ---- filters ------------------------------------------------------------- */

.admin_filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.admin_input {
    min-width: 0;
    padding: 8px 11px;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    background: #fff;
    color: var(--ts-text);
    font-family: inherit;
    font-size: 13.5px;
}

.admin_input:focus {
    outline: 2px solid rgba(91, 140, 106, 0.35);
    outline-offset: 1px;
    border-color: var(--ts-green);
}

.admin_input[type="search"] {
    flex: 1 1 210px;
}

.admin_input--select {
    flex: 0 1 auto;
}

.admin_filters__reset {
    color: var(--ts-muted);
    font-size: 12.5px;
    font-weight: 600;
}

.admin_filters__count {
    margin-left: auto;
    color: var(--ts-muted);
    font-size: 12.5px;
    font-weight: 600;
}

/* ---- tables -------------------------------------------------------------- */

.admin_table_scroll {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.admin_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.admin_table th {
    padding: 6px 10px;
    border-bottom: 1px solid var(--ts-border);
    color: var(--ts-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin_table td {
    padding: 11px 10px;
    border-bottom: 1px solid #f1f4f8;
    vertical-align: top;
}

.admin_table tbody tr:last-child td {
    border-bottom: 0;
}

.admin_cell__name {
    display: block;
    font-weight: 700;
}

.admin_cell__sub {
    display: block;
    color: var(--ts-muted);
    font-size: 12.5px;
}

.admin_cell__quote {
    display: block;
    margin-top: 3px;
    color: var(--ts-green-dark);
    font-size: 12.5px;
}

.admin_cell__when {
    white-space: nowrap;
    font-weight: 600;
}

.admin_cell__mono {
    color: var(--ts-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.admin_num {
    text-align: right;
    white-space: nowrap;
}

/* The generic header rule is more specific than .admin_num, so numeric
   headers need to opt back in to right alignment. */
.admin_table th.admin_num,
.admin_table th.admin_actions_col {
    text-align: right;
}

.admin_num--zero {
    color: #b91c1c;
    font-weight: 700;
}

/* ---- status pills -------------------------------------------------------- */

.admin_pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.admin_pill--open {
    background: #f1f5f9;
    color: #8a97a5;
}

.admin_pill--booked {
    background: #e6edf4;
    color: #0e2a3a;
}

.admin_pill--live {
    background: #2f6b4f;
    color: #fff;
}

.admin_pill--finished {
    background: #eef7f1;
    color: #3f6b4e;
}

.admin_pill--student {
    background: #eaf2ee;
    color: #2f5c40;
}

.admin_pill--trial {
    background: #e9eff7;
    color: #33506d;
}

.admin_pill--teacher {
    background: #eef1f6;
    color: #3a4553;
}

.admin_pill--ok {
    background: #eef7f1;
    color: #2f5c40;
}

.admin_pill--neutral {
    background: #f1f5f9;
    color: #8a97a5;
}

.admin_pill--warn {
    background: #fdf3f3;
    color: #a12d2d;
}

.admin_pill--bad {
    background: #b91c1c;
    color: #fff;
}

.admin_check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ts-muted);
    font-size: 12.5px;
    font-weight: 600;
}

.admin_check input {
    accent-color: #2f6b4f;
}

.admin_stat--alert {
    border-color: #f0d7d7;
    background: #fdf7f7;
}

/* ---- detail pages -------------------------------------------------------- */

.admin_back {
    color: var(--ts-green-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
}

.admin_back:hover {
    text-decoration: underline;
}

.admin_link {
    color: var(--ts-navy);
    text-decoration: none;
}

.admin_link:hover {
    color: var(--ts-green-dark);
    text-decoration: underline;
}

a.admin_cell__name {
    color: var(--ts-navy);
}

a.admin_cell__name:hover {
    color: var(--ts-green-dark);
    text-decoration: underline;
}

.admin_note {
    margin: 14px 0 0;
    color: var(--ts-muted);
    font-size: 12.5px;
    line-height: 1.55;
}

.admin_flash {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
}

.admin_flash--ok {
    background: #eef7f1;
    border: 1px solid #d6e8dd;
    color: #2f5c40;
}

.admin_flash--warn {
    background: #fdf3f3;
    border: 1px solid #f0d7d7;
    color: #a12d2d;
}

.admin_btn {
    padding: 6px 11px;
    font-size: 12.5px;
}

.admin_btn--danger {
    border-color: #f0d7d7;
    color: #a12d2d;
}

.admin_btn--danger:hover {
    background: #fdf3f3;
    border-color: #e7bcbc;
}

.admin_inline_form {
    display: inline-flex;
    margin: 0;
}

.admin_actions_col {
    text-align: right;
    white-space: nowrap;
}

.admin_stat__value--money {
    font-size: 22px;
}

.admin_stat__value--small {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.admin_role_form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 0;
}

.admin_field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 180px;
}

.admin_field__label {
    color: var(--ts-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin_facts {
    margin: 0;
}

.admin_fact {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid #f0f3f7;
}

.admin_fact:first-child {
    border-top: 0;
    padding-top: 0;
}

.admin_fact dt {
    color: var(--ts-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin_fact dd {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
}

/* ---- availability editor ------------------------------------------------- */

.admin_avail_head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.admin_avail_legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--ts-muted);
    font-size: 12px;
    font-weight: 600;
}

.admin_legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.admin_legend__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.admin_legend__dot--open {
    background: #2f6b4f;
}

.admin_legend__dot--closed {
    background: #cbd5e1;
}

.admin_legend__dot--booked {
    background: #0e2a3a;
}

.admin_slots {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.admin_slot_form {
    margin: 0;
    display: flex;
}

.admin_slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    padding: 8px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 12.5px;
    text-align: center;
}

.admin_slot__time {
    font-weight: 700;
    color: var(--ts-text);
}

.admin_slot__sub {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--ts-muted);
}

button.admin_slot {
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.admin_slot--closed {
    background: #f6f8fa;
    border-style: dashed;
}

button.admin_slot--closed:hover {
    background: #eef7f1;
    border-color: #8fc0a2;
    border-style: solid;
}

.admin_slot--open {
    background: #eef7f1;
    border-color: #bcd8c7;
}

.admin_slot--open .admin_slot__sub {
    color: #3f6b4e;
}

button.admin_slot--open:hover {
    background: #fdf3f3;
    border-color: #e7bcbc;
}

.admin_slot--booked {
    background: #0e2a3a;
    border-color: #0e2a3a;
}

.admin_slot--booked .admin_slot__time {
    color: #fff;
}

.admin_slot--booked .admin_slot__sub {
    color: rgba(255, 255, 255, 0.72);
}

.admin_slot--past {
    background: #fafbfc;
    border-color: #f1f4f8;
    color: #b6c0cb;
    opacity: 0.7;
}

.admin_slot--past .admin_slot__time {
    color: #b6c0cb;
}

/* ---- revenue bars -------------------------------------------------------- */

.admin_bar_col {
    width: 34%;
    min-width: 120px;
}

.admin_bar {
    display: block;
    height: 8px;
    min-width: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #8fc0a2, #2f6b4f);
}

.admin_list__amount {
    color: var(--ts-navy);
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
}

/* ---- day timeline -------------------------------------------------------- */

.admin_day {
    margin-bottom: 18px;
}

.admin_day__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.admin_day__title {
    flex: 1;
    text-align: center;
}

.admin_day__title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.admin_day__title p {
    margin: 3px 0 0;
    color: var(--ts-muted);
    font-size: 12.5px;
    font-weight: 600;
}

.admin_day__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    background: #fff;
    color: var(--ts-navy);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
}

.admin_day__arrow:hover {
    background: #f5f8fa;
    border-color: #c3ccd7;
}

.admin_day__back {
    margin: 6px 0 0;
    text-align: center;
    font-size: 12.5px;
}

.admin_timeline {
    margin-top: 14px;
}

.admin_hour {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid #f1f4f8;
    align-items: stretch;
}

.admin_hour:first-child {
    border-top: 0;
}

.admin_hour.is-now {
    background: #f6fbf8;
    border-radius: 8px;
}

.admin_hour__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 8px;
    color: var(--ts-muted);
    font-size: 12px;
    font-weight: 700;
}

.admin_hour__now {
    color: #2f6b4f;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.admin_slot_cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #f8fafc;
    text-decoration: none;
}

.admin_slot_stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin_slot_stack .admin_slot_cell {
    flex: 1;
}

.admin_slot_cell--empty {
    justify-content: center;
    border-style: dashed;
    background: transparent;
    color: #c3ccd7;
}

.admin_slot_cell__time {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ts-muted);
    font-size: 11px;
    font-weight: 700;
}

.admin_slot_cell__time .admin_pill {
    padding: 1px 7px;
    font-size: 10px;
}

.admin_slot_cell__main {
    color: var(--ts-text);
    font-size: 13px;
    font-weight: 700;
}

.admin_slot_cell__sub {
    color: var(--ts-muted);
    font-size: 12px;
}

.admin_slot_cell--booked,
.admin_slot_cell--live {
    border-color: #0e2a3a;
    background: #0e2a3a;
}

.admin_slot_cell--live {
    border-color: #2f6b4f;
    background: #2f6b4f;
}

.admin_slot_cell--booked .admin_slot_cell__time,
.admin_slot_cell--live .admin_slot_cell__time {
    color: rgba(255, 255, 255, 0.66);
}

.admin_slot_cell--booked .admin_slot_cell__main,
.admin_slot_cell--live .admin_slot_cell__main {
    color: #fff;
}

.admin_slot_cell--booked .admin_slot_cell__sub,
.admin_slot_cell--live .admin_slot_cell__sub {
    color: rgba(255, 255, 255, 0.74);
}

.admin_slot_cell--booked .admin_pill--booked,
.admin_slot_cell--live .admin_pill--live {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.admin_slot_cell--finished {
    border-color: #d6e8dd;
    background: #eef7f1;
}

.admin_slot_cell--finished .admin_slot_cell__main {
    color: #3f6b4e;
}

a.admin_slot_cell:hover {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.09);
}

.admin_slot_link {
    align-self: flex-start;
    margin-top: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease;
}

.admin_slot_link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.admin_slot_cell--finished .admin_slot_link {
    background: #dcecdf;
    color: #2f5c40;
}

.admin_slot_cell--finished .admin_slot_link:hover {
    background: #cfe4d6;
}

/* ---- small screens ------------------------------------------------------- */

@media (max-width: 980px) {
    .admin_two {
        grid-template-columns: 1fr;
    }

    .admin_filters__count {
        margin-left: 0;
        flex-basis: 100%;
    }
}

@media (max-width: 760px) {
    .admin_stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .admin_stat__value {
        font-size: 24px;
    }

    .admin_panel {
        padding: 15px;
    }

    .admin_input[type="search"] {
        flex-basis: 100%;
    }

    .admin_filters .ts_btn {
        flex: 1 1 auto;
    }

    .admin_slots {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin_fact {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .admin_hour {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .admin_hour > .admin_slot_stack {
        grid-column: 2;
    }

    .admin_day__title h2 {
        font-size: 15px;
    }
}

/* ---- teacher core schedule ---------------------------------------------- */

.admin_core_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    padding: 4px 0 2px;
}

.admin_core_day {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.admin_core_day h3 {
    margin: 0 0 6px;
    color: #64748b;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin_core_slot {
    padding: 6px 0;
    border-top: 1px solid #e8edf3;
}

.admin_core_slot:first-of-type {
    border-top: 0;
}

.admin_core_slot__time {
    display: block;
    color: #1f2430;
    font-size: 13px;
    font-weight: 700;
}

.admin_core_slot__student {
    display: block;
    margin-top: 1px;
    color: #334155;
    font-size: 12.5px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.admin_core_slot__student.admin_muted {
    color: #94a3b8;
}

/* ---- teacher guide editor ---------------------------------------------- */

.admin_guide_tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.admin_guide_tabs .ts_btn {
    text-decoration: none;
}

.admin_guide_form {
    display: grid;
    gap: 16px;
    max-width: 900px;
}

.admin_guide_form .admin_field {
    display: grid;
    gap: 5px;
    flex: none;
}

.admin_guide_form textarea.admin_input {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    line-height: 1.55;
}

.admin_guide_form__actions,
.admin_guide_reset_form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.admin_guide_form__hint {
    color: var(--ts-muted);
    font-size: 12px;
}

.admin_guide_reset {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #eef2f6;
}

.admin_guide_tabs__label {
    align-self: center;
    color: var(--ts-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-right: 4px;
}
