/* Phase L — mobile-first teacher web portal */
:root {
    --teacher-teal: #0a7a75;
    --teacher-teal-dark: #065955;
    --teacher-nav-h: 62px;
    --teacher-header-h: 48px;
    --teacher-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.teacher-portal {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #eef2f2;
    font-family: var(--erp-font, "Noto Sans", Tahoma, sans-serif);
    font-size: 14px;
    color: #1a2b2e;
}

.teacher-portal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--teacher-header-h);
    background: linear-gradient(180deg, var(--teacher-teal) 0%, var(--teacher-teal-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.teacher-portal-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    max-width: 720px;
    margin: 0 auto;
}

.teacher-portal-brand {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: #fff;
}

.teacher-portal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.teacher-portal-erp-link {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 4px 12px;
}

.teacher-portal-logout-btn {
    font-size: 12px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 4px 12px;
    cursor: pointer;
}

.teacher-portal-main {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 12px calc(var(--teacher-nav-h) + var(--teacher-safe-bottom) + 16px);
}

.teacher-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(var(--teacher-nav-h) + var(--teacher-safe-bottom));
    padding-bottom: var(--teacher-safe-bottom);
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.teacher-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #5a6b6e;
    font-size: 10px;
    font-weight: 600;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.teacher-nav-item.active {
    color: var(--teacher-teal-dark);
}

.teacher-nav-item.active .teacher-nav-icon {
    background: rgba(10, 122, 117, 0.12);
    border-radius: 10px;
}

.teacher-nav-icon {
    font-size: 18px;
    line-height: 1;
    padding: 4px 10px;
}

.teacher-nav-label {
    letter-spacing: 0.02em;
}

.teacher-greeting {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.teacher-greeting-sub {
    margin: -6px 0 14px;
    color: #5a6b6e;
    font-size: 13px;
}

.teacher-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (min-width: 480px) {
    .teacher-quick-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.teacher-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 72px;
    padding: 10px 8px;
    background: #fff;
    border: 1px solid rgba(0, 80, 80, 0.08);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(16, 40, 40, 0.06);
    text-decoration: none;
    color: #163238;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.teacher-quick-btn .icon {
    font-size: 22px;
    line-height: 1;
}

.teacher-quick-btn .badge-count {
    position: absolute;
    margin-top: -36px;
    margin-left: 28px;
    background: #cc1f1f;
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.teacher-quick-btn-wrap {
    position: relative;
}

.teacher-kpi-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.teacher-kpi-scroll::-webkit-scrollbar {
    display: none;
}

.teacher-kpi-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 120px;
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 80, 80, 0.08);
    box-shadow: 0 2px 8px rgba(16, 40, 40, 0.06);
}

.teacher-kpi-card span {
    display: block;
    font-size: 11px;
    color: #5a6b6e;
    margin-bottom: 4px;
}

.teacher-kpi-card strong {
    font-size: 22px;
    color: var(--teacher-teal-dark);
}

.teacher-panel {
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(0, 80, 80, 0.08);
    box-shadow: 0 2px 8px rgba(16, 40, 40, 0.06);
    margin-bottom: 14px;
    overflow: hidden;
}

.teacher-panel-head {
    padding: 12px 14px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid #eef2f2;
    background: #fafcfc;
}

.teacher-routine-row,
.teacher-class-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f3f3;
}

.teacher-routine-row:last-child,
.teacher-class-row:last-child {
    border-bottom: 0;
}

.teacher-routine-time {
    font-weight: 700;
    color: var(--teacher-teal-dark);
    font-size: 13px;
    white-space: nowrap;
}

.teacher-class-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.teacher-class-card:active {
    background: #f5fafa;
}

.teacher-class-title {
    font-weight: 700;
    font-size: 15px;
}

.teacher-class-meta {
    font-size: 12px;
    color: #5a6b6e;
}

.teacher-sticky-action {
    position: sticky;
    bottom: calc(var(--teacher-nav-h) + var(--teacher-safe-bottom) + 8px);
    z-index: 10;
    padding: 8px 0;
}

.teacher-btn-primary {
    display: block;
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--teacher-teal);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.teacher-btn-primary:disabled {
    opacity: 0.5;
}

.teacher-student-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f3f3;
}

.teacher-student-row select,
.teacher-student-row input,
.teacher-student-row textarea {
    font-size: 16px; /* avoids iOS zoom on focus */
}

.teacher-more-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    text-decoration: none;
    color: #163238;
    border-bottom: 1px solid #f0f3f3;
    min-height: 48px;
}

.teacher-more-list a:last-child {
    border-bottom: 0;
}

@media (min-width: 900px) {
    .teacher-portal-main {
        padding-top: 20px;
    }

    .teacher-bottom-nav {
        max-width: 720px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
}
