/* Tracknn web — design tokens & layout (light / dark) */
:root {
  --tn-primary: #0EA5E9; --tn-primary-2: #0284C7; --tn-violet: #7C3AED; --tn-green: #10B981; --tn-amber: #F59E0B; --tn-red: #EF4444;
  --tn-bg: #F0F9FF; --tn-surface: #FFFFFF; --tn-surface-2: #F8FAFC; --tn-text: #0F172A; --tn-muted: #64748B; --tn-line: #E2E8F0;
  --tn-hero: linear-gradient(135deg, #E0F2FE 0%, #CCFBF1 100%);
  --tn-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(2, 132, 199, .06);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --tn-bg: #0B1220; --tn-surface: #111A2E; --tn-surface-2: #0F172A; --tn-text: #E2E8F0; --tn-muted: #94A3B8; --tn-line: #1E293B;
    --tn-hero: linear-gradient(135deg, #0C2A3F 0%, #0B2E2A 100%); --tn-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --tn-bg: #0B1220; --tn-surface: #111A2E; --tn-surface-2: #0F172A; --tn-text: #E2E8F0; --tn-muted: #94A3B8; --tn-line: #1E293B;
  --tn-hero: linear-gradient(135deg, #0C2A3F 0%, #0B2E2A 100%); --tn-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; color-scheme: dark;
}

html, body { background: var(--tn-bg); color: var(--tn-text); font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
#root { min-height: 100vh; }
i[class^="ri-"], i[class*=" ri-"] { line-height: 1; vertical-align: -0.125em; }

/* boot splash */
.tn-boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: linear-gradient(160deg, #0EA5E9, #0284C7); color: #fff; z-index: 9999; transition: opacity .3s; }
.tn-boot img { border-radius: 20px; box-shadow: 0 16px 40px rgba(0,0,0,.25); }
.tn-boot-title { font-weight: 800; font-size: 28px; letter-spacing: -.5px; }
.tn-boot-bar { width: 120px; height: 4px; background: rgba(255,255,255,.3); border-radius: 4px; overflow: hidden; }
.tn-boot-bar span { display: block; width: 40%; height: 100%; background: #fff; border-radius: 4px; animation: tn-load 1s infinite ease-in-out; }
@keyframes tn-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.tn-boot.done { opacity: 0; pointer-events: none; }

/* shell */
.tn-sider { background: var(--tn-surface) !important; border-right: 1px solid var(--tn-line); }
.tn-sider .ant-menu { background: transparent !important; border-inline-end: 0 !important; }
.tn-logo { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 800; font-size: 19px; color: var(--tn-text); }
.tn-logo img { width: 34px; height: 34px; border-radius: 10px; }
.tn-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: color-mix(in srgb, var(--tn-bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--tn-line); }
.tn-header h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.tn-header .sub { font-size: 12px; color: var(--tn-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.tn-content { padding: 20px; max-width: 1280px; width: 100%; margin: 0 auto; }
.tn-hero { background: var(--tn-hero); border-radius: 22px; padding: 22px; margin-bottom: 18px; position: relative; overflow: hidden; }
.tn-hero h2 { margin: 0; font-size: 24px; font-weight: 800; }
.tn-hero p { margin: 4px 0 0; color: var(--tn-muted); }

.tn-card { background: var(--tn-surface); border: 1px solid var(--tn-line); border-radius: 18px; box-shadow: var(--tn-shadow); }
.tn-card-pad { padding: 18px; }
.tn-card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.tn-stat { display: flex; gap: 14px; align-items: center; padding: 16px; }
.tn-stat .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex: none; }
.tn-stat .v { font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--tn-text); }
.tn-stat .l { font-size: 12px; color: var(--tn-muted); font-weight: 600; }
.tn-grid { display: grid; gap: 16px; }
.tn-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tn-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tn-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tn-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tn-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .tn-grid-4, .tn-grid-3, .tn-grid-2 { grid-template-columns: 1fr; } .tn-content { padding: 14px 16px 96px; } }

.tn-muted { color: var(--tn-muted); }
.tn-empty { text-align: center; padding: 40px 16px; color: var(--tn-muted); }
.tn-empty i { font-size: 44px; color: var(--tn-primary); opacity: .8; display: block; margin-bottom: 8px; }
.tn-empty b { color: var(--tn-text); display: block; font-size: 16px; margin-bottom: 4px; }

/* list items */
.tn-item { display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: var(--tn-surface); border: 1px solid var(--tn-line); position: relative; transition: transform .12s, box-shadow .12s; }
.tn-item:hover { box-shadow: var(--tn-shadow); }
.tn-item .bar { position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; }
.tn-item .title { font-weight: 700; font-size: 15px; }
.tn-item.done .title { text-decoration: line-through; color: var(--tn-muted); }
.tn-time { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--tn-violet); display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 14px; color: var(--tn-violet); flex: none; line-height: 1.05; }
.tn-time small { display: block; font-size: 10px; font-weight: 600; }

/* notes */
.tn-notes { columns: 4 240px; column-gap: 14px; }
.tn-note { break-inside: avoid; margin-bottom: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--tn-line); cursor: pointer; transition: transform .12s, box-shadow .12s; background: var(--tn-surface); }
.tn-note:hover { transform: translateY(-2px); box-shadow: var(--tn-shadow); }
.tn-note h4 { margin: 8px 0 4px; font-size: 15px; }
.tn-note p { margin: 0; color: var(--tn-muted); font-size: 13px; white-space: pre-line; word-break: break-word; max-height: 160px; overflow: hidden; }
.tn-note-view { font-size: 15px; line-height: 1.7; word-break: break-word; }
.tn-note-view img { max-width: 100%; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--tn-line) !important; }
.ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; background: var(--tn-surface-2); }
.ql-container.ql-snow { border-radius: 0 0 12px 12px; min-height: 260px; font-size: 15px; font-family: inherit; }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: #cbd5e1; } [data-theme="dark"] .ql-snow .ql-fill { fill: #cbd5e1; } [data-theme="dark"] .ql-snow .ql-picker { color: #cbd5e1; }

/* calendar */
.tn-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.tn-cal .dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--tn-muted); padding: 4px 0; }
.tn-cal .day { aspect-ratio: 1 / .82; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font-weight: 700; border: 1px solid transparent; transition: background .12s; user-select: none; }
.tn-cal .day:hover { background: color-mix(in srgb, var(--tn-primary) 10%, transparent); }
.tn-cal .day.out { opacity: .35; }
.tn-cal .day.today { border-color: var(--tn-primary); color: var(--tn-primary); }
.tn-cal .day.sel { background: var(--tn-primary); color: #fff; }
.tn-cal .dots { display: flex; gap: 3px; height: 6px; }
.tn-cal .dots span { width: 6px; height: 6px; border-radius: 50%; }

/* realtime flash */
@keyframes tn-flash { 0% { background: rgba(14,165,233,.35); } 100% { background: transparent; } }
.row-flash > td, .tn-flash { animation: tn-flash 1.8s ease-out; }
.tn-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tn-green); display: inline-block; box-shadow: 0 0 0 0 rgba(16,185,129,.6); animation: tn-pulse 1.8s infinite; }
.tn-live-dot.off { background: var(--tn-muted); animation: none; }
@keyframes tn-pulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,.55); } 70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

