/* 기본 설정 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background-color: #fcfaf7;
    color: #413a33;
    font-family: "Pretendard", "Malgun Gothic", sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

/* 공통 레이아웃 */
.dashboard-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 228px;
    min-width: 228px;
    background-color: #fbf9f6;
    border-right: 1px solid #ede7df;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 22px 14px;
}
.main-area { width: calc(100% - 228px); min-width: 0; }
.dashboard-content {
    max-width: var(--page-width, 1420px);
    margin: 0 auto;
    padding: 28px 28px 45px;
}

/* 왼쪽 메뉴 */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 6px 30px;
}
.sidebar-logo { font-size: 37px; line-height: 1; color: #9c795e; }
.sidebar-header h2 { font-size: 15px; font-weight: 700; color: #322d29; }
.sidebar-header span { color: #a89e94; font-size: 11px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav > a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #6d655d;
    font-size: 12px;
}
.sidebar-nav > a > span { font-size: 19px; width: 22px; text-align: center; }
.sidebar-nav > a:hover { background-color: #f3ede6; color: #44362b; }
.sidebar-nav > a.active { background-color: #f1eae1; color: #73533b; font-weight: 700; }
.sidebar-nav > a.sidebar-rule {
    margin-top: 16px;
    border-top: 1px solid #ece5dc;
    border-radius: 0;
    padding-top: 20px;
}
.sidebar-footer { margin-top: auto; padding: 35px 11px 5px; }
.sidebar-footer img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 8px;
}
.sidebar-footer p {
    margin-top: 16px;
    text-align: center;
    color: #8d7259;
    font-size: 12px;
    line-height: 1.9;
}
.sidebar-footer span {
    display: block;
    margin-top: 8px;
    text-align: center;
    font-size: 10px;
    color: #b2a89d;
}

/* 상단 이미지와 제목 */
.top-banner {
    position: relative;
    height: 192px;
    background: linear-gradient(to right, rgba(255,255,255,0.03),rgba(70,52,34,0.05)), url('../images/banner.jpg') center center / cover no-repeat;
}
.banner-message {
    position: absolute;
    right: 48px;
    top: 55px;
    color: #fef9f0;
    font-size: 19px;
    font-style: italic;
    letter-spacing: 3px;
    line-height: 1.8;
    text-align: right;
    text-shadow: 0 1px 6px rgba(54,42,34,.5);
}
.mobile-menu { display: none; }
.intro-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}
.intro-heading { display: flex; align-items: center; gap: 15px; }
.intro-heading > span { font-size: 42px; line-height: 1.1; color: #d4a053; }
.intro-heading h1 {
    font-weight: 800;
    font-size: 28px;
    color: #362f29;
    letter-spacing: -1px;
}
.intro-section > div:first-child > p { margin-left: 58px; color: #887e72; font-size: 13px; }
.date-message { text-align: right; color: #8f8173; font-size: 11px; }
.date-message > span { color: #605449; }
.date-message p {
    margin-top: 7px;
    padding: 7px 12px;
    background-color: #f4ede2;
    border-radius: 9px;
    line-height: 1.7;
}
.preview-message {
    padding: 8px 14px;
    margin-bottom: 14px;
    background-color: #f7f1e7;
    border: 1px solid #eee5da;
    border-radius: 7px;
    color: #8d7763;
    font-size: 11px;
}
.preview-message > span {
    margin-right: 9px;
    font-weight: 700;
    color: #af775d;
    letter-spacing: 1px;
}

/* 상단 진행률·D-DAY·사진 카드 */
.summary-section {
    display: grid;
    grid-template-columns: 1fr 1fr 0.92fr;
    gap: 14px;
    margin-bottom: 16px;
}
.summary-card {
    min-height: 150px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px;
    background-color: #faf6ef;
    border: 1px solid #f1e9df;
    border-radius: 13px;
}
.summary-card h3 { font-size: 13px; font-weight: 600; color: #746151; }
.summary-card p { margin: 8px 0; font-size: 12px; }
.summary-card p strong { font-weight: 700; font-size: 19px; color: #39332e; }
.summary-card p span { color: #98897b; }
.summary-card a { color: #91816e; font-size: 11px; }
.summary-card a span { margin-left: 6px; }
.progress-ring {
    width: 100px;
    height: 100px;
    min-width: 100px;
    border-radius: 50%;
    background: conic-gradient(#83a68a 0%, #ebe5dd 0% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.progress-ring::before {
    content: '';
    position: absolute;
    inset: 12px;
    background-color: #faf6ef;
    border-radius: 50%;
}
.progress-ring > strong {
    position: relative;
    z-index: 1;
    font-size: 24px;
    color: #54463b;
}
.summary-symbol { font-size: 39px; }
.nearest-date {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 5px;
}
.nearest-date > span { color: #9a8a7b; font-size: 11px; }
.nearest-date > b { color: #da797b; font-size: 24px; letter-spacing: -1px; }
.summary-mood {
    min-height: 150px;
    position: relative;
    overflow: hidden;
    border-radius: 13px;
}
.summary-mood img { width: 100%; height: 100%; object-fit: cover; }
.summary-mood > div {
    position: absolute;
    right: 17px;
    bottom: 14px;
    color: white;
    font-size: 15px;
    text-align: right;
    line-height: 1.8;
    text-shadow: 0 1px 5px rgba(40,30,20,.65);
}

/* 카드 공통 */
.content-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-top { grid-template-columns: minmax(0, calc(var(--todo-width, 54%) - 8px)) minmax(0, 1fr); }
.grid-middle { grid-template-columns: 1fr; }
.grid-lower { grid-template-columns: minmax(0, calc(var(--project-width, 50%) - 8px)) minmax(0, 1fr); }
.panel {
    min-width: 0;
    background-color: #fffefc;
    border: 1px solid #eee9e2;
    border-radius: 13px;
    padding: 17px;
    box-shadow: 0 5px 22px rgba(89,70,51,.025);
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-bottom: 13px;
    border-bottom: 1px solid #f0ece6;
}
.panel-header h2 {
    font-weight: 700;
    font-size: 15px;
    color: #37312c;
    letter-spacing: -.3px;
}
.panel-header h2 span { margin-right: 5px; font-size: 20px; vertical-align: -1px; }
.panel-header > a { white-space: nowrap; color: #8d7e70; font-size: 11px; }
.panel-header > a:hover, .panel-footer a:hover { color: #6c906f; text-decoration: underline; }
.panel-header > a.small-button {
    padding: 6px 11px;
    border: 1px solid #e2d8ca;
    border-radius: 16px;
    color: #786757;
}
.panel-description { font-size: 11px; color: #96877a; margin: 12px 0; }
.panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: #afa194;
    font-size: 10px;
}
.panel-footer a { font-size: 11px; }
.panel-footer-right { justify-content: flex-end; }

/* 오늘의 TODO */
.todo-information {
    display: flex;
    justify-content: space-between;
    margin: 12px 0 9px;
    color: #a19487;
    font-size: 11px;
}
.todo-information > span:last-child { color: #738f7a; font-weight: 600; }
.todo-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 11px;
    border-bottom: 1px solid #efe9e0;
}
.todo-tab {
    padding: 8px 12px;
    margin-bottom: -1px;
    background-color: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #9a8b7e;
    font-size: 12px;
    font-weight: 600;
}
.todo-tab.active { color: #78604a; border-bottom-color: #b99574; }
.todo-tab:hover { color: #614b3b; }
.todo-tab span {
    margin-left: 5px;
    color: #a79b91;
    font-size: 10px;
    font-weight: 400;
}
.todo-list { min-height: 144px; }
.todo-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 6px 8px;
    border-bottom: 1px solid #f5f1ed;
}
.todo-row:last-child { border-bottom: none; }
.todo-row .todo-mark { width: 16px; color: #b4aaa0; font-size: 14px; }
.todo-row .todo-title { flex: 1; font-size: 12px; min-width: 0; }
.todo-row select {
    min-width: 75px;
    padding: 5px;
    border: 0;
    border-radius: 20px;
    background-color: #eeefef;
    text-align: center;
    font-size: 11px;
    color: #6e706f;
}
.todo-row select:focus { outline: 2px solid #c4d5c1; }
.todo-row select.status-completed { background-color: #e3f2e6; color: #48855e; }
.todo-row select.status-started { background-color: #e6f0fb; color: #3878ae; }
.todo-row select.status-paused { background-color: #fff0db; color: #a57434; }
.todo-row.status-completed { background-color: #f6fbf7; }
.todo-row.status-completed .todo-mark { color: #719b7d; }
.todo-row.status-completed .todo-title { color: #9ca69d; text-decoration: line-through; text-decoration-color: #9ca69d; }
.todo-empty {
    padding: 28px 8px;
    text-align: center;
    color: #aaa095;
    font-size: 12px;
}

/* D-DAY */
.dday-list { margin-top: 10px; }
.dday-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    border-bottom: 1px solid #f3efeb;
}
.dday-row .dday-kind {
    min-width: 39px;
    border-radius: 20px;
    padding: 3px 7px;
    text-align: center;
    font-size: 10px;
    background-color: #f7ede7;
    color: #b57965;
}
.dday-row .dday-kind.test { background-color: #fceae9; color: #c36c6f; }
.dday-row .dday-kind.eval { background-color: #eaf5ec; color: #688c6d; }
.dday-row .dday-name { flex: 1; font-size: 11px; color: #544940; }
.dday-row .dday-date { color: #a49a8f; font-size: 10px; white-space: nowrap; }
.dday-row .dday-count {
    min-width: 49px;
    text-align: right;
    font-size: 13px;
    color: #d77978;
    font-weight: 700;
}
.notice-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background-color: #f9f5ee;
    border-radius: 8px;
    color: #887965;
    font-size: 10px;
}
.notice-bar span { font-size: 18px; }

/* 프로젝트 */
.project-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}
.project-card {
    overflow: hidden;
    border: 1px solid #f0e9e0;
    border-radius: 9px;
    background-color: #fff;
}
.project-card:hover { border-color: #c7b7a5; }
.project-card img { width: 100%; height: 110px; object-fit: cover; }
.project-card > div { padding: 10px; }
.project-type {
    display: inline-block;
    padding: 2px 6px;
    margin-bottom: 4px;
    border-radius: 5px;
    background-color: #eee8f7;
    color: #75668a;
    font-size: 10px;
}
.project-type.team { background-color: #e7eff6; color: #547c93; }
.project-card h3 { font-size: 11px; color: #453a30; }
.project-card p { margin-top: 3px; color: #a09589; font-size: 10px; }

/* 필기 노트 */
.note-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.note-card {
    min-width: 0;
    border: 1px solid #f0e9e2;
    border-radius: 9px;
    overflow: hidden;
}
.note-card:hover { border-color: #c1af99; }
.note-card img { width: 100%; height: 190px; object-fit: cover; }
.note-card strong {
    display: block;
    padding: 9px 10px 0;
    font-size: 13px;
    font-weight: 600;
}
.note-card span {
    display: block;
    padding: 1px 10px 12px;
    color: #ae9f90;
    font-size: 11px;
}

/* 수업 이력 */
.history-table-box { width: 100%; overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.history-table th {
    padding: 9px 5px;
    text-align: left;
    background-color: #f9f6f2;
    color: #a3978b;
    font-size: 11px;
}
.history-table td {
    padding: 12px 5px;
    border-bottom: 1px solid #f4efe9;
    color: #6c6055;
    font-size: 10px;
}
.history-table th:nth-child(1) { width: 14%; }
.history-table th:nth-child(2) { width: 20%; }
.history-table th:nth-child(3) { width: 48%; }
.history-table th:nth-child(4) { width: 18%; }
.history-table td:last-child a { color: #78977a; white-space: nowrap; }
.history-subject { padding: 3px 6px; border-radius: 5px; }
.history-subject.spring { background-color: #e9f5e9; color: #5f8760; }
.history-subject.jsp { background-color: #eeeafb; color: #8069a6; }
.history-subject.oracle { background-color: #f7eae2; color: #b47f60; }

/* 달력 */
.calendar-panel { margin-top: 2px; }
.calendar-layout {
    display: grid;
    grid-template-columns: 1fr 205px;
    gap: 14px;
    padding-top: 12px;
}
.calendar-content { min-width: 0; }
.calendar-top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
}
.calendar-title { display: flex; align-items: center; justify-content: center; gap: 22px; }
.calendar-title strong { font-size: 21px; font-weight: 750; color: #51453c; }
.calendar-title button {
    width: 30px;
    height: 30px;
    background: none;
    border: 0;
    color: #8e8073;
    font-size: 25px;
    line-height: 1;
}
.calendar-title button:hover { color: #5e4939; }
#btnToday {
    position: absolute;
    right: 0;
    padding: 5px 13px;
    background-color: #fff;
    border: 1px solid #eae3d9;
    border-radius: 7px;
    color: #8e8073;
    font-size: 11px;
}
.calendar-days, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-days > span {
    padding: 7px;
    text-align: center;
    color: #9d9186;
    font-size: 11px;
}
.calendar-days > span:first-child { color: #c8837f; }
.calendar-grid { border-top: 1px solid #ece6dd; border-left: 1px solid #ece6dd; }
.calendar-day {
    min-height: 74px;
    padding: 5px;
    border-right: 1px solid #ece6dd;
    border-bottom: 1px solid #ece6dd;
    background-color: #fffefc;
    text-align: right;
}
.calendar-day.outside { background-color: #f9f7f4; color: #c5bdb3; }
.calendar-day.today .day-number { background-color: #b99270; color: white; border-radius: 50%; }
.calendar-day.selected { background-color: #faf2e8; box-shadow: inset 0 0 0 1px #d4ba9e; }
.calendar-day.drag-over { background-color: #e3f3e6; box-shadow: inset 0 0 0 2px #83a78c; }
.calendar-day .day-number {
    width: 23px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}
.calendar-event {
    display: block;
    margin-top: 4px;
    border-radius: 3px;
    background-color: #f7e7e3;
    color: #a86c64;
    font-size: 9px;
    padding: 2px 3px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: grab;
}
.calendar-event:active { cursor: grabbing; }
.calendar-event { touch-action: none; }
.calendar-event.dragging { opacity: .5; }
.calendar-event.study { background-color: #e9f3e9; color: #658c6b; }
.calendar-guide { padding-bottom: 8px; color: #9a8d80; font-size: 11px; }
.calendar-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-top: 11px;
    font-size: 10px;
    color: #978c80;
}
.calendar-bottom a { color: #7b9680; white-space: nowrap; }
.calendar-mood {
    position: relative;
    min-height: 100%;
    overflow: hidden;
    border-radius: 10px;
}
.calendar-mood img { width: 100%; height: 100%; object-fit: cover; }
.calendar-mood p {
    position: absolute;
    bottom: 23px;
    left: 17px;
    color: #7c6b58;
    font-size: 16px;
    font-style: italic;
    line-height: 1.6;
    text-shadow: 0 1px 8px white;
}
.main-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #ede6de;
    color: #a59b8f;
    font-size: 11px;
}

/* 화면 크기에 따른 조정 */
@media (max-width: 1260px) {
    .sidebar { width: 198px; min-width: 198px; }
    .main-area { width: calc(100% - 198px); }
    .dashboard-content { padding: 24px 18px 35px; }
    .summary-card { padding: 15px; gap: 12px; }
    .progress-ring { width: 80px; height: 80px; min-width: 80px; }
    .progress-ring strong { font-size: 20px; }
    .calendar-layout { grid-template-columns: 1fr 155px; }
}
@media (max-width: 1050px) {
    .grid-top, .grid-middle, .grid-lower { grid-template-columns: 1fr; }
    .summary-section { grid-template-columns: 1fr 1fr; }
    .summary-mood { display: none; }
    .project-card img { height: 160px; }
    .note-card img { height: 185px; }
}
@media (max-width: 760px) {
    .sidebar {
        display: none;
        width: 240px;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 10;
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0,0,0,.1);
    }
    .sidebar.open { display: flex; }
    .main-area { width: 100%; }
    .top-banner { height: 137px; }
    .mobile-menu {
        display: block;
        position: absolute;
        top: 12px;
        left: 12px;
        border: 0;
        background-color: rgba(255,255,255,.85);
        border-radius: 8px;
        padding: 6px 10px;
        font-size: 19px;
    }
    .banner-message { top: 43px; right: 17px; font-size: 13px; }
    .dashboard-content { padding: 20px 12px 30px; }
    .intro-heading h1 { font-size: 21px; }
    .intro-heading > span { font-size: 30px; }
    .intro-section > div:first-child > p { margin-left: 45px; }
    .date-message { display: none; }
    .summary-section { grid-template-columns: 1fr 1fr; gap: 9px; }
    .summary-card { min-height: 130px; gap: 9px; padding: 12px; }
    .progress-ring { width: 58px; height: 58px; min-width: 58px; }
    .progress-ring::before { inset: 8px; }
    .progress-ring strong { font-size: 15px; }
    .summary-symbol { display: none; }
    .summary-card h3 { font-size: 11px; }
    .summary-card p strong { font-size: 14px; }
    .nearest-date { display: block; }
    .nearest-date > b { display: block; font-size: 17px; }
    .calendar-layout { grid-template-columns: 1fr; }
    .calendar-mood { display: none; }
    .calendar-day { min-height: 59px; }
    .calendar-title { gap: 9px; }
    .calendar-title strong { font-size: 17px; }
    .calendar-title button { width: 24px; font-size: 22px; }
    #btnToday { padding: 4px 7px; font-size: 10px; }
    .calendar-event { font-size: 8px; }
    .todo-row { gap: 5px; padding: 6px 4px; }
    .todo-row .todo-title { font-size: 11px; }
    .todo-row select { min-width: 70px; font-size: 10px; }
    .note-card img { height: 125px; }
    .panel { padding: 12px; }
    .panel-header h2 { font-size: 13px; }
    .panel-header h2 span { font-size: 16px; }
    .dday-row { gap: 5px; }
    .dday-row .dday-date { font-size: 9px; }
    .main-footer { font-size: 9px; }
}

/* 위젯 크기 조절: 슬라이더를 드래그하면 칸의 너비가 달라집니다. */
.layout-tools {
    margin-bottom: 16px;
    padding: 10px 15px;
    background-color: #faf6ef;
    border: 1px solid #efe6d9;
    border-radius: 10px;
}
.layout-tools > summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #806a55; }
.layout-tools > summary span { margin-left: 10px; color: #a3978b; font-weight: 400; font-size: 11px; }
.layout-sliders {
    display: grid;
    grid-template-columns: minmax(170px, 240px) minmax(150px, 1fr);
    gap: 14px 18px;
    margin-top: 16px;
    align-items: center;
}
.layout-sliders label { font-size: 12px; color: #6c5c4d; }
.layout-sliders label b { margin-left: 7px; font-size: 11px; font-weight: 600; color: #7b9b7e; }
.layout-sliders input { width: 100%; accent-color: #8aa48b; cursor: pointer; }
.layout-reset { grid-column: 1 / -1; text-align: right; }
.layout-reset button {
    padding: 6px 13px;
    border: 1px solid #ded4c6;
    border-radius: 7px;
    background-color: white;
    color: #7b6b5b;
    font-size: 11px;
}
.layout-tools > p { margin-top: 10px; color: #a09384; font-size: 10px; }
@media (max-width: 1050px) {
    .grid-top, .grid-lower { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .layout-sliders { grid-template-columns: 1fr; gap: 5px; }
    .layout-sliders input { margin-bottom: 10px; }
    .layout-reset { grid-column: 1; }
    .layout-tools > summary span { display: block; margin-left: 0; }
}

/* Notion 연동 알림 */
.preview-message.sync-error { border-color: #e2c6bb; background-color: #fff6f2; color: #a35546; }

/* Notion 임베드 및 배포 환경: API 인증 전에는 학습 화면을 표시하지 않음 */
.auth-required .dashboard-layout { display: none; }
.auth-screen[hidden] { display: none; }
.auth-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 28px; background: #f5f2ed;
}
.auth-box {
    width: 100%; max-width: 430px; padding: 38px;
    border: 1px solid #e9dfd2; border-radius: 18px; background: #fffdfa;
    box-shadow: 0 16px 38px rgba(93, 74, 53, .09);
}
.auth-icon { color: #a58968; font-size: 42px; text-align: center; }
.auth-box h1 { margin: 10px 0 12px; font-size: 24px; text-align: center; }
.auth-box > p { color: #746f69; font-size: 13px; line-height: 1.7; }
.auth-box > label { display: block; margin: 28px 0 8px; font-size: 13px; font-weight: 700; }
.auth-box input {
    width: 100%; padding: 12px 14px; border: 1px solid #d9cfc3;
    border-radius: 8px; background: #fff; font: inherit;
}
.auth-box button {
    width: 100%; margin-top: 14px; padding: 12px; border: none;
    border-radius: 8px; color: #fff; background: #9c826a;
    font: inherit; font-weight: 700; cursor: pointer;
}
.auth-box button:disabled { opacity: .6; cursor: wait; }
.auth-box .auth-error { min-height: 18px; color: #a33d3d; }
.auth-box small { display: block; color: #8d8880; font-size: 11px; }
