:root {
    --bg: #070b14;
    --bg-2: #0b1020;
    --surface: #101827;
    --surface-2: #121c2f;
    --surface-3: #172238;
    --glass: rgba(18, 28, 47, .78);
    --line: rgba(255,255,255,.09);
    --line-strong: rgba(255,255,255,.16);
    --text: #f7f9fc;
    --soft: #d8e1ee;
    --muted: #8d9ab0;
    --muted-2: #64748b;
    --accent: #4f7cff;
    --accent-2: #6d5dfc;
    --good: #38d99f;
    --warn: #f5b84b;
    --danger: #ff647c;
    --shadow: 0 18px 42px rgba(0,0,0,.28);
    --shadow-soft: 0 10px 28px rgba(0,0,0,.18);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --nav-height: 82px;
}

* { box-sizing: border-box; min-width: 0; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
    min-height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 50% -120px, rgba(79, 124, 255, .28), transparent 360px),
        radial-gradient(circle at 110% 0%, rgba(109, 93, 252, .13), transparent 260px),
        linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 52%, #080c15 100%);
    overflow-x: hidden;
}
body.login-body {
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: 22px;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }

.app-shell {
    width: min(100%, 460px);
    min-height: 100dvh;
    margin: 0 auto;
    padding: max(12px, env(safe-area-inset-top)) 14px calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px);
}
.content { display: grid; gap: 16px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0 14px;
    margin-bottom: 2px;
    background: linear-gradient(180deg, rgba(7,11,20,.98), rgba(7,11,20,.82) 76%, transparent);
    backdrop-filter: blur(18px);
}
.topbar-left { flex: 1 1 auto; display: flex; align-items: center; gap: 11px; overflow: hidden; }
.topbar-title { min-width: 0; overflow: hidden; }
.avatar-mini {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
    box-shadow: 0 10px 24px rgba(79,124,255,.25);
}
.avatar-mini span { font-weight: 900; font-size: 18px; }
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 760; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 { font-size: clamp(21px, 6vw, 27px); line-height: 1.05; letter-spacing: -.045em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock-pill {
    width: 82px;
    flex: 0 0 82px;
    min-height: 38px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.055);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--soft);
    font-size: 14px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.015em;
    overflow: hidden;
}
.clock-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(56,217,159,.11); flex: 0 0 auto; }
#live-clock { display: inline-block; min-width: 43px; text-align: center; white-space: nowrap; }

.notice { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; background: rgba(18,28,47,.88); color: var(--soft); margin-bottom: 12px; line-height: 1.42; }
.notice.success { border-color: rgba(56,217,159,.34); }
.notice.error { border-color: rgba(255,100,124,.48); }
.notice.warning { border-color: rgba(245,184,75,.45); }

.card {
    background: linear-gradient(180deg, rgba(18,28,47,.96), rgba(13,20,34,.96));
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 18px;
    overflow: hidden;
}
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.card-head h2 { font-size: 18px; letter-spacing: -.025em; line-height: 1.12; }
.card-head p { color: var(--muted); margin-top: 5px; font-size: 13px; line-height: 1.45; }

.hero-card {
    padding: 22px;
    background:
        linear-gradient(145deg, rgba(79,124,255,.18), transparent 34%),
        linear-gradient(160deg, #17243c 0%, #111a2c 56%, #0f1726 100%);
    border-color: rgba(79,124,255,.22);
    box-shadow: var(--shadow);
}
.hero-title { font-size: clamp(30px, 9vw, 42px); line-height: .98; letter-spacing: -.065em; margin-bottom: 10px; }
.hero-subtitle { color: var(--soft); font-size: 15px; line-height: 1.5; }
.hero-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }

.btn {
    appearance: none;
    border: 0;
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
    padding: 13px 16px;
    font-weight: 850;
    letter-spacing: -.018em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 26px rgba(79,124,255,.24); }