/* voice */
.tn-mic { width: 96px; height: 96px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--tn-primary), var(--tn-primary-2)); color: #fff; font-size: 40px; cursor: pointer; box-shadow: 0 12px 30px rgba(14,165,233,.4); transition: transform .15s; }
.tn-mic:hover { transform: scale(1.04); }
.tn-mic.on { background: linear-gradient(135deg, #EF4444, #DC2626); animation: tn-mic 1.2s infinite; }
@keyframes tn-mic { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 70% { box-shadow: 0 0 0 22px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }

/* charts */
.tn-chart text { fill: var(--tn-muted); font-size: 11px; font-family: inherit; }
.tn-chart .grid { stroke: var(--tn-line); stroke-width: 1; }
.tn-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--tn-muted); }
.tn-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tn-legend i.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tn-tip { position: absolute; pointer-events: none; background: var(--tn-surface); border: 1px solid var(--tn-line); box-shadow: var(--tn-shadow); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--tn-text); white-space: nowrap; z-index: 5; }

/* mobile bottom nav */
.tn-bottomnav { display: none; }
@media (max-width: 900px) {
  .tn-bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--tn-surface); border-top: 1px solid var(--tn-line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tn-bottomnav button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: 11px; font-weight: 600; color: var(--tn-muted); padding: 4px 8px; cursor: pointer; }
  .tn-bottomnav button i { font-size: 22px; }
  .tn-bottomnav button.on { color: var(--tn-primary); }
  .tn-bottomnav .fab { width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, var(--tn-primary), var(--tn-primary-2)); color: #fff; margin-top: -22px; box-shadow: 0 8px 20px rgba(14,165,233,.45); justify-content: center; }
  .tn-bottomnav .fab i { font-size: 26px; }
}

