/* =========================================
   CARD
========================================= */
.card {
    background: var(--surface);
    border-radius: 20px;
    padding: 14px;
    box-shadow: var(--sh-md);
    border: 1px solid var(--border);
}

.card-hd {
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chip {
    font-size: 10px;
    font-weight: 600;
    background: var(--blue-100);
    color: var(--blue-700);
    padding: 3px 10px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: var(--fb);
}

.chip:active {
    opacity: .7;
}

/* =========================================
   WEEK STRIP
========================================= */
.wscroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.wscroll::-webkit-scrollbar {
    display: none;
}

.wstrip {
    display: flex;
    gap: 4px;
    width: max-content;
    padding: 2px 2px 4px;
}

.dc {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    padding: 2px;
    min-width: 40px;
}

.dc:active {
    transform: scale(.88);
}

.dc-lbl {
    font-size: 9px;
    font-weight: 700;
    color: var(--textm);
    text-transform: uppercase;
}

.dc-box {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 700;
    border: 2px solid var(--pmo-0b);
    background: var(--pmo-0);
    color: var(--text);
    transition: transform .12s;
}

.dc-box.p1 {
    background: var(--pmo-1);
    border-color: var(--pmo-1b);
    color: #713f12;
}

.dc-box.p2 {
    background: var(--pmo-2);
    border-color: var(--pmo-2b);
    color: #fff;
}

.dc-box.p3 {
    background: var(--pmo-3);
    border-color: var(--pmo-3b);
    color: #fff;
}

.dc.today .dc-box {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}

.dc.today .dc-lbl {
    color: var(--blue-600);
    font-weight: 800;
}

.dc-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--blue-500);
    opacity: 0;
}

.dc.today .dc-dot {
    opacity: 1;
}

.week-hint {
    font-size: 10px;
    color: var(--textm);
    text-align: center;
    margin-top: 7px;
}

/* =========================================
   STATS ROW
========================================= */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box {
    background: var(--grad-card);
    border-radius: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: var(--sh-sm);
}

.stat-v {
    font-family: var(--ff);
    font-size: 32px;
    font-weight: 800;
    color: var(--blue-700);
    line-height: 1;
}

.stat-l {
    font-size: 11px;
    color: var(--textm);
    margin-top: 4px;
    font-weight: 500;
}

/* =========================================
   QUOTE CARD
========================================= */
.qcard {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-900));
    border-radius: 20px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.qcard::before {
    content: '"';
    position: absolute;
    top: -16px;
    right: 10px;
    font-size: 96px;
    font-family: Georgia;
    color: rgba(255, 255, 255, .08);
    line-height: 1;
}

.q-text {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, .92);
    line-height: 1.65;
    font-style: italic;
    position: relative;
    z-index: 1;
}

.q-src {
    font-size: 10px;
    color: rgba(255, 255, 255, .5);
    margin-top: 6px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* =========================================
   INTENSITY LEGEND
========================================= */
.ileg {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.ileg-i {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text2);
}

.ileg-d {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.id-0 {
    background: #fff;
    border: 1px solid #bfdbfe;
}

.id-1 {
    background: var(--pmo-1);
}

.id-2 {
    background: var(--pmo-2);
}

.id-3 {
    background: var(--pmo-3);
}

/* =========================================
   STOPWATCH PAGE
========================================= */
.sw-hero {
    background: var(--grad-hero);
    padding: 30px 16px 34px;
    text-align: center;
    border-radius: 0 0 26px 26px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 8px 30px rgba(37, 99, 235, .25);
}

.sw-hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}

.sw-hero-inner {
    position: relative;
    z-index: 1;
}

.sw-big-cap {
    font-family: var(--ff);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, .75);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 8px;
}

.sw-big-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sw-big-unit {
    text-align: center;
    min-width: 66px;
}

.sw-big-num {
    font-family: var(--ff);
    font-size: 56px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    text-shadow: 0 3px 12px rgba(0, 0, 0, .2);
    letter-spacing: -2px;
}

.sw-big-lbl {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, .65);
    text-transform: uppercase;
    margin-top: 2px;
}

.sw-big-sep {
    font-family: var(--ff);
    font-size: 46px;
    font-weight: 800;
    color: rgba(255, 255, 255, .4);
    padding-bottom: 14px;
    animation: swblink 1s step-end infinite;
}

@keyframes swblink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .2;
    }
}

