:root {
    --apms-ui-bg: var(--bg, #f2f4f6);
    --apms-ui-surface: var(--surface, #ffffff);
    --apms-ui-surface-soft: var(--surface-2, #f8fafc);
    --apms-ui-border: var(--border, #e5e8eb);
    --apms-ui-text: var(--text, #191f28);
    --apms-ui-muted: var(--secondary, #6b7684);
    --apms-ui-soft: rgba(118, 118, 128, 0.10);
    --apms-ui-accent: var(--primary, #1a5cff);
    --apms-ui-hover: rgba(15, 23, 42, 0.035);
    --apms-ui-radius-card: 16px;
    --apms-ui-radius-row: 12px;
    --apms-ui-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* 다크모드 대응: --surface/--text 등의 다크 오버라이드는 body(.dark)에 선언돼 있다.
   위 :root 블록에서 var(--surface) 를 한 번 풀어버리면 html(:root) 컨텍스트의
   라이트값으로 고정돼, 다크모드에서도 흰 카드/검은 글씨가 그대로 상속된다.
   (예: 일지 하단 결석/보강 월간 현황 보드가 다크모드에서 흰 박스로 표시되던 버그)
   같은 매핑을 body 에서 다시 선언해 body 컨텍스트의 다크 토큰으로 재해석되게 한다. */
body {
    --apms-ui-bg: var(--bg, #f2f4f6);
    --apms-ui-surface: var(--surface, #ffffff);
    --apms-ui-surface-soft: var(--surface-2, #f8fafc);
    --apms-ui-border: var(--border, #e5e8eb);
    --apms-ui-text: var(--text, #191f28);
    --apms-ui-muted: var(--secondary, #6b7684);
    --apms-ui-accent: var(--primary, #1a5cff);
}

.apms-card {
    background: var(--apms-ui-surface);
    border: 1px solid var(--apms-ui-border);
    border-radius: var(--apms-ui-radius-card);
    box-shadow: var(--apms-ui-shadow-card);
    color: var(--apms-ui-text);
    overflow: hidden;
}

.apms-card__header,
.apms-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}

.apms-card__header {
    border-bottom: 1px solid var(--apms-ui-border);
    background: var(--apms-ui-surface-soft);
}

.apms-card__title,
.apms-section-title,
.apms-line-row__title {
    color: var(--apms-ui-text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
}

.apms-card__meta,
.apms-section-meta,
.apms-line-row__meta,
.apms-muted {
    color: var(--apms-ui-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

.apms-card__body {
    padding: 12px 16px;
}

.apms-section {
    display: grid;
    gap: 8px;
}

.apms-line-list {
    display: grid;
    background: var(--apms-ui-surface);
}

.apms-line-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--apms-ui-border);
    color: var(--apms-ui-text);
}

.apms-line-row:last-child {
    border-bottom: 0;
}

.apms-line-row--clickable {
    cursor: pointer;
}

.apms-line-row--clickable:hover {
    background: var(--apms-ui-hover);
}

.apms-line-row__main {
    min-width: 0;
    flex: 1;
}

.apms-line-row__status,
.apms-line-row__actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.apms-line-row__chevron {
    color: var(--apms-ui-muted);
    font-size: 14px;
    font-weight: 400;
}

.apms-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid var(--apms-ui-border);
    border-radius: 999px;
    background: var(--apms-ui-surface);
    color: var(--apms-ui-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
}

.apms-chip--muted {
    background: var(--apms-ui-surface-soft);
}

.apms-chip--soft {
    background: var(--apms-ui-soft);
    border-color: transparent;
    color: var(--apms-ui-text);
}

.apms-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid var(--apms-ui-border);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.apms-button--quiet {
    background: var(--apms-ui-surface);
    color: var(--apms-ui-text);
}

.apms-button--primary {
    background: var(--apms-ui-accent);
    border-color: var(--apms-ui-accent);
    color: #ffffff;
}

.apms-empty {
    padding: 28px 16px;
    color: var(--apms-ui-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
}

.apms-toolbar,
.apms-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.apms-toolbar::-webkit-scrollbar,
.apms-tabs::-webkit-scrollbar {
    display: none;
}

.apms-tab {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--apms-ui-border);
    border-radius: 999px;
    background: var(--apms-ui-surface);
    color: var(--apms-ui-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.apms-tab--active {
    background: var(--apms-ui-soft);
    color: var(--apms-ui-accent);
    border-color: transparent;
}

/* ======================================================================
   AP MATH 공통 UI Foundation 1차 (2026-06-11)
   - 선생님 대시보드 카드 톤을 전체 공통 기준으로 승격한 정규 클래스.
   - 기준: radius 6px / box-shadow none / 연한 1px border / white surface
   - 폰트 위계: stat 20px·700, 섹션 제목 14~15px·600~700,
     본문 13px·400~500, badge/chip 12px·500~600, 11px는 보조정보 전용.
   - 기존 화면 클래스 bridge는 apms-theme-override.css에서 처리한다.
   ====================================================================== */
:root {
    --ap-ui-radius-card: 6px;
    --ap-ui-radius-row: 4px;
    --ap-ui-radius-modal: 16px;
    --ap-ui-shadow-card: none;
    --ap-ui-font-stat: 20px;
    --ap-ui-font-section: 15px;
    --ap-ui-font-body: 13px;
    --ap-ui-font-small: 12px;
}

.ap-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e5e8eb);
    border-radius: var(--ap-ui-radius-card);
    box-shadow: var(--ap-ui-shadow-card);
    padding: 20px 24px;
    box-sizing: border-box;
    color: var(--text, #1c1c1e);
}

.ap-card__title {
    margin: 0 0 12px;
    font-size: var(--ap-ui-font-section);
    font-weight: 700;
    color: var(--text, #1c1c1e);
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ap-card__stat {
    font-size: var(--ap-ui-font-stat);
    font-weight: 700;
    color: var(--text, #1c1c1e);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.ap-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e5e8eb);
    border-radius: var(--ap-ui-radius-row);
    margin-bottom: 8px;
    box-sizing: border-box;
    box-shadow: none;
    font-size: var(--ap-ui-font-body);
    font-weight: 500;
    line-height: 1.35;
    color: var(--text, #1c1c1e);
}

.ap-list-row:last-child {
    margin-bottom: 0;
}

.ap-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid var(--border, #e5e8eb);
    border-radius: var(--ap-ui-radius-card);
    background: var(--surface-2, #f9f9fb);
    color: var(--secondary, #6c6c70);
    font-size: var(--ap-ui-font-small);
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.ap-badge {
    display: inline-flex;
    align-items: center;
    font-size: var(--ap-ui-font-small);
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--surface-2, #f9f9fb);
    border: 1px solid var(--border, #e5e8eb);
    color: var(--secondary, #6c6c70);
}

.ap-action-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 64px;
    padding: 14px 10px;
    border: 1px solid var(--border, #e5e8eb);
    border-radius: var(--ap-ui-radius-card);
    background: var(--surface, #ffffff);
    color: var(--text, #1c1c1e);
    box-shadow: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color .18s ease, background .18s ease;
}

.ap-action-card:hover {
    border-color: var(--primary, #007aff);
    background: var(--surface-2, #f9f9fb);
}

/* 모달 내부 공통: shell radius(16px)와 달리 내부 구성요소는 6px 계열 */
.ap-modal-section {
    border: 1px solid var(--border, #e5e8eb);
    border-radius: var(--ap-ui-radius-card);
    background: var(--surface, #ffffff);
    box-shadow: none;
    padding: 12px 14px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.ap-modal-section:last-child {
    margin-bottom: 0;
}

.ap-modal-section__title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1c1c1e);
    line-height: 1.35;
}

.ap-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border, #e5e8eb);
    border-radius: var(--ap-ui-radius-row);
    background: var(--surface, #ffffff);
    box-shadow: none;
    box-sizing: border-box;
    margin-bottom: 6px;
    font-size: var(--ap-ui-font-body);
    font-weight: 500;
    line-height: 1.35;
    color: var(--text, #1c1c1e);
}

.ap-modal-row:last-child {
    margin-bottom: 0;
}