.btn-soft { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: rgba(255,100,124,.12); color: #ffe2e7; border: 1px solid rgba(255,100,124,.32); }
.btn-small { width: auto; min-height: 38px; padding: 9px 12px; border-radius: 13px; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric-card {
    min-height: 106px;
    background: rgba(255,255,255,.045);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: grid;
    gap: 8px;
    align-content: space-between;
}
.metric-icon { width: 36px; height: 36px; border-radius: 14px; background: rgba(79,124,255,.13); display: grid; place-items: center; border: 1px solid rgba(79,124,255,.18); }
.metric-card small, .form-label small { display: block; color: var(--muted); font-size: 12px; font-weight: 760; line-height: 1.35; }
.metric-card strong { display: block; font-size: clamp(20px, 6vw, 25px); letter-spacing: -.045em; margin-top: 2px; line-height: 1.05; overflow-wrap: anywhere; }
.metric-card span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.25; }

.list-stack { display: grid; gap: 10px; }
.task-item, .tracker-item, .workout-item, .note-preview, .weight-item {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.038);
    border-radius: var(--radius-lg);
    padding: 13px;
}
.task-item { display: flex; gap: 12px; align-items: flex-start; border-left: 3px solid rgba(255,255,255,.16); }
.task-item.priority-baixa { border-left-color: rgba(141,154,176,.55); }
.task-item.priority-media { border-left-color: rgba(79,124,255,.70); }
.task-item.priority-alta { border-left-color: rgba(245,184,75,.85); }
.task-item.priority-maxima { border-left-color: rgba(255,100,124,.90); }
.task-check { width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line-strong); background: rgba(255,255,255,.045); flex: 0 0 auto; font-weight: 900; color: var(--good); }
.task-main { flex: 1; }
.task-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-title-row strong { line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
.task-time { color: #a9bdff; font-weight: 850; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-item p, .note-preview p, .workout-item p, .tracker-item p, .weight-item p { color: var(--muted); line-height: 1.45; margin-top: 6px; font-size: 13px; overflow-wrap: anywhere; }
.task-item.done { opacity: .72; }
.task-item.done .task-title-row strong { text-decoration: line-through; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tag { border: 1px solid var(--line); background: rgba(255,255,255,.055); color: var(--soft); border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 760; line-height: 1; }
.tag.priority { color: #fff; background: rgba(79,124,255,.16); }

.form-grid { display: grid; gap: 13px; width: 100%; }
.form-grid.two,
.form-grid.three { grid-template-columns: 1fr; }
.form-label { display: grid; gap: 8px; color: var(--soft); font-size: 13px; font-weight: 780; line-height: 1.25; }
.input, .textarea, .select {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line);
    background: #0b111d;
    color: var(--text);
    border-radius: 16px;
    min-height: 50px;
    padding: 13px 14px;
    outline: none;
    transition: border .16s ease, background .16s ease, box-shadow .16s ease;
    overflow: hidden;
}
.input[type="file"] { padding: 12px; min-height: 54px; color: var(--muted); }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(79,124,255,.65); box-shadow: 0 0 0 4px rgba(79,124,255,.10); background: #0d1422; }
.textarea { resize: vertical; min-height: 112px; line-height: 1.45; }
select option { color: #101827; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; width: 100%; }
.inline-form .select { flex: 1 1 180px; width: 100% !important; }

.advanced-box {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.035);
    overflow: hidden;
}
.advanced-box summary {
    list-style: none;
    padding: 14px;
    color: var(--soft);
    font-weight: 850;
    cursor: pointer;
}
.advanced-box summary::-webkit-details-marker { display: none; }
.advanced-box .advanced-content { padding: 0 14px 14px; }

.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 5px; border-radius: 17px; background: #0b111d; border: 1px solid var(--line); margin-bottom: 12px; }
.segmented a { min-height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 850; text-align: center; }
.segmented a.active { color: var(--text); background: var(--surface-3); border: 1px solid var(--line); }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.month-title { text-align: center; font-weight: 900; letter-spacing: -.03em; font-size: 14px; }
.calendar-toolbar .btn-small { width: 42px; min-width: 42px; padding: 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekday { color: var(--muted); text-align: center; font-size: 10px; font-weight: 850; text-transform: uppercase; padding: 4px 0; }
.day-cell { min-height: 46px; border-radius: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.035); display: grid; place-items: center; color: var(--soft); position: relative; font-weight: 850; font-size: 14px; }
.day-cell.muted { opacity: .25; }
.day-cell.today { border-color: rgba(79,124,255,.65); box-shadow: inset 0 0 0 1px rgba(79,124,255,.22); }
.day-cell.selected { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.day-dots { position: absolute; bottom: 6px; display: flex; gap: 3px; }
.day-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--good); }

.profile-hero { display: grid; grid-template-columns: 84px 1fr; gap: 15px; align-items: center; }
.avatar-big { width: 84px; height: 84px; border-radius: 28px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 16px 34px rgba(0,0,0,.22); }
.avatar-big span { font-size: 34px; font-weight: 950; }
.avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero h2 { font-size: 27px; letter-spacing: -.055em; line-height: 1; overflow-wrap: anywhere; }
.profile-hero p { color: var(--muted); line-height: 1.42; margin-top: 5px; font-size: 13px; }
.profile-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.progress-ring { width: 116px; height: 116px; border-radius: 50%; background: conic-gradient(var(--good) var(--progress,0%), rgba(255,255,255,.10) 0); display: grid; place-items: center; margin: 0 auto; }
.progress-ring-inner { width: 88px; height: 88px; border-radius: 50%; background: #101827; display: grid; place-items: center; text-align: center; }
.progress-ring strong { font-size: 22px; letter-spacing: -.04em; }
.progress-ring small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-action { min-height: 92px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: rgba(255,255,255,.038); padding: 14px; display: grid; align-content: space-between; gap: 10px; transition: transform .16s ease, background .16s ease; }
.quick-action:active { transform: scale(.985); }
.quick-action span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 13px; background: rgba(79,124,255,.12); border: 1px solid rgba(79,124,255,.16); }
.quick-action strong { font-size: 14px; line-height: 1.2; }
.workout-header, .tracker-header, .weight-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.workout-header strong, .tracker-header strong, .weight-header strong { letter-spacing: -.02em; overflow-wrap: anywhere; }
.exercise-table { display: grid; gap: 10px; margin-top: 12px; }
.exercise-row { display: grid; grid-template-columns: 1fr; gap: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 16px; padding: 10px; }
.exercise-row.header { display: none; }
.exercise-row .input { min-height: 44px; border-radius: 13px; padding: 10px; font-size: 14px; }
.copy-box { width: 100%; min-height: 260px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: #0b111d; color: var(--soft); padding: 14px; line-height: 1.45; resize: vertical; font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size: 12px; }
.empty-state { border: 1px dashed rgba(255,255,255,.18); border-radius: var(--radius-lg); padding: 20px; text-align: center; background: rgba(255,255,255,.025); }
.empty-icon { width: 44px; height: 44px; border-radius: 17px; margin: 0 auto 10px; display: grid; place-items: center; background: rgba(79,124,255,.12); border: 1px solid rgba(79,124,255,.18); }
.empty-state strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.empty-state p { color: var(--muted); margin: 6px auto 14px; line-height: 1.45; max-width: 320px; }

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(calc(100% - 22px), 460px);
    height: 68px;
    border-radius: 25px;
    background: rgba(12,17,28,.90);
    border: 1px solid rgba(255,255,255,.12);
    backdrop-filter: blur(26px);
    box-shadow: 0 18px 55px rgba(0,0,0,.42);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 7px;
    z-index: 50;
}
.bottom-nav a { display: grid; place-items: center; gap: 2px; border-radius: 19px; color: var(--muted); font-weight: 850; transition: background .16s ease, color .16s ease, transform .16s ease; }
.bottom-nav a.active { color: #fff; background: linear-gradient(135deg, rgba(79,124,255,.28), rgba(109,93,252,.20)); border: 1px solid rgba(79,124,255,.18); }
.bottom-nav a:active { transform: scale(.96); }
.bottom-nav span { font-size: 20px; line-height: 1; }
.bottom-nav small { font-size: 10px; line-height: 1; }

.login-card { width: min(100%, 420px); padding: 26px; border-radius: 32px; border: 1px solid var(--line); background: linear-gradient(180deg, #151f34, #101827); box-shadow: var(--shadow); overflow: hidden; text-align: left; }
.login-brand { width: 74px; height: 74px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow: 0 18px 34px rgba(79,124,255,.25); margin: 0 auto 20px; font-size: 26px; font-weight: 950; overflow: hidden; }
.login-brand img { width: 100%; height: 100%; object-fit: cover; }
.login-card h1 { font-size: 34px; letter-spacing: -.075em; line-height: 1; text-align: center; }
.login-card p { color: var(--muted); line-height: 1.5; margin: 10px 0 20px; text-align: center; }
.login-footnote { display: none; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.action-row .btn { flex: 1 1 140px; }
.mini-note { color: var(--muted); font-size: 12px; line-height: 1.45; }

@media (max-width: 370px) {
    .app-shell { padding-left: 10px; padding-right: 10px; }
    .card { padding: 15px; border-radius: 24px; }
    .grid-2, .grid-3, .quick-grid { grid-template-columns: 1fr; }
    .bottom-nav small { display: none; }
    .bottom-nav { height: 60px; }
    .topbar { gap: 8px; }
    .clock-pill { width: 76px; flex-basis: 76px; font-size: 13px; }
}
