:root {
  --orange:       #E58A2B;
  --orange-dark:  #C96F16;
  --orange-light: #FFF3E8;
  --bg:           #F4F0E8;
  --card:         #FFFDFC;
  --line:         #E7DDD0;
  --text:         #4B443D;
  --muted:        #8A8178;
  --shadow:       0 8px 24px rgba(162,124,80,.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Noto Sans TC","Microsoft JhengHei",sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }

#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top,#f9f4ec 0%,#f4f0e8 55%,#efe8dd 100%); padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: rgba(255,253,252,.95); border: 1px solid var(--line); border-radius: 32px; box-shadow: var(--shadow); padding: 40px 30px; text-align: center; }
.logo-badge { display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--orange); color: var(--orange-dark); font-weight: 700; background: #fffdfa; margin-bottom: 22px; }
.login-card h1 { font-size: 1.8rem; margin-bottom: 10px; }
.login-card p { color: var(--muted); line-height: 1.6; margin-bottom: 24px; }
.primary-btn { background: var(--orange); color: white; border: none; padding: 13px 24px; border-radius: 999px; cursor: pointer; font-weight: 700; box-shadow: 0 8px 18px rgba(229,138,43,.22); transition: .2s; }
.primary-btn:hover { background: var(--orange-dark); transform: translateY(-1px); }

#main-app { display: none; }
.shell { max-width: 1380px; margin: 0 auto; padding: 22px; }

header { background: rgba(255,253,252,.92); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.brand h1 { font-size: 1.45rem; margin-bottom: 4px; }
.brand p  { color: var(--muted); font-size: .92rem; }
.user-area { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill { background: var(--orange-light); border: 1px solid #f2d7bc; color: var(--orange-dark); padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 600; }
.ghost-btn { background: white; border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 999px; cursor: pointer; transition: .15s; }
.ghost-btn:hover { border-color: var(--orange); color: var(--orange-dark); }

.toolbar { background: rgba(255,253,252,.92); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 16px; display: grid; grid-template-columns: 1.3fr 1fr 1fr auto auto; gap: 12px; margin-bottom: 16px; }
.toolbar select { border: 1px solid var(--line); border-radius: 14px; background: #fffdfa; color: var(--text); padding: 12px 14px; }
.mode-btn { border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--text); padding: 10px 20px; cursor: pointer; transition: .2s; }
.mode-btn.active { background: var(--orange); color: white; border-color: var(--orange); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab-btn { background: rgba(255,253,252,.92); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 999px; cursor: pointer; transition: .2s; }
.tab-btn.active, .tab-btn:hover { background: var(--orange); color: white; border-color: var(--orange); }

#add-task-form { background: rgba(255,253,252,.92); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.panel-title { font-size: 1rem; margin-bottom: 12px; color: var(--orange-dark); font-weight: 800; }
.add-grid { display: grid; grid-template-columns: 1.4fr .9fr .8fr 1fr 1fr auto auto; gap: 10px; }
.add-grid input, .add-grid select { border: 1px solid var(--line); border-radius: 14px; background: #fffdfa; color: var(--text); padding: 11px 14px; }

.main-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }

.pinned-panel { background: rgba(255,253,252,.92); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 18px; }
.pinned-list { display: flex; flex-direction: column; gap: 10px; }
.pin-item { border: 1px solid #f3d8bc; background: linear-gradient(180deg,#fffaf5,#fff3e8); border-radius: 18px; padding: 12px; }
.pin-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pin-badge { display: inline-block; font-size: .75rem; font-weight: 700; color: white; background: var(--orange); border-radius: 999px; padding: 4px 10px; }
.muted { color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); font-size: .92rem; padding: 8px 0; }

.content-area { display: flex; flex-direction: column; gap: 16px; }
.task-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.column, .calendar-card { background: rgba(255,253,252,.92); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 18px; }
.column h2 { font-size: 1.08rem; margin-bottom: 14px; }
.task-list { list-style: none; }

.task-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid #eee3d7; border-radius: 18px; margin-bottom: 10px; background: #fffdfa; }
.task-item.done { opacity: .55; }
.task-item.done .task-title { text-decoration: line-through; }
.task-item input[type=checkbox] { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--orange); cursor: pointer; }
.task-content { flex: 1; }
.task-title-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.task-title { font-weight: 700; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; align-items: center; }
.tag { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; border: 1px solid transparent; }
.tag-dept { background: #f6efe6; color: var(--text);        border-color: #eadfce; }
.tag-pin  { background: #fff1df; color: var(--orange-dark); border-color: #f4d3a8; }
.tag-date { background: #f8f4ee; color: #756b62;            border-color: #e5d9cb; }
.row-actions { display: flex; flex-direction: column; gap: 8px; }
.icon-btn { border: 1px solid var(--line); background: white; width: 38px; height: 38px; border-radius: 12px; cursor: pointer; transition: .15s; }
.icon-btn:hover { border-color: var(--orange); }
.icon-btn.pin-on { background: var(--orange-light); border-color: #f0cda3; }

.calendar-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.calendar-head h2 { font-size: 1.1rem; }
.calendar-nav { display: flex; gap: 8px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 10px; }
.weekday { text-align: center; color: var(--muted); font-size: .84rem; font-weight: 700; padding-bottom: 4px; }
.day-cell { min-height: 110px; background: #fffdfa; border: 1px solid #eee3d7; border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.day-cell.other-month { opacity: .32; }
.day-num { font-weight: 800; font-size: .92rem; }
.day-events { display: flex; flex-direction: column; gap: 5px; }
.event-chip { padding: 5px 8px; border-radius: 10px; background: var(--orange-light); color: var(--orange-dark); font-size: .72rem; font-weight: 700; line-height: 1.35; }
.event-chip.pin { background: #ffe3c3; border: 1px solid #f1c38b; }

@media (max-width:1180px) {
  .main-grid { grid-template-columns: 1fr; }
  .toolbar   { grid-template-columns: 1fr 1fr 1fr auto auto; }
  .add-grid  { grid-template-columns: 1fr 1fr 1fr 1fr 1fr auto auto; }
}
@media (max-width:860px) {
  .toolbar, .add-grid, .task-columns { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(2,1fr); }
  .weekday { display: none; }
}