/* auth */
.tn-auth-body { background: radial-gradient(900px 500px at 0% 0%, #0EA5E933, transparent), radial-gradient(800px 500px at 100% 100%, #10B98133, transparent), var(--tn-bg); }
.tn-auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.tn-auth-art { background: linear-gradient(160deg, #0EA5E9 0%, #0284C7 55%, #0F766E 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.tn-auth-art h1 { font-size: 40px; line-height: 1.1; margin: 0 0 12px; font-weight: 800; letter-spacing: -1px; }
.tn-auth-art .feat { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.tn-auth-art .feat i { font-size: 20px; background: rgba(255,255,255,.18); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tn-auth-form { display: grid; place-items: center; padding: 24px 16px; }
.tn-auth-card { width: 100%; max-width: 420px; }
@media (max-width: 900px) { .tn-auth { grid-template-columns: 1fr; } .tn-auth-art { display: none; } }

.tn-offline { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 60; background: #0F172A; color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; display: flex; gap: 8px; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.tn-maint { background: #FEF3C7; color: #92400E; padding: 8px 16px; font-size: 13px; text-align: center; font-weight: 600; }
@media (max-width: 700px) {
  .tn-header { padding: 10px 12px; gap: 8px; }
  .tn-header .sub, .tn-hide-sm { display: none !important; }
  .tn-header h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* categories */
.tn-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tn-cat { --c: #0EA5E9; position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 18px; border-radius: 18px; background: var(--tn-surface); border: 1px solid var(--tn-line); box-shadow: var(--tn-shadow); overflow: hidden; transition: transform .12s, box-shadow .12s; min-width: 0; }
.tn-cat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.tn-cat:hover { transform: translateY(-2px); }
.tn-cat-ic { width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.tn-cat-body { flex: 1; min-width: 0; }
.tn-cat-name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--tn-text); }
.tn-cat-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--tn-muted); }
.tn-cat-actions { display: flex; flex-direction: column; gap: 2px; opacity: .55; transition: opacity .12s; }
.tn-cat:hover .tn-cat-actions { opacity: 1; }
@media (hover: none) { .tn-cat-actions { opacity: 1; } }
.tn-emoji-pick { display: flex !important; flex-wrap: wrap; gap: 6px; }
.tn-emoji-pick .ant-radio-button-wrapper { border-radius: 10px !important; border-inline-start-width: 1px !important; font-size: 18px; padding: 0 10px; }
.tn-emoji-pick .ant-radio-button-wrapper::before { display: none !important; }

/* note card quick actions */
.tn-note { position: relative; }
.tn-note-actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 2px; background: var(--tn-surface); border: 1px solid var(--tn-line); border-radius: 10px; padding: 2px; opacity: 0; transition: opacity .12s; }
.tn-note:hover .tn-note-actions { opacity: 1; }
@media (hover: none) { .tn-note-actions { opacity: 1; position: static; margin-top: 8px; width: max-content; } }

/* Quick view (activity / reminder / note) */
.tn-qv-title { margin: 12px 0 4px; font-weight: 800; font-size: 22px; line-height: 1.3; word-break: break-word; }
.tn-qv-note { margin-top: 12px; max-height: 50vh; overflow: auto; padding-right: 4px; }
.tn-qv-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .tn-qv-footer { flex-direction: column-reverse; align-items: stretch; }
  .tn-qv-footer .ant-space { width: 100%; justify-content: space-between; }
}
