:root {
  --accent: #5C3D1E;
  --accent-soft: rgba(92,61,30,0.10);
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --text: #2A2118;
  --muted: #7A6E62;
  --border: #E6DED2;
  --warn: #B4531A;
  --danger: #A32D2D;
  --ok: #3B6D11;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; }
.hidden { display: none !important; }
.app { max-width: 720px; margin: 0 auto; padding: 16px 16px 80px; padding-top: max(16px, env(safe-area-inset-top)); }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
h1 { font-size: 22px; margin: 0; font-weight: 600; }
h2 { font-size: 18px; margin: 0; }
select, input, textarea { font: inherit; color: inherit; }
select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.prog + .prog { margin-top: 14px; }
.prog-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 14px; }
.prog-head strong { font-size: 15px; }
.bar { height: 12px; border-radius: 8px; background: var(--accent-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 8px; transition: width .3s; }
.bar.done > span { background: var(--ok); }
.prog-note { margin-top: 12px; font-size: 13px; color: var(--muted); }

.actions { display: flex; gap: 10px; margin: 14px 0; }
.btn-primary, .btn-ghost, .btn-danger { font: inherit; border-radius: 12px; padding: 12px 16px; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; flex: 1; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.small { padding: 6px 12px; font-size: 14px; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.chip { font: inherit; font-size: 14px; white-space: nowrap; padding: 7px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 10px; }
.entry { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; }
.entry-top { display: flex; justify-content: space-between; gap: 10px; }
.entry-title { font-weight: 600; }
.entry-hours { font-weight: 600; white-space: nowrap; }
.entry-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.entry-notes { font-size: 14px; margin-top: 8px; color: var(--text); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.tag.s { background: var(--accent); color: #fff; }
.tag.warn { background: #FAECE7; color: var(--warn); }
.tag.ok { background: #EAF3DE; color: var(--ok); }
.tag a { color: inherit; text-decoration: none; }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.error { background: #FCEBEB; color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 10px; }

.sheet { position: fixed; inset: 0; background: rgba(42,33,24,0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-inner { background: var(--bg); width: 100%; max-width: 720px; max-height: 94vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
label { display: block; font-size: 13px; color: var(--muted); margin-top: 12px; }
input[type=text], input[type=url], input[type=date], input[type=number], textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.seg button { font: inherit; padding: 11px; border: 0; background: var(--surface); cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
.quick { display: flex; gap: 8px; margin-top: 8px; }
.quick button { font: inherit; flex: 1; padding: 8px 0; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer; }
.cert-box { margin-top: 16px; padding: 12px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); }
.cert-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.cert-current { font-size: 14px; margin-bottom: 8px; }
.cert-current a { color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-top: 10px; }
.check input { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn-primary { flex: 2; }
.btn-row .btn-danger { flex: 1; }
