/* ===== リセット ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
       font-size: 15px; line-height: 1.5; background: #f5f5f7; color: #1c1c1e;
       height: 100dvh; overflow: hidden; }

/* ===== 認証画面 ===== */
.auth-body   { background: #f5f5f7; display: flex; align-items: center; justify-content: center; overflow: auto; }
.auth-wrap   { width: 100%; max-width: 360px; padding: 2rem 1.5rem; background: #fff;
               border-radius: 16px; margin: 1rem; }
.auth-logo   { font-size: 24px; font-weight: 700; color: #534AB7; text-align: center; margin-bottom: 1.5rem; }
.auth-error  { background: #fff0f0; color: #c0392b; border-radius: 8px; padding: .6rem 1rem;
               font-size: 13px; margin-bottom: 1rem; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px;
                   color: #666; margin-bottom: 1rem; }
.auth-form input { border: 1px solid #ddd; border-radius: 8px; padding: .65rem .85rem;
                   font-size: 15px; outline: none; transition: border-color .15s; }
.auth-form input:focus { border-color: #534AB7; }
.auth-form button { width: 100%; background: #534AB7; color: #fff; border: none;
                    border-radius: 10px; padding: .8rem; font-size: 16px; font-weight: 600;
                    cursor: pointer; margin-top: .5rem; }
.auth-sub    { font-size: 12px; color: #999; text-align: center; margin-top: 1.2rem; }

/* ===== アプリレイアウト ===== */
.app         { display: flex; flex-direction: column; height: 100dvh; }
.app-header  { display: flex; align-items: center; gap: 10px; padding: .75rem 1rem;
               background: #fff; border-bottom: 1px solid #e5e5ea; min-height: 52px; }
.app-header h1 { font-size: 17px; font-weight: 600; flex: 1; }
.app-body    { flex: 1; overflow: hidden; display: flex; }

/* ===== ボトムナビ ===== */
.bottom-nav  { display: flex; background: #fff; border-top: 1px solid #e5e5ea;
               padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center;
                padding: .5rem .25rem; font-size: 10px; color: #999; text-decoration: none;
                transition: color .15s; gap: 2px; }
.bottom-nav a.active, .bottom-nav a:hover { color: #534AB7; }
.nav-icon    { width: 24px; height: 24px; }

/* ===== チャット ===== */
.chat-layout   { display: flex; flex: 1; overflow: hidden; }
.sidebar       { width: 260px; background: #fff; border-right: 1px solid #e5e5ea;
                 display: flex; flex-direction: column; overflow: hidden; }
.sidebar-head  { padding: .75rem 1rem; font-size: 13px; font-weight: 600; color: #666;
                 border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.sidebar-list  { flex: 1; overflow-y: auto; }
.sidebar-item  { padding: .65rem 1rem; cursor: pointer; display: flex; align-items: center; gap: 8px;
                 font-size: 14px; border-radius: 0; transition: background .1s; }
.sidebar-item:hover, .sidebar-item.active { background: #f0effe; color: #534AB7; }
.sidebar-item .badge { background: #534AB7; color: #fff; font-size: 11px;
                        border-radius: 10px; padding: 1px 6px; margin-left: auto; }

.chat-main   { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-msgs   { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 12px; }
.msg         { display: flex; gap: 8px; max-width: 80%; }
.msg.mine    { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar  { width: 32px; height: 32px; border-radius: 50%; background: #ddd;
               display: flex; align-items: center; justify-content: center;
               font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0; }
.msg-body    { background: #f0f0f5; border-radius: 16px 16px 16px 4px; padding: .5rem .85rem;
               font-size: 14px; line-height: 1.45; }
.msg.mine .msg-body { background: #534AB7; color: #fff; border-radius: 16px 16px 4px 16px; }
.msg-time    { font-size: 11px; color: #aaa; margin-top: 2px; }

.chat-input  { border-top: 1px solid #e5e5ea; padding: .6rem .75rem;
               padding-bottom: calc(.6rem + env(safe-area-inset-bottom));
               display: flex; gap: 8px; align-items: flex-end; background: #fff; }
.chat-input textarea { flex: 1; border: 1px solid #ddd; border-radius: 20px; padding: .5rem .9rem;
                        font-size: 14px; resize: none; max-height: 100px; outline: none;
                        font-family: inherit; line-height: 1.4; }
.chat-input textarea:focus { border-color: #534AB7; }
.send-btn    { width: 36px; height: 36px; border-radius: 50%; background: #534AB7; border: none;
               cursor: pointer; display: flex; align-items: center; justify-content: center;
               flex-shrink: 0; }
.send-btn svg { fill: #fff; width: 18px; height: 18px; }

/* ===== カレンダー ===== */
.cal-wrap    { flex: 1; overflow-y: auto; padding: 1rem; }
.cal-head    { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cal-head h2 { font-size: 18px; font-weight: 600; }
.cal-nav     { border: none; background: none; font-size: 20px; padding: .25rem .5rem; cursor: pointer; }
.cal-grid    { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: #e5e5ea;
               border: 1px solid #e5e5ea; border-radius: 12px; overflow: hidden; }
.cal-dow     { background: #f5f5f7; text-align: center; font-size: 12px; color: #666;
               padding: .4rem 0; font-weight: 500; }
.cal-day     { background: #fff; min-height: 60px; padding: 4px; cursor: pointer; transition: background .1s; }
.cal-day:hover { background: #f5f5f7; }
.cal-day.today .day-num { background: #534AB7; color: #fff; border-radius: 50%;
                           width: 24px; height: 24px; display: flex; align-items: center;
                           justify-content: center; }
.cal-day.other { opacity: .35; }
.day-num     { font-size: 13px; font-weight: 500; width: 24px; height: 24px;
               display: flex; align-items: center; justify-content: center; }
.cal-event   { font-size: 11px; border-radius: 4px; padding: 1px 4px; color: #fff;
               margin-top: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ===== タスク ===== */
.tasks-wrap  { flex: 1; overflow-y: auto; padding: 1rem; }
.kanban      { display: flex; gap: 12px; min-height: 300px; }
.kanban-col  { flex: 1; min-width: 0; background: #f5f5f7; border-radius: 12px; padding: .75rem; }
.kanban-col h3 { font-size: 13px; font-weight: 600; color: #666; margin-bottom: .75rem; }
.task-card   { background: #fff; border-radius: 10px; padding: .75rem; margin-bottom: 8px;
               border: 1px solid #e5e5ea; cursor: pointer; transition: box-shadow .15s; }
.task-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.task-title  { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.task-meta   { font-size: 12px; color: #999; display: flex; gap: 8px; flex-wrap: wrap; }
.prio-high   { color: #e74c3c; }
.prio-medium { color: #f39c12; }
.prio-low    { color: #27ae60; }

/* ===== ボタン共通 ===== */
.btn         { border: none; border-radius: 10px; padding: .6rem 1.2rem; font-size: 14px;
               font-weight: 500; cursor: pointer; transition: opacity .15s; }
.btn-primary { background: #534AB7; color: #fff; }
.btn-sm      { padding: .35rem .8rem; font-size: 12px; border-radius: 8px; }
.btn:hover   { opacity: .85; }

/* ===== モーダル ===== */
.modal-bg    { position: fixed; inset: 0; background: rgba(0,0,0,.45);
               display: flex; align-items: flex-end; z-index: 100; }
.modal       { background: #fff; border-radius: 20px 20px 0 0; padding: 1.5rem 1.25rem;
               width: 100%; max-height: 90dvh; overflow-y: auto;
               padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
.modal h2    { font-size: 17px; font-weight: 600; margin-bottom: 1.2rem; }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #666; margin-bottom: 1rem; }
.modal input, .modal textarea, .modal select {
  border: 1px solid #ddd; border-radius: 8px; padding: .6rem .8rem;
  font-size: 15px; font-family: inherit; outline: none; width: 100%; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: #534AB7; }
.hidden      { display: none !important; }

/* ===== スマホ: サイドバー非表示 ===== */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0; z-index: 50; width: 280px; }
}
