/* =========================================================
   KGORANI 공통 스타일
   ========================================================= */
:root {
    --bg:        #f5f6f8;
    --surface:   #ffffff;
    --text:      #1d2127;
    --muted:     #6b7280;
    --border:    #e2e5ea;
    --accent:    #2f6fed;
    --accent-bg: #e8effd;
    --danger:    #d64545;
    --success:   #1f9d55;
    --radius:    10px;
    --shadow:    0 1px 3px rgba(0, 0, 0, .06);
    --drawer-w:  280px;
    --font:      'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
    --mono:      'D2Coding', 'Consolas', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #121418;
        --surface:   #1b1e24;
        --text:      #e6e8eb;
        --muted:     #9aa1ab;
        --border:    #2c3038;
        --accent:    #6b9bff;
        --accent-bg: #1d2a44;
        --shadow:    none;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
}
body.no-scroll { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 상단 바 ─────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.logo {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: .04em;
    color: var(--text);
}
.logo:hover { text-decoration: none; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user  { font-size: .9rem; color: var(--muted); }

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0 9px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ── 서랍형 메뉴 ─────────────────────────────────────── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, .4);
}
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    width: var(--drawer-w);
    max-width: 85vw;
    height: 100%;
    overflow-y: auto;
    background: var(--surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform .25s ease;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}
.drawer-title { font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.drawer-close {
    font-size: 1.8rem;
    line-height: 1;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
}

.drawer-menu { list-style: none; margin: 0; padding: 10px 0; }
.drawer-account { border-top: 1px solid var(--border); }

.drawer-menu a,
.drawer-link-btn {
    display: block;
    width: 100%;
    padding: 12px 24px;
    font: inherit;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .03em;
    text-align: left;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
}
.drawer-menu a:hover,
.drawer-link-btn:hover { background: var(--bg); text-decoration: none; }
.drawer-menu a.active  { color: var(--accent); background: var(--accent-bg); }
.drawer-menu form { margin: 0; }

/* ── 본문 ────────────────────────────────────────────── */
.container {
    max-width: 1100px;
    min-height: calc(100vh - 140px);
    margin: 0 auto;
    padding: 32px 16px;
}

.hero { margin-bottom: 28px; }
.hero h1 { margin: 0 0 4px; font-size: 2rem; }
.hero p  { margin: 0; color: var(--muted); }

/* ── 메인 대시보드 카드 ──────────────────────────────── */
.dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 720px) {
    .dashboard { grid-template-columns: 1fr; }
}

.card {
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 14px;
    font-size: 1.05rem;
}
.card-title .more { font-size: .8rem; font-weight: 400; }

.card-list { margin: 0; padding: 0; list-style: none; }
ol.card-list { counter-reset: rank; }
.card-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}
.card-list li:last-child { border-bottom: none; }
ol.card-list li::before {
    counter-increment: rank;
    content: counter(rank);
    min-width: 22px;
    font-weight: 700;
    color: var(--accent);
}
ol.card-list li .mono { flex: 1; }