.btn-relapse {
    display: inline-block;
    margin-top: 22px;
    background: var(--grad-danger);
    color: #fff;
    font-family: var(--ff);
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 999px;
    padding: 14px 36px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(239, 68, 68, .42);
    letter-spacing: .04em;
    transition: transform .15s, box-shadow .15s;
}

.btn-relapse:active {
    transform: scale(.93);
    box-shadow: 0 2px 8px rgba(239, 68, 68, .3);
}

/* =========================================
   LOG CARDS
========================================= */
.log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lc {
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.lc-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 13px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.lc-hdr:active {
    background: var(--surf2);
}

.lc-date {
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.lc-time {
    font-size: 11px;
    color: var(--textm);
    margin-top: 1px;
}

.lc-chev {
    font-size: 12px;
    color: var(--textm);
    transition: transform .25s ease;
    flex-shrink: 0;
}

.lc.open .lc-chev {
    transform: rotate(180deg);
}

.lc-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.lc.open .lc-body {
    max-height: 600px;
    border-top: 1px solid var(--border);
}

.lc-inner {
    padding: 11px 13px 13px;
}

.tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 9px;
}

.tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
}

.tag-t {
    background: var(--blue-100);
    color: var(--blue-800);
}

.tag-w {
    background: #f0fdf4;
    color: #166534;
}

.tag-m {
    background: #fff7ed;
    color: #9a3412;
}

.note-lbl {
    font-size: 10px;
    font-weight: 700;
    color: var(--textm);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
}

.note-txt {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
    font-style: italic;
    background: var(--surf2);
    border-radius: 8px;
    padding: 8px 10px;
}

.lc-acts {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: flex-end;
}

.bxs {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: var(--fb);
    transition: transform .12s;
}

.bxs:active {
    transform: scale(.9);
}

.bedit {
    background: var(--blue-100);
    color: var(--blue-700);
}

.bdel {
    background: #fee2e2;
    color: #991b1b;
}

.empty {
    text-align: center;
    padding: 28px 12px;
    color: var(--textm);
}

.empty-ico {
    font-size: 36px;
    margin-bottom: 8px;
}

.empty-txt {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

/* =========================================
   CALENDAR
========================================= */
.cal-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 14px;
    box-shadow: var(--sh-md);
    border: 1px solid var(--border);
}

.cal-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cal-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-600);
    transition: background .15s;
}

.cal-arrow:active {
    background: var(--blue-100);
    transform: scale(.9);
}

.cal-month {
    font-family: var(--ff);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.cal-dh {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--textm);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cal-d {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font-family: var(--ff);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--pmo-0b);
    background: var(--pmo-0);
    color: var(--text2);
    transition: transform .12s;
}

.cal-d:not(.ce):active {
    transform: scale(.88);
}

.cal-d.today {
    border-color: var(--blue-500) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, .18);
}

.cal-d.p1 {
    background: var(--pmo-1);
    border-color: var(--pmo-1b);
    color: #713f12;
}

.cal-d.p2 {
    background: var(--pmo-2);
    border-color: var(--pmo-2b);
    color: #fff;
}

.cal-d.p3 {
    background: var(--pmo-3);
    border-color: var(--pmo-3b);
    color: #fff;
}

.cal-d.ce {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
}

/* =========================================
   CHART TOGGLE
========================================= */
.tgl-grp {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: var(--blue-50);
    border-radius: 999px;
    margin-bottom: 12px;
}

.tgl {
    flex: 1;
    padding: 6px 4px;
    border: none;
    border-radius: 999px;
    font-family: var(--fb);
    font-size: 10px;
    font-weight: 700;
    color: var(--textm);
    background: transparent;
    cursor: pointer;
    transition: all .15s;
}

.tgl.on {
    background: #fff;
    color: var(--blue-700);
    box-shadow: var(--sh-sm);
}

/* =========================================
   BAR CHART
========================================= */
.bar-wrap {
    height: 120px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 0;
}

.bar-wrap::-webkit-scrollbar {
    display: none;
}

.bar-col {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 28px;
}

.bar-fill {
    width: 18px;
    border-radius: 4px 4px 0 0;
    background: var(--grad-btn);
    min-height: 4px;
}

