body { font-family: system-ui, sans-serif; background: #1b1d22; color: #e8e8e8; margin: 16px; }
h1 { font-size: 1.4rem; }
#tabs button { padding: 8px 16px; margin-right: 6px; border: 0; border-radius: 6px 6px 0 0; background: #333; color: #ddd; cursor: pointer; }
#tabs button.active { background: #4a7bd0; color: #fff; }
section { background: #262a31; padding: 12px; margin: 0 0 16px; border-radius: 0 8px 8px 8px; }
h2 { margin: 0 0 8px; font-size: 1.1rem; }
.tar { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.tar b { padding: 2px 8px; border-radius: 4px; color: #000; }
table { border-collapse: collapse; width: 100%; max-width: 900px; }
th, td { padding: 4px 8px; text-align: right; border-bottom: 1px solid #3a3f48; }
th:first-child, td:first-child { text-align: left; }
input { width: 90px; background: #1b1d22; color: #fff; border: 1px solid #555; border-radius: 4px; padding: 3px; text-align: right; }
input.small { width: 56px; }
.sum td { font-weight: bold; border-top: 2px solid #555; }
.neg { color: #ff6b6b; }
.note { color: #888; font-size: .8rem; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .07;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%23d4af37' stroke-width='5' stroke-linecap='round'%3E%3Cpath d='M30 30L170 170M170 30L30 170'/%3E%3Cpath d='M100 45c25 12 45 12 45 12v45c0 30-25 48-45 58-20-10-45-28-45-58V57s20 0 45-12z' fill='%231b1d22'/%3E%3Cpath d='M100 70v70M75 95h50'/%3E%3C/g%3E%3C/svg%3E") center / min(70vmin, 600px) no-repeat;
}
summary { cursor: pointer; }
summary h2 { display: inline; }

/* ---- refined layout ---- */
body { max-width: 980px; margin: 0 auto; padding: 24px 16px; line-height: 1.5; }
body::before {
  opacity: .09;
  background: url("bg.jpg") center / min(80vmin, 640px) no-repeat;
}
h1 { font-size: 1.6rem; letter-spacing: .5px; margin: 0 0 16px; }
.row.bests { margin-top: 22px; }
#tabs .addtab { background: transparent; border: 1px dashed #4a5262; color: #8fa3c4; font-weight: 500; }
#tabs .addtab:hover { color: #fff; border-color: #8fa3c4; background: #2a2f38; }
#tabs .addbox { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
#tabs .addbox input { width: 150px; text-align: left; padding: 8px 10px; font-size: .95rem; border-color: #4a7bd0; }
#tabs .addbox button { margin: 0; padding: 8px 12px; border-radius: 6px; font-weight: 700; }
#tabs .addbox .ok { background: #2f7d3a; color: #fff; }
.goalhead { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.goalhead h2 { margin: 0; }
.acct { display: flex; align-items: center; gap: 14px; font-size: .78rem; color: #7d8695; }
.acct button { background: none; border: 0; border-left: 1px solid #3a4250; color: #8fa3c4; cursor: pointer; font-size: .78rem; padding: 0 0 0 14px; }
.acct button:hover { color: #fff; text-decoration: underline; }
.acct button.del:hover { color: #ff6b6b; }
#tabs button { font-weight: 600; padding: 10px 22px; }
section { padding: 18px 20px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.35); border: 1px solid #343a44; }
h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: .3px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: #9aa3b0; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field select { font-size: .95rem; text-transform: none; letter-spacing: 0; padding: 6px 8px; background: #14161a; color: #e8e8e8; border: 1px solid #3a4250; border-radius: 6px; }
.field input.small { width: 64px; }
.field input { font-size: .95rem; text-transform: none; letter-spacing: 0; width: 110px; padding: 6px 8px; }
.datebox { display: flex; gap: 4px; position: relative; }
.datebox button { background: #333; border: 1px solid #555; border-radius: 4px; cursor: pointer; padding: 0 8px; }
.hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; right: 0; bottom: 0; }
.muted { color: #9aa3b0; font-size: .9rem; }
.badge { padding: 3px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; color: #000; }
.badge.days { background: #ffb347; }
.stats { gap: 12px; }
.stat { background: #1b1d22; border-radius: 8px; padding: 8px 18px; min-width: 120px; display: flex; flex-direction: column; }
.stat span { font-size: .7rem; text-transform: uppercase; letter-spacing: .6px; color: #9aa3b0; }
.stat b { font-size: 1.4rem; }
.stat.planned { position: relative; }
.clearx { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; padding: 0; line-height: 1; font-size: 1rem; background: none; border: 1px solid #3a4250; border-radius: 50%; color: #8a93a0; cursor: pointer; }
.clearx:hover { color: #ff6b6b; border-color: #ff6b6b; }
.infox { position: absolute; bottom: 6px; right: 6px; width: 20px; height: 20px; padding: 0; line-height: 1; font-size: .8rem; font-style: italic; font-family: serif; background: none; border: 1px solid #3a4250; border-radius: 50%; color: #8a93a0; cursor: pointer; }
.infox:hover { color: #5cc8ff; border-color: #5cc8ff; }
.badge.days.urgent { background: #ff4d4d; color: #fff; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.overlay .box { background: #1b1d22; border: 1px solid #3a4250; border-radius: 10px; padding: 16px 20px; max-width: 460px; width: 100%; max-height: 80vh; overflow: auto; }
.overlay .boxhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.overlay h3 { margin: 0; }
.overlay table { width: 100%; }
.overlay td.r, .overlay th.r { text-align: right; }
.overlay .closex { background: none; border: 1px solid #3a4250; border-radius: 50%; width: 24px; height: 24px; color: #8a93a0; cursor: pointer; }
.perday { color: #9aa3b0; font-size: .9rem; }
tr.best td { background: rgba(92, 214, 92, .10); }
.bests { gap: 8px 10px; }
.badge.top { outline: 2px solid #fff; }
.plans-head { justify-content: space-between; margin-top: 22px; }
h3 { margin: 0; font-size: 1rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 12px; }
.plan { background: #1b1d22; border: 1px solid #343a44; border-radius: 10px; padding: 14px 16px; display: grid; grid-row: span 6; grid-template-rows: subgrid; row-gap: 10px; }
.plans { row-gap: 0; column-gap: 14px; }
.plan .planhead { display: flex; flex-direction: column; gap: 6px; }
.plan .planstats { margin-top: 5px; }
.plan ul { margin: 0; padding-left: 18px; }
.planstats { display: flex; gap: 28px; }
.planstats span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .6px; color: #9aa3b0; }
.planstats { display: flex; gap: 28px; align-items: flex-end; }
.planstats b { font-size: 1.6rem; line-height: 1.2; }
.timebig { color: #ffb347; }
.c-green { color: #5cd65c; } .c-blue { color: #5aa9ff; } .c-purple { color: #c07cff; } .c-orange { color: #ffb347; } .c-gray { color: #cfd3d9; }
.plan li .left { margin-left: 10px; color: inherit; opacity: .5; font-size: .85rem; }
.plan li .base { margin-left: 10px; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; opacity: .85; }
details[data-sec=plan] { margin-top: 28px; }
.plans-head { margin-top: 12px; }
details > summary h3 { display: inline; }
.field.inline input[type=checkbox] { width: auto; }
.plan .applied { color: #6f8f6f; font-size: .75rem; }
.plan li .left.negleft { color: #ff6b6b; opacity: 1; }
.plan button { background: none; color: #8fa3c4; border: 1px solid #3a4250; border-radius: 6px; padding: 3px 10px; font-size: .75rem; cursor: pointer; }
.plan button:hover { color: #fff; border-color: #6b7a94; }
.plan .star { color: #9aa3b0; margin-left: 2px; }
.plan .status { font-size: 1.15rem; font-weight: 700; padding: 9px 12px; border-radius: 8px; margin-top: 4px; }
.plan .status small { font-size: .75rem; font-weight: 400; opacity: .8; margin-left: 6px; }
.plan .status.ok { background: rgba(92,214,92,.14); color: #5cd65c; border: 1px solid rgba(92,214,92,.35); }
.plan .status.bad { background: rgba(255,107,107,.14); color: #ff6b6b; border: 1px solid rgba(255,107,107,.35); }
.plan .tarused { border-top: 1px solid #2b3039; padding-top: 10px; margin-top: 4px; }
.plan .tarlabel { font-size: .7rem; text-transform: uppercase; letter-spacing: .6px; color: #9aa3b0; margin-bottom: 4px; }
.plan .tarlist { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .85rem; color: #aab; }
.plan .tarlist b { font-weight: 600; margin-left: 4px; }
.plan .planfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; }
.plan .fn { font-size: .7rem; color: #6f7886; }
td.tpp { color: #ffb347; font-weight: 600; }
.perday b { color: #ffb347; font-size: 1.3rem; margin-right: 4px; }
.good { color: #5cd65c; }
table { margin-top: 14px; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: #9aa3b0; font-weight: 600; padding: 6px 12px; }
td { padding: 8px 12px; }
tr:hover td { background: #2c313a; }
.note { margin-top: 24px; }
.note button { background: #333; color: #ddd; border: 1px solid #555; border-radius: 4px; padding: 3px 10px; cursor: pointer; }
.green { background: #5cd65c; } .blue { background: #5aa9ff; } .purple { background: #c07cff; } .orange { background: #ffb347; } .gray { background: #bbb; }