.ellipsis {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.mono  { font-family: var(--mono); font-size: .92rem; }
.muted { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.empty { margin: 0; color: var(--muted); font-size: .9rem; }

.badge {
    padding: 2px 8px;
    font-size: .75rem;
    white-space: nowrap;
    color: var(--accent);
    background: var(--accent-bg);
    border-radius: 999px;
}

/* ── 버튼 · 알림 ─────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 9px 18px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.btn:hover   { text-decoration: none; opacity: .9; }
.btn-small   { padding: 6px 14px; font-size: .85rem; }
.btn-danger  { background: var(--danger); }
.btn-outline { color: var(--text); background: none; border: 1px solid var(--border); }

.alert {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.alert-error   { border-color: var(--danger);  color: var(--danger); }
.alert-success { border-color: var(--success); color: var(--success); }

/* ── 하단 ────────────────────────────────────────────── */
.site-footer {
    padding: 24px 16px;
    text-align: center;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* ── 폼 (로그인 · 회원가입 등) ───────────────────────── */
.form-card {
    max-width: 440px;
    margin: 20px auto;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.form-card h1 { margin: 0 0 24px; font-size: 1.5rem; }

.form-group { margin-bottom: 20px; }
.form-group > label,
.form-group > .label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: .9rem;
}
.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.form-group input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.input-row .btn { white-space: nowrap; }

.hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.hint.ok  { color: var(--success); }
.hint.bad { color: var(--danger); }

.pw-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    font-size: .8rem;
    color: var(--muted);
}
.pw-rules li::before { content: '○ '; }
.pw-rules li.ok { color: var(--success); }
.pw-rules li.ok::before { content: '● '; }

.terms-box {
    max-height: 140px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: .82rem;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.terms-box p { margin: 0 0 6px; }

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: .9rem;
    cursor: pointer;
}

.btn-block { width: 100%; padding: 12px; }
.form-foot { margin: 20px 0 0; text-align: center; font-size: .9rem; color: var(--muted); }
.error-list { margin: 0; padding-left: 18px; }

/* ── 게시판 ──────────────────────────────────────────── */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0; }

.search-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.search-bar select,
.search-bar input[type="text"] {
    padding: 8px 10px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.search-bar input[type="text"] { flex: 1; min-width: 160px; max-width: 320px; }
.search-reset { font-size: .85rem; }

.list-info { margin: 0 0 8px; font-size: .85rem; color: var(--muted); }

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.board-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.board-table th,
.board-table td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.board-table th { font-weight: 600; color: var(--muted); background: var(--bg); }
.board-table tbody tr:last-child td { border-bottom: none; }
.board-table tbody tr:hover { background: var(--bg); }
.board-table .col-title { text-align: left; white-space: normal; word-break: break-all; }
.board-table .col-title a { color: var(--text); }
.col-no    { width: 70px; }
.col-author{ width: 120px; }
.col-date  { width: 110px; }
.col-views { width: 70px; }
.empty-row { padding: 40px; color: var(--muted); }
.file-mark { margin-left: 4px; font-size: .85rem; }
.withdrawn { color: var(--muted); font-style: italic; }

@media (max-width: 640px) {
    .col-no, .col-views { display: none; }
    .col-author { width: auto; }
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin: 24px 0 0;
}
.pagination a {
    min-width: 36px;
    padding: 6px 10px;
    text-align: center;
    font-size: .9rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.pagination a:hover   { text-decoration: none; background: var(--surface); }
.pagination a.current { color: #fff; background: var(--accent); border-color: var(--accent); }

/* 글 보기 */
.post {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.post-head { padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.post-title { margin: 0 0 8px; font-size: 1.5rem; word-break: break-all; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); }
.post-body { min-height: 120px; word-break: break-all; line-height: 1.8; }
.post-image { margin: 20px 0 0; }
.post-image img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }

.file-list {
    margin: 0 0 20px;
    padding: 12px 16px;
    list-style: none;
    background: var(--bg);
    border-radius: 8px;
}
.file-list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .9rem; }
.file-list-edit { margin: 0; }
.file-list-edit .checkbox { margin: 0; }

.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 20px;
}
.post-actions-right { display: flex; gap: 8px; }
.post-actions form { margin: 0; }

/* 글쓰기 폼 */
.post-form {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.form-group textarea {
    width: 100%;
    padding: 12px;
    font: inherit;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: vertical;
}
.form-group input[type="file"] { font: inherit; font-size: .9rem; }

/* ── 마이페이지 ──────────────────────────────────────── */
.info-card { margin-bottom: 20px; }
.info-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px 16px;
    margin: 0;
}
.info-list dt { color: var(--muted); font-size: .9rem; }
.info-list dd { margin: 0; }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 720px) {
    .menu-grid { grid-template-columns: 1fr; }
}
.menu-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.menu-tile:hover { text-decoration: none; border-color: var(--accent); }
.menu-tile span  { font-size: .85rem; color: var(--muted); }
.menu-tile-danger:hover { border-color: var(--danger); }
.menu-tile-danger strong { color: var(--danger); }

.col-manage { width: 150px; }
.row-actions { display: flex; justify-content: center; gap: 6px; }
.row-actions form { margin: 0; }

/* 탈퇴 확인 */
.dialog-card h1 { margin-bottom: 16px; }
.dialog-question { margin: 0 0 12px; font-size: 1.1rem; font-weight: 700; }
.dialog-notice {
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: .9rem;
    color: var(--muted);
    background: var(--bg);
    border-radius: 8px;
}
.dialog-notice p { margin: 0 0 4px; }
.dialog-notice p:last-child { margin: 0; }
.dialog-buttons { display: flex; gap: 8px; }
.dialog-buttons .btn { flex: 1; text-align: center; }

/* ── 기술노트 ────────────────────────────────────────── */
.note-layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 820px) {
    .note-layout { grid-template-columns: 1fr; }
}