.bar-lbl {
    font-size: 8px;
    color: var(--textm);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

/* =========================================
   STREAK BARS
========================================= */
.srec {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
}

.srank {
    font-family: var(--ff);
    font-size: 12px;
    font-weight: 800;
    color: var(--textm);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.srank.g {
    color: #f59e0b;
}

.srank.s {
    color: #94a3b8;
}

.srank.b {
    color: #cd7c3b;
}

.strack {
    flex: 1;
    height: 26px;
    background: var(--blue-50);
    border-radius: 999px;
    overflow: hidden;
}

.sfill {
    height: 100%;
    border-radius: 999px;
    background: var(--grad-btn);
    display: flex;
    align-items: center;
    padding-left: 10px;
    min-width: 38px;
}

.sfill span {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
}

/* =========================================
   DONUT CHARTS
========================================= */
.donut-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 15px;
    box-shadow: var(--sh-md);
    border: 1px solid var(--border);
}

.donut-title {
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.donut-layout {
    display: flex;
    gap: 13px;
    align-items: center;
}

.donut-svg {
    flex-shrink: 0;
}

.donut-leg {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dl-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dl-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dl-cnt {
    font-family: var(--ff);
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-600);
    flex-shrink: 0;
}

/* =========================================
   SETTINGS
========================================= */
.set-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--textm);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 10px 2px 7px;
}

.set-group {
    background: var(--surface);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--sh-md);
    border: 1px solid var(--border);
}

.set-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
}

.set-row:last-child {
    border-bottom: none;
}

.set-row:active {
    background: var(--surf2);
}

.set-ico {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--blue-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.set-name {
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.set-desc {
    font-size: 11px;
    color: var(--textm);
    margin-top: 1px;
}

.set-arr {
    margin-left: auto;
    color: var(--textm);
    font-size: 15px;
    font-weight: 600;
}

.app-credit {
    text-align: center;
    font-size: 11px;
    color: var(--textm);
    padding: 18px 0 6px;
    line-height: 1.6;
}

/* =========================================
   MODAL / BOTTOM SHEET
========================================= */
.ov {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 50, .5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.ov.show {
    opacity: 1;
    pointer-events: auto;
}

.sheet {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 26px 26px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--safe-b) + 4px);
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.34, 1.2, .64, 1);
}

.sheet::-webkit-scrollbar {
    display: none;
}

.ov.show .sheet {
    transform: translateY(0);
}

.sh-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    margin: 11px auto 0;
}

.sh-title {
    font-family: var(--ff);
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    padding: 13px 18px 11px;
    border-bottom: 1px solid var(--border);
}

/* =========================================
   FORM inside sheet
========================================= */
.sh-body {
    padding: 14px 18px 0;
}

.fg {
    margin-bottom: 12px;
}

.flbl {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fi {
    width: 100%;
    background: var(--surf2);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font-family: var(--fb);
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}

.fi:focus {
    border-color: var(--blue-400);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

textarea.fi {
    resize: none;
    min-height: 80px;
    line-height: 1.55;
}

.frow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sh-actions {
    display: flex;
    gap: 9px;
    padding: 12px 18px 24px;
}

.btn-pri {
    flex: 1;
    background: var(--grad-btn);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 13px;
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, .28);
    transition: transform .12s;
}

.btn-pri:active {
    transform: scale(.95);
}

.btn-sec {
    background: var(--surf2);
    color: var(--text2);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    padding: 13px 18px;
    font-family: var(--ff);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s;
}

.btn-sec:active {
    transform: scale(.95);
}

/* Date sheet */
.dbar {
    display: flex;
    gap: 8px;
    padding: 12px 18px 4px;
}

.dbtn {
    flex: 1;
    padding: 11px;
    border-radius: 999px;
    font-family: var(--ff);
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform .12s;
}

.dbtn:active {
    transform: scale(.93);
}

.dbtn-add {
    background: var(--grad-btn);
    color: #fff;
    box-shadow: 0 3px 10px rgba(37, 99, 235, .25);
}

.dlist {
    padding: 4px 18px 0;
}

.dempty {
    text-align: center;
    padding: 22px;
    color: var(--textm);
    font-size: 13px;
    font-style: italic;
}

/* =========================================
   TOAST
========================================= */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(-100% - 20px));
    background: #1e293b;
    color: #fff;
    padding: 9px 20px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    z-index: 999;
    pointer-events: none;
    box-shadow: var(--sh-lg);
    white-space: nowrap;
    transition: transform .35s cubic-bezier(.34, 1.3, .64, 1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}