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

html,body{
  height:100%;
}

:root{
  --bg:#0f1115;
  --card:#171a21;
  --text:#f4f6f8;
  --muted:#9ca3af;
  --border:#252a34;
  --accent:#19c37d;
  --danger:#ff4d4f;
  --chip:#222a33;
  --maxw:980px;
}

body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",Meiryo,"Hiragino Kaku Gothic ProN",sans-serif;
  background:var(--bg);
  color:var(--text);
}

.wrap{
  max-width:var(--maxw);
  margin:0 auto;
  padding:16px;
}

.app-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:8px;
}

.app-header h1{
  margin:0 0 4px;
  font-size:1.2rem;
}

.subtitle{
  margin:0;
  font-size:.85rem;
  color:var(--muted);
}

.toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.chip{
  background:var(--chip);
  border:1px solid var(--border);
  border-radius:999px;
  padding:6px 10px;
  font-size:.8rem;
  white-space:nowrap;
  color:var(--muted);
}

.tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:8px 0 12px;
}

.tab{
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  border-radius:999px;
  padding:6px 12px;
  cursor:pointer;
  font-size:.9rem;
}

.tab.active{
  background:var(--accent);
  color:#000;
  border-color:transparent;
  font-weight:600;
}

.tab.add{
  background:transparent;
  border-style:dashed;
  color:var(--muted);
}

.grid{
  display:grid;
  grid-template-columns:1.3fr .7fr;
  gap:16px;
}
@media (max-width:860px){
  .grid{grid-template-columns:1fr;}
}

.tab-panel{
  display:none;
}
.tab-panel.active{
  display:block;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 1px 2px rgba(0,0,0,.35);
  padding:14px;
  margin-bottom:14px;
}

.card-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}

.card-header h2{
  margin:0;
  font-size:1rem;
}

.btn{
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--chip);
  color:var(--text);
  padding:6px 12px;
  font-size:.85rem;
  cursor:pointer;
  white-space:nowrap;
}
.btn.primary{
  background:var(--accent);
  color:#000;
  border-color:transparent;
}
.btn.ghost{
  background:transparent;
  color:var(--muted);
}
.btn.danger{
  background:var(--danger);
  color:#fff;
  border-color:transparent;
}

.note{
  font-size:.8rem;
  color:var(--muted);
  margin:4px 0;
}

.habit-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:8px;
}

.habit-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#11141b;
}

.habit-main{
  display:flex;
  align-items:center;
  gap:8px;
}

.habit-dot{
  width:14px;
  height:14px;
  border-radius:999px;
  border:2px solid #000;
  flex-shrink:0;
}

.habit-name{
  font-size:.9rem;
}

.habit-status{
  font-size:.75rem;
  color:var(--muted);
}

.habit-toggle{
  border-radius:999px;
  border:none;
  padding:4px 10px;
  font-size:.8rem;
  cursor:pointer;
}

.habit-toggle.on{
  background:var(--accent);
  color:#000;
}
.habit-toggle.off{
  background:#111;
  color:var(--muted);
  border:1px solid var(--border);
}

.mini-week{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:4px;
  margin-top:8px;
}

.mini-cell{
  text-align:center;
  padding:6px 2px;
  border-radius:10px;
  border:1px solid var(--border);
  font-size:.7rem;
  color:var(--muted);
}
.mini-cell.has{
  background:#14532d;
  color:#bbf7d0;
  border-color:#15803d;
  font-weight:600;
}

.weekday-row{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  font-size:.75rem;
  color:var(--muted);
  text-align:center;
  margin-bottom:4px;
}

.calendar-grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:4px;
}

.day-cell{
  min-height:52px;
  padding:4px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#11141b;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  font-size:.75rem;
}

.day-num{
  font-size:.75rem;
  color:var(--muted);
}

.day-dots{
  display:flex;
  gap:3px;
  margin-top:3px;
  flex-wrap:wrap;
}

.day-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  border:1px solid #000;
}

.day-cell.today{
  border-color:var(--accent);
}

.photo-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}

.photo-item{
  width:110px;
}
.photo-item img{
  width:100%;
  height:80px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid var(--border);
}
.photo-meta{
  font-size:.7rem;
  color:var(--muted);
  margin-top:2px;
}

.small-label{
  font-size:.8rem;
  color:var(--muted);
  display:block;
  margin-bottom:4px;
}

.row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.col{
  flex:1 1 220px;
}

select,input[type="text"]{
  width:100%;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#11141b;
  color:var(--text);
  font-size:.9rem;
}

.habit-manage-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:8px;
}

.manage-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#11141b;
  font-size:.85rem;
}

.footerbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  margin-top:10px;
  gap:6px;
}