.note-sidebar {
    position: sticky;
    top: 80px;
    padding: 10px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
@media (max-width: 820px) {
    .note-sidebar { position: static; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
}
.cat-link {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 16px;
    font-size: .9rem;
    color: var(--text);
}
.cat-link:hover  { text-decoration: none; background: var(--bg); }
.cat-link.active { color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.cat-top   { font-weight: 600; margin-top: 4px; }
.cat-child { padding-left: 30px; font-size: .85rem; }
.cat-count { color: var(--muted); font-size: .78rem; font-weight: 400; }
@media (max-width: 820px) {
    .cat-link, .cat-child { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
}

.note-list {
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.note-list li { border-bottom: 1px solid var(--border); }
.note-list li:last-child { border-bottom: none; }
.note-list a {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 14px 18px;
    color: var(--text);
}
.note-list a:hover { text-decoration: none; background: var(--bg); }
.note-title { flex: 1; min-width: 200px; font-weight: 600; }

.post-head .badge { display: inline-block; margin-bottom: 10px; }
.note-body h2 { margin: 24px 0 8px; font-size: 1.3rem; }
.note-body h3 { margin: 18px 0 6px; font-size: 1.1rem; }
.note-body code {
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: .88em;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.code-block {
    margin: 12px 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: .88rem;
    line-height: 1.6;
    color: #e6e8eb;
    background: #1e2128;
    border-radius: 8px;
}
.code-block code { padding: 0; color: inherit; background: none; border: none; }

.form-group select,
.cat-add select,
.cat-add input[type="text"],
.cat-edit input[type="text"],
.order-input {
    padding: 8px 10px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.form-group select { width: 100%; }
.mono-input { font-family: var(--mono) !important; font-size: .9rem !important; }
.hint code { padding: 0 4px; font-family: var(--mono); background: var(--bg); border-radius: 3px; }

/* 카테고리 관리 */
.cat-add { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-add input[type="text"] { flex: 1; min-width: 160px; }
.order-input { width: 70px; }
.cat-manage { margin-top: 20px; }
.cat-rows { margin: 0; padding: 0; list-style: none; }
.cat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.cat-row:last-child { border-bottom: none; }
.cat-row form { margin: 0; }
.cat-edit { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px; }
.cat-edit input[type="text"] { flex: 1; min-width: 140px; }
.cat-row-child { padding-left: 24px; }

/* 노트 이미지 업로드 */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.editor-toolbar .hint { margin: 0; }
.editor-toolbar label.btn { cursor: pointer; }
textarea.dragging { outline: 2px dashed var(--accent); outline-offset: -2px; }
.note-body .post-image { margin: 14px 0; }

/* ── ABOUT (아코디언) ────────────────────────────────── */
.about-lead { margin: -8px 0 20px; color: var(--muted); }
.accordion { display: flex; flex-direction: column; gap: 10px; }
.acc-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.acc-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary::after {
    content: '+';
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--muted);
    transition: transform .2s ease;
}
.acc-item[open] summary::after { transform: rotate(45deg); }
.acc-item summary:hover { background: var(--bg); }
.acc-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.acc-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); }

.about-list { margin: 14px 0 0; padding-left: 20px; }
.about-list li { margin-bottom: 6px; }
.about-dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px 16px;
    margin: 14px 0 0;
}
.about-dl dt { font-weight: 600; }
.about-dl dd { margin: 0; color: var(--muted); }
@media (max-width: 560px) {
    .about-dl { grid-template-columns: 1fr; gap: 2px; }
    .about-dl dd { margin-bottom: 10px; }
}
.about-note { margin: 14px 0 0; font-size: .88rem; }
.about-sub { margin: 24px 0 10px; font-size: 1rem; }
.about-table td:first-child { width: 130px; font-weight: 600; }

.feature-list { margin: 14px 0 0; padding: 0; list-style: none; }
.feature-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list .muted { white-space: normal; flex-basis: 100%; padding-left: 46px; }
.state {
    padding: 1px 8px;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 999px;
}
.state-done { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.state-plan { color: var(--muted);   background: var(--bg); border: 1px solid var(--border); }

/* ── 마이페이지 메뉴 4개 배치 ────────────────────────── */
.menu-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .menu-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .menu-grid { grid-template-columns: 1fr; } }

/* ── 내 일정 (달력) ──────────────────────────────────── */
:root {
    --c-blue:   #2f6fed;
    --c-green:  #1f9d55;
    --c-yellow: #c98a00;
    --c-red:    #d64545;
    --c-purple: #8b5cf6;
    --c-gray:   #6b7280;
    --holiday:  #c8352e;
    --line:     #b9bec6;
}
@media (prefers-color-scheme: dark) {
    :root { --line: #3a3f48; --holiday: #ff6b63; }
}

.planner {
    padding: 28px 28px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* 상단: 큰 월 숫자 + 연도 + 영어 월 이름 */
.planner-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.planner-title { display: flex; align-items: flex-end; gap: 12px; }
.planner-month {
    font-size: 5.2rem;
    font-weight: 500;
    line-height: .82;
    letter-spacing: -.04em;
}
.planner-sub { display: flex; flex-direction: column; gap: 2px; padding-bottom: 2px; }
.planner-year { font-size: 1rem; font-weight: 500; }
.planner-name {
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: .18em;
    text-transform: uppercase;
    line-height: 1;
}
.planner-nav { display: flex; align-items: center; gap: 4px; }
.planner-nav a {
    min-width: 34px;
    padding: 4px 10px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--muted);
    border-radius: 6px;
}
.planner-nav a:hover { text-decoration: none; color: var(--text); background: var(--bg); }
.planner-nav .planner-today { font-size: .75rem; letter-spacing: .12em; }

/* 요일 + 날짜 칸: 바깥 테두리 없이 세로선 · 가로선만 */
.planner-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}
.planner-wd {
    padding: 0 0 8px;
    text-align: center;
    font-size: .74rem;
    letter-spacing: .16em;
    color: var(--muted);
}
.planner-wd.red { color: var(--holiday); }

.planner-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 112px;
    padding: 8px 8px 10px;
    color: var(--text);
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    transition: background .12s;
}
.planner-grid > .planner-cell:nth-child(7n + 1) { border-left: none; }   /* 일요일 칸: 왼쪽 선 없음 */
.planner-grid > .planner-cell:nth-child(-n + 14) { border-top: none; }  /* 첫째 주: 위쪽 선 없음 */
a.planner-cell:hover { text-decoration: none; background: var(--bg); }
.planner-cell.selected { background: var(--accent-bg); }

.planner-date { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.planner-num { font-size: .82rem; }
.planner-cell.red .planner-num { color: var(--holiday); }
.planner-holiday { font-size: .78rem; color: var(--holiday); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planner-cell.today .planner-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin: -3px 0 0 -4px;
    color: #fff;
    background: var(--text);
    border-radius: 999px;
    font-weight: 700;
}
.planner-cell.today.red .planner-num { background: var(--holiday); }

/* 칸 안의 일정 */
.ev {
    display: block;
    padding-left: 10px;
    position: relative;
    font-size: .74rem;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ev::before {
    content: '';
    position: absolute;
    left: 0;
    top: .5em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--chip);
}
.ev b { font-weight: 700; margin-right: 2px; }
.ev.done { text-decoration: line-through; opacity: .5; }
.ev-more { font-size: .72rem; color: var(--muted); padding-left: 10px; }

.ev-blue,   .dot-blue,   .swatch-blue   { --chip: var(--c-blue); }
.ev-green,  .dot-green,  .swatch-green  { --chip: var(--c-green); }
.ev-yellow, .dot-yellow, .swatch-yellow { --chip: var(--c-yellow); }
.ev-red,    .dot-red,    .swatch-red    { --chip: var(--c-red); }
.ev-purple, .dot-purple, .swatch-purple { --chip: var(--c-purple); }
.ev-gray,   .dot-gray,   .swatch-gray   { --chip: var(--c-gray); }

.planner-help { margin: 14px 0 0; font-size: .8rem; color: var(--muted); }

@media (max-width: 720px) {
    .planner { padding: 18px 10px 14px; }
    .planner-month { font-size: 3.4rem; }
    .planner-name { font-size: 1.1rem; }
    .planner-cell { min-height: 70px; padding: 4px 3px; }
    .planner-wd { font-size: .62rem; letter-spacing: .05em; }
    .planner-holiday { display: none; }
    .ev { font-size: 0; padding: 0; height: 8px; }          /* 좁은 화면: 일정은 점으로만 */
    .ev::before { top: 1px; left: 2px; }
    .ev-more { font-size: .62rem; padding-left: 2px; }
}

/* 다가오는 일정 */
.planner-upcoming {
    margin-top: 20px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.planner-upcoming h2 { margin: 0 0 8px; font-size: 1rem; }
.upcoming { margin: 0; padding: 0; list-style: none; }
.upcoming li { border-bottom: 1px dashed var(--border); }
.upcoming li:last-child { border-bottom: none; }
.upcoming a {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 0 8px;
    align-items: center;
    padding: 8px 0;
    color: var(--text);
}
.upcoming a:hover { text-decoration: none; }
.upcoming a:hover .up-title { color: var(--accent); }
.upcoming .muted { grid-column: 2; font-size: .78rem; }
.upcoming a.done .up-title { text-decoration: line-through; opacity: .6; }
.up-title { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chip); }
.day-memo { margin: -4px 0 8px 20px; font-size: .82rem; color: var(--muted); }
.day-empty { margin: 4px 0 8px; }
.day-add { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* 날짜 창 (모달) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .45);
}
.modal-dismiss { position: absolute; inset: 0; }
.modal {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.modal-head h2 .muted { font-size: .9rem; font-weight: 400; }
.modal-head .drawer-close:hover { text-decoration: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-delete { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

.sched-form { display: flex; flex-direction: column; gap: 10px; }
.sched-form input[type="text"],
.sched-form input[type="date"],
.sched-form input[type="time"],
.sched-form textarea {
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.sched-form textarea { resize: vertical; }
.sched-title { font-size: 1.05rem !important; font-weight: 600; }
.sched-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sched-row label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.sched-form .hint { margin: -4px 0 0; }
.sched-form .checkbox { margin: 0; }

.sched-colors { display: flex; gap: 8px; }
.swatch {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--chip);
    cursor: pointer;
}
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--chip); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 3px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}




/* ── RASPBERRY PI (강의실 환경 모니터링) ─────────────── */
:root {
    --st-ok:   #1f9d55;
    --st-warn: #b7791f;
    --st-crit: #c53030;
    --st-off:  #6b7280;
    --lamp:    #d69e2e;
}
@media (prefers-color-scheme: dark) {
    :root { --st-ok: #48bb78; --st-warn: #ecc94b; --st-crit: #fc8181; --st-off: #a0aec0; --lamp: #f6c453; }
}
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

.sensor-now { margin-bottom: 20px; }
.sensor-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 12px;
    font-size: .9rem;
}
.sensor-tiles { grid-template-columns: repeat(4, 1fr); margin-bottom: 0; }
@media (max-width: 720px) { .sensor-tiles { grid-template-columns: repeat(2, 1fr); } }
.stat-num small { font-size: .9rem; font-weight: 600; margin-left: 2px; color: var(--muted); }
.stat-time { font-size: 1.4rem; }

/* 상태 표시: 아이콘 + 글자 + 색 (색만으로 구분하지 않음) */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 999px;
    color: var(--st, var(--st-off));
    background: color-mix(in srgb, var(--st, var(--st-off)) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--st, var(--st-off)) 35%, transparent);
}
.status-ok   { --st: var(--st-ok); }
.status-warn { --st: var(--st-warn); }
.status-crit { --st: var(--st-crit); }
.status-off  { --st: var(--st-off); }

/* 기간 선택 */
.range-tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.range-tabs a {
    padding: 6px 16px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--muted);
    border-radius: 7px;
}
.range-tabs a:hover { text-decoration: none; color: var(--text); }
.range-tabs a.active { color: var(--text); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); }

