*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg2: #f7f7f5;
  --bg3: #f0efe8;
  --text: #1a1a1a;
  --text2: #555;
  --text3: #999;
  --border: rgba(0,0,0,0.1);
  --border2: rgba(0,0,0,0.15);
  --p1: #E24B4A;
  --p2: #BA7517;
  --p3: #185FA5;
  --work: #185FA5;
  --exercise: #3B6D11;
  --home: #854F0B;
  --personal: #533AB7;
  --radius: 8px;
  --radius-lg: 12px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg3); color: var(--text); height: 100vh; overflow: hidden; }

.shell { display: flex; height: 100vh; }

.sidebar { width: 200px; min-width: 200px; background: var(--bg2); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; padding: 1rem 0; overflow-y: auto; }
.logo { padding: 0 1rem 1rem; font-size: 15px; font-weight: 500; border-bottom: 0.5px solid var(--border); margin-bottom: 0.5rem; }
.logo span { font-size: 11px; color: var(--text3); display: block; font-weight: 400; margin-top: 2px; }
.ns { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); padding: 10px 1rem 3px; }
.ni { display: flex; align-items: center; gap: 8px; padding: 7px 1rem; font-size: 13px; color: var(--text2); cursor: pointer; border-left: 2px solid transparent; }
.ni:hover { background: var(--bg); color: var(--text); }
.ni.active { background: var(--bg); color: var(--text); font-weight: 500; border-left-color: var(--text); }
.ni i { font-size: 15px; }
.nb { font-size: 10px; padding: 1px 6px; border-radius: 20px; background: #FCEBEB; color: #A32D2D; margin-left: auto; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar { padding: 0.75rem 1.25rem; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 15px; font-weight: 500; }
.topbar-date { font-size: 13px; color: var(--text3); flex: 1; }
.btn-add { font-size: 13px; padding: 6px 12px; border: 0.5px solid var(--border2); border-radius: var(--radius); background: var(--text); color: var(--bg); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-add:hover { opacity: 0.85; }

.view { flex: 1; overflow-y: auto; padding: 1.25rem; }
.hidden { display: none; }

.pa-note { background: var(--bg2); border-left: 3px solid var(--text); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 1.25rem; }
.pa-note-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.pa-note-text { font-size: 13px; color: var(--text); line-height: 1.6; }

.section-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin: 1.25rem 0 0.5rem; }
.section-lbl:first-child { margin-top: 0; }

.task { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; border: 0.5px solid transparent; }
.task:hover { background: var(--bg2); border-color: var(--border); }
.task.done .task-title { text-decoration: line-through; color: var(--text3); }

.check { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--border2); flex-shrink: 0; margin-top: 2px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.check:hover { border-color: var(--text); }
.check.p1 { border-color: var(--p1); }
.check.p2 { border-color: var(--p2); }
.check.p3 { border-color: var(--p3); }
.check.checked { background: var(--text); border-color: var(--text); color: white; font-size: 11px; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 13px; color: var(--text); line-height: 1.4; }
.task-meta { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 20px; border: 0.5px solid var(--border2); color: var(--text3); }
.tag-work { background: #E6F1FB; color: #0C447C; border-color: #B5D4F4; }
.tag-exercise { background: #EAF3DE; color: #3B6D11; border-color: #C0DD97; }
.tag-home { background: #FAEEDA; color: #854F0B; border-color: #FAC775; }
.tag-personal { background: #EEEDFE; color: #3C3489; border-color: #CECBF6; }
.tag-overdue { background: #FCEBEB; color: #A32D2D; border-color: #F7C1C1; }
.task-date { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 3px; }
.task-date.overdue { color: var(--p1); }

.task-del { font-size: 13px; color: var(--text3); opacity: 0; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.task:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--p1); background: #FCEBEB; }

.empty { text-align: center; color: var(--text3); font-size: 13px; padding: 3rem 1rem; }

.chat-wrap { display: flex; flex-direction: column; height: 100%; }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 1rem; }
.msg { max-width: 75%; }
.msg-pa { align-self: flex-start; }
.msg-me { align-self: flex-end; }
.msg-label { font-size: 10px; color: var(--text3); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .06em; }
.msg-me .msg-label { text-align: right; }
.msg-bubble { font-size: 13px; line-height: 1.6; padding: 10px 14px; border-radius: var(--radius-lg); }
.msg-pa .msg-bubble { background: var(--bg2); color: var(--text); border-radius: 4px 12px 12px 12px; }
.msg-me .msg-bubble { background: var(--text); color: white; border-radius: 12px 4px 12px 12px; }
.msg-bubble.loading { color: var(--text3); font-style: italic; }

.chat-input-row { display: flex; gap: 8px; padding-top: 1rem; border-top: 0.5px solid var(--border); margin-top: auto; }
.chat-input-row input { flex: 1; font-size: 13px; height: 38px; border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 0 12px; background: var(--bg); color: var(--text); outline: none; }
.chat-input-row input:focus { border-color: var(--text); }
.send-btn { width: 38px; height: 38px; border-radius: var(--radius); background: var(--text); border: none; color: white; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.send-btn:hover { opacity: 0.85; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); align-items: center; justify-content: center; z-index: 100; }
.modal-bg:not(.hidden) { display: flex; }
.modal { background: var(--bg); border-radius: var(--radius-lg); border: 0.5px solid var(--border2); padding: 1.5rem; width: 420px; max-width: 95vw; }
.modal-title { font-size: 15px; font-weight: 500; margin-bottom: 1.25rem; }
.modal-field { margin-bottom: 0.875rem; }
.modal-field label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); display: block; margin-bottom: 4px; }
.modal-field input, .modal-field select, .modal-field textarea { width: 100%; font-size: 13px; border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 7px 10px; background: var(--bg); color: var(--text); font-family: inherit; outline: none; }
.modal-field input:focus, .modal-field select:focus, .modal-field textarea:focus { border-color: var(--text); }
.modal-field textarea { resize: none; height: 70px; }
.modal-row { display: flex; gap: 12px; }
.modal-row .modal-field { flex: 1; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; }
.btn-cancel { font-size: 13px; padding: 7px 16px; border: 0.5px solid var(--border2); border-radius: var(--radius); background: transparent; color: var(--text2); cursor: pointer; }
.btn-save { font-size: 13px; padding: 7px 16px; border: none; border-radius: var(--radius); background: var(--text); color: white; cursor: pointer; }
.btn-save:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .sidebar { display: none; }
  .shell { flex-direction: column; }
  .main { height: 100vh; }
}

#view-iframe { padding: 0; height: calc(100vh - 49px); }
#view-iframe iframe { height: 100%; }

#view-calendar { padding: 0 !important; height: calc(100vh - 49px) !important; }
#view-calendar iframe { width: 100% !important; height: 100% !important; border: none !important; display: block; }