/* 그래프 */
.chart-card {
    margin-bottom: 16px;
    padding: 18px 20px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    margin-bottom: 6px;
}
.chart-head h2 { margin: 0; font-size: 1.05rem; }
.chart-head .muted { font-size: .82rem; }
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .tick { stroke: var(--muted); stroke-width: 1; }
.chart-svg .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line-dot { fill: var(--accent); }
.chart-svg .last-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-svg .threshold { stroke: var(--st-crit); stroke-width: 1.25; stroke-dasharray: 5 4; opacity: .8; }
.chart-svg .threshold-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-svg .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-svg .hover-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-svg .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.chart-tip {
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    font-size: .8rem;
    line-height: 1.35;
    white-space: nowrap;
    pointer-events: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.chart-tip[hidden] { display: none; }
.chart-tip strong { font-size: .95rem; }
.chart-tip span { color: var(--muted); }
.chart-empty { text-align: center; margin: -8px 0 6px; }
.chart-table { margin-top: 8px; font-size: .85rem; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table .table-wrap { max-height: 320px; overflow-y: auto; margin-top: 8px; }
.chart-table .board-table th,
.chart-table .board-table td { padding: 6px 12px; }

/* 전등 달력 (내 일정 달력 모양 재사용) */
.lightcal { margin: 20px 0 16px; }
.lightcal .planner-name { font-size: 1.1rem; letter-spacing: .08em; }
.lightcal .planner-cell { min-height: 76px; }
.lightcal .planner-cell[style] {
    background: color-mix(in srgb, var(--lamp) calc(var(--on) * 45%), transparent);
}
.light-on   { margin-top: auto; font-size: .78rem; color: var(--text); }
.light-on b { font-weight: 700; }
.light-off  { margin-top: auto; font-size: .78rem; color: var(--muted); }
.light-none { margin-top: auto; font-size: .78rem; color: var(--muted); opacity: .5; }
@media (max-width: 720px) {
    .lightcal .planner-cell { min-height: 56px; }
    .light-on, .light-off { font-size: .62rem; }
}

/* 위험 기록 · 판단 기준 */
.risk-card, .criteria-card { margin-bottom: 16px; }
.risk-list { margin: 0; padding: 0; list-style: none; }
.risk-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}
.risk-list li:last-child { border-bottom: none; }
.risk-time { font-weight: 600; font-size: .9rem; }
.criteria-card .card-list li { justify-content: flex-start; gap: 12px; }