/* =========================================================
   PANTA AI WORKSPACE - MODERN EDUCATIONAL SAAS DESIGN SYSTEM
   ========================================================= */

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-jp: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;

    /* Palette */
    --primary: #4F46E5;        /* Indigo 600 */
    --primary-hover: #4338CA;  /* Indigo 700 */
    --primary-light: #EEF2FF;  /* Indigo 50 */
    --primary-glow: rgba(79, 70, 229, 0.25);

    --pro-gold: #F59E0B;       /* Amber 500 */
    --pro-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --pro-glow: rgba(245, 158, 11, 0.3);

    --success: #10B981;        /* Emerald 500 */
    --success-light: #ECFDF5;
    --danger: #EF4444;         /* Rose 500 */
    --danger-light: #FEF2F2;
    --warning: #F59E0B;
    --warning-light: #FFFBEB;

    --bg-app: #F8FAFC;         /* Slate 50 */
    --bg-card: #FFFFFF;
    --bg-surface: #F1F5F9;

    --border: #E2E8F0;
    --border-hover: #CBD5E1;

    --text-title: #0F172A;     /* Slate 900 */
    --text-body: #334155;      /* Slate 700 */
    --text-muted: #64748B;     /* Slate 500 */
    --text-faint: #94A3B8;     /* Slate 400 */

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --sidebar-w: 260px;
    --header-h: 70px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
}

/* =========================================================
   LAYOUT
   ========================================================= */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: #FFFFFF;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-header {
    height: var(--header-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sidebar-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.sidebar-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
    font-size: 20px;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.5px;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    margin-top: -3px;
}

.sidebar-nav {
    padding: 20px 14px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 12px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: var(--bg-surface);
    color: var(--text-title);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.nav-link .icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: #FAFAFA;
}

.pro-box {
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
    color: white;
    padding: 14px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(49, 46, 129, 0.2);
    position: relative;
    overflow: hidden;
}

.pro-box h4 {
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.pro-box p {
    font-size: 11px;
    opacity: 0.85;
    line-height: 1.4;
    margin-bottom: 10px;
}

.btn-pro-upgrade {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--pro-gradient);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 12px;
    padding: 7px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 6px var(--pro-glow);
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn-pro-upgrade:hover {
    filter: brightness(1.1);
}

/* Main Area */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--header-h);
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-title);
    cursor: pointer;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-gamification {
    display: flex;
    align-items: center;
    gap: 20px;
    border-right: 1px solid #e5e7eb;
    padding-right: 20px;
}

.topbar-gamification:not(:has(> :not([style*="display: none"]))) {
    display: none;
}

.streak-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    line-height: 1;
}

.streak-fire {
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.goal-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    line-height: 1;
}

.goal-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.goal-bar {
    width: 64px;
    height: 6px;
    background: #f3f4f6;
    border-radius: 9999px;
    overflow: hidden;
    flex-shrink: 0;
}

.goal-fill {
    height: 100%;
    max-width: 100%;
    background: var(--primary);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.goal-text {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.badge-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .topbar-gamification {
        gap: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 560px) {
    .goal-pill .goal-label {
        display: none;
    }
}

.quota-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-body);
    transition: border-color 0.2s;
}

.quota-pill:hover {
    border-color: #C7D2FE;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 6px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: #FFFFFF;
    cursor: pointer;
    transition: 0.15s;
    position: relative;
}

.user-pill:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary);
    font-size: 14px;
}

.badge-pro {
    background: var(--pro-gradient);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.content-body {
    padding: 28px;
    flex: 1;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

/* =========================================================
   COMPONENTS & UI ELEMENTS
   ========================================================= */

.card {
  background: var(--bg-card);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #FFFFFF;
    color: var(--text-title);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--border-hover);
}

.btn-pro {
    background: var(--pro-gradient);
    color: white;
    box-shadow: 0 4px 10px var(--pro-glow);
}

.btn-pro:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: #FECACA;
}

.btn-danger:hover {
    background: #FEE2E2;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

/* Personal Study Header (Notion & WaniKani Style) */
.study-header {
  background: #FFFFFF;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.study-header-main {
    flex: 1;
    min-width: 280px;
}

.study-greeting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.study-greeting-row h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.4px;
    margin: 0;
}

.study-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: #FFF7ED;
    border: 1px solid #FFEDD5;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 800;
    color: #EA580C;
}

.study-header p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.study-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-study-start {
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--primary-glow);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-study-start:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-study-start:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Stats Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #ddd6fe;
}

/* Due Card Highlight States */
.stat-card.stat-card-due-alert {
    border-color: #FECACA;
    background: #FFFDFD;
}

.stat-card.stat-card-due-alert:hover {
    border-color: #F87171;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.08);
}

.stat-card.stat-card-due-done {
    border-color: #BBF7D0;
    background: #FDFFFD;
}

.stat-card.stat-card-due-done:hover {
    border-color: #86EFAC;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.08);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #f3f4f6;
  color: #4b5563;
  transition: background 0.2s ease, color 0.2s ease;
}

.stat-icon-due-alert {
    background: #FEE2E2;
    color: #DC2626;
}

.stat-icon-due-done {
    background: #DCFCE7;
    color: #16A34A;
}

.stat-delta {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  background: #ECFDF5;
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid #A7F3D0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat-delta-kanji {
    background: #FFFBEB;
    color: #B45309;
    border-color: #FDE68A;
}

.stat-delta-grammar {
    background: #FAF5FF;
    color: #7E22CE;
    border-color: #E9D5FF;
}

.stat-delta-alert {
    background: #FEE2E2;
    color: #B91C1C;
    border-color: #FCA5A5;
}

.stat-delta-done {
    background: #ECFDF5;
    color: #059669;
    border-color: #A7F3D0;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 900;
    color: var(--text-title);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-info span {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
  margin-top: 8px;
  display: block;
}

/* Dashboard Sections Grid (8pt Grid) */
.dashboard-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.card-deck-action {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-card-header-stack {
    flex-wrap: wrap;
    gap: 8px;
}

.section-card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-title);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.section-card-desc {
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.6;
    margin-bottom: 16px;
}

.section-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.section-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.link-view-all,
.link-inline-action {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    transition: color 0.15s ease;
}

.link-view-all:hover,
.link-inline-action:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.deck-list-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.steps-guide {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #F5F3FF 0%, #EEF2FF 100%);
    border: 1px solid #E0E7FF;
    border-radius: var(--radius-md);
    font-size: 12px;
    flex-wrap: wrap;
}

.steps-guide-label {
    font-weight: 800;
    color: var(--primary);
}

.steps-guide-text {
    color: var(--text-body);
}

.badge-success-subtle {
    background: #ECFDF5;
    color: #059669;
    font-weight: 800;
}

/* Empty States & Guide Box */
.empty-state-box {
    text-align: center;
    padding: 32px 20px;
    background: #FAFAFA;
    border: 2px dashed #E2E8F0;
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: #F1F5F9;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.empty-state-icon-success {
    background: #FEF3C7;
    color: #D97706;
}

.hardest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Hardest Cards (Leech Prevention) */
.hard-card {
    background: #FFF1F2;
    border: 1px solid #FECDD3;
    border-radius: var(--radius-md);
    padding: 16px 18px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.hard-card:hover {
    border-color: #FB7185;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(225, 29, 72, 0.08);
}

.hard-card-term {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-title);
    font-family: var(--font-jp);
    line-height: 1.3;
}

.hard-card-reading {
    font-size: 13px;
    font-weight: 700;
    color: #DC2626;
    margin-top: 4px;
}

.hard-card-meaning {
    font-size: 13px;
    color: var(--text-body);
    margin-top: 6px;
    line-height: 1.4;
}

.btn-speak-hard {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.btn-speak-hard:hover {
    background: var(--primary-light);
    border-color: #C7D2FE;
    color: var(--primary);
}

.btn-speak-hard:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: #E2E8F0;
    }
    .btn-study-start,
    .stat-card,
    .hard-card,
    .card {
        transition: none;
        transform: none !important;
    }
}

/* Tags & Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.badge-ai {
    background: #FAF5FF;
    color: #9333EA;
    border: 1px solid #E9D5FF;
}

.badge-doc {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
}

.badge-unverified {
    background: #FFFBEB;
    color: #B45309;
    border: 1px solid #FDE68A;
}

.badge-verified {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.badge-relearn {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.badge-mature {
    background: #F0FDF4;
    color: #16A34A;
    border: 1px solid #BBF7D0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: 0.15s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-title);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 520px;
    width: 100%;
    padding: 28px;
    box-shadow: var(--shadow-xl);
    animation: popIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Toast */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 14px 22px;
    background: #1E293B;
    color: white;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: popIn 0.2s ease;
}

.toast-success { background: #065F46; }
.toast-error { background: #991B1B; }

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .topbar {
        padding: 0 16px;
    }
    .content-body {
        padding: 16px;
    }
    .hero-cta {
        padding: 24px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* =========================================================
   USER DROPDOWN MENU & PROFILE MODAL
   ========================================================= */

.user-pill-wrapper {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
    padding: 8px;
    z-index: 1000;
    animation: dropdownSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ud-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 12px;
}

.ud-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.ud-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ud-meta {
    flex: 1;
    min-width: 0;
}

.ud-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-title);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ud-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.ud-plan {
    margin-top: 4px;
}

.badge-free {
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: inline-block;
}

.ud-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}

.ud-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ud-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, transform 0.1s;
}

.ud-menu-item:hover {
    background: var(--bg-surface);
}

.ud-menu-item:active {
    transform: scale(0.99);
}

.ud-icon {
    font-size: 16px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ud-item-text {
    flex: 1;
    min-width: 0;
}

.ud-item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-title);
}

.ud-item-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.ud-item-danger:hover {
    background: var(--danger-light);
}

.ud-item-danger .ud-item-title {
    color: var(--danger);
}

a.card:hover, .card-clickable:hover, .card[onclick]:hover {
  border-color: #ddd6fe;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.panta-feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: pantaFadeIn 0.2s ease-out;
}

@keyframes pantaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pantaScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.panta-feedback-modal {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  text-align: center;
  animation: pantaScaleIn 0.2s ease-out;
}

.panta-feedback-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panta-feedback-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.panta-feedback-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.panta-feedback-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px;
}

.panta-feedback-sub {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 16px;
  line-height: 1.4;
}

.panta-feedback-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.panta-feedback-star {
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  color: #e5e7eb;
  transition: color 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.panta-feedback-star:hover {
  transform: scale(1.15);
}

.panta-feedback-star.active,
.panta-feedback-star.hover {
  color: #f59e0b;
}

.panta-feedback-rating-label {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  min-height: 20px;
  margin-bottom: 14px;
}

.panta-feedback-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  color: #111827;
  resize: vertical;
  min-height: 72px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panta-feedback-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.panta-feedback-error {
  font-size: 12px;
  color: #ef4444;
  margin-bottom: 12px;
  display: none;
}

.panta-feedback-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.panta-feedback-btn-dismiss {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panta-feedback-btn-dismiss:hover {
  background: #f3f4f6;
  color: #111827;
}

.panta-feedback-btn-submit {
  border: none;
  background: #6366f1;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.panta-feedback-btn-submit:hover:not(:disabled) {
  background: #4f46e5;
}

.panta-feedback-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.panta-feedback-success {
  padding: 16px 0 8px;
}

.panta-feedback-success-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

/* =========================================================
   LUCIDE ICONS SYSTEM
   ========================================================= */

.lucide {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.nav-link .lucide {
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.nav-link:hover .lucide,
.nav-link.active .lucide {
    color: var(--primary);
}

.streak-pill .lucide-flame {
    color: #F59E0B;
}

.quota-pill .lucide-zap {
    color: var(--primary);
}

.stat-icon .lucide {
    color: currentColor;
}

.pro-box .lucide-crown {
    color: #FBBF24;
}

.ud-icon .lucide {
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.ud-menu-item:hover .ud-icon .lucide {
    color: var(--primary);
}

.ud-item-danger:hover .ud-icon .lucide {
    color: var(--danger);
}

/* =========================================================
   PROFILE EDIT MODAL - MODERN MINIMALIST & JAPANESE DESIGN
   ========================================================= */

.profile-modal-card {
    max-width: 500px;
    width: 100%;
    padding: 0;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    background: #FFFFFF;
    box-shadow: 
        0 4px 6px -1px rgba(15, 23, 42, 0.05),
        0 16px 28px -6px rgba(15, 23, 42, 0.1),
        0 32px 56px -12px rgba(79, 70, 229, 0.08);
    display: flex;
    flex-direction: column;
    max-height: min(90vh, 720px);
    overflow: hidden;
    animation: profileModalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes profileModalPopIn {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.profile-modal-header {
    padding: 22px 26px 16px 26px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFC 100%);
}

.profile-header-meta {
    flex: 1;
    min-width: 0;
}

.profile-sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.profile-jp-tag {
    font-family: var(--font-jp);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 7px;
    border-radius: 5px;
    line-height: 1.3;
}

.profile-badge-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-faint);
}

.profile-badge-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.profile-modal-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.3px;
    line-height: 1.25;
    margin: 0 0 3px 0;
}

.profile-modal-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.profile-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #FFFFFF;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.profile-close-btn:hover {
    background: var(--bg-surface);
    color: var(--text-title);
    border-color: var(--border-hover);
    transform: rotate(90deg);
}

.profile-close-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.profile-modal-body {
    padding: 20px 26px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.profile-modal-body::-webkit-scrollbar {
    width: 6px;
}

.profile-modal-body::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}

/* Centered Avatar Section */
.profile-avatar-center-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0 2px 0;
}

.profile-avatar-container {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    background: #FFFFFF;
    border: 3.5px solid #FFFFFF;
    box-shadow: 0 0 0 2px var(--primary-light), 0 6px 18px rgba(79, 70, 229, 0.16);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    user-select: none;
    outline: none;
}

.profile-avatar-container:hover {
    transform: scale(1.04);
    box-shadow: 0 0 0 2.5px var(--primary), 0 8px 24px rgba(79, 70, 229, 0.22);
}

.profile-avatar-container:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary), 0 8px 24px rgba(79, 70, 229, 0.25);
}

.profile-avatar-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 800;
    color: var(--primary);
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    overflow: hidden;
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-hover-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.profile-avatar-container:hover .profile-avatar-hover-overlay,
.profile-avatar-container:focus-visible .profile-avatar-hover-overlay {
    opacity: 1;
}

.profile-avatar-overlay-text {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.profile-avatar-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    user-select: none;
}

/* Form Fields */
.profile-form-group {
    display: flex;
    flex-direction: column;
}

.profile-input-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-title);
    margin-bottom: 6px;
    cursor: pointer;
}

.profile-label-icon {
    display: inline-flex;
    color: var(--primary);
    opacity: 0.85;
}

.profile-input-wrap {
    position: relative;
    width: 100%;
}

.profile-input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    background: #FFFFFF;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-title);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    outline: none;
}

.profile-input::placeholder {
    color: var(--text-faint);
}

.profile-input:hover {
    border-color: var(--border-hover);
}

.profile-input:focus {
    border-color: var(--primary);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.profile-input-tip {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.4;
}

/* Google OAuth Banner */
.profile-google-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: var(--radius-md);
}

.profile-google-icon {
    display: inline-flex;
    color: var(--primary);
    margin-top: 1px;
    flex-shrink: 0;
}

.profile-google-text {
    flex: 1;
}

.profile-google-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #3730A3;
    margin-bottom: 2px;
}

.profile-google-desc {
    font-size: 11.5px;
    color: #4F46E5;
    line-height: 1.4;
}

/* Password Bento Section */
.profile-password-bento {
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-password-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.profile-password-icon {
    display: inline-flex;
    color: var(--text-muted);
    margin-top: 2px;
    flex-shrink: 0;
}

.profile-password-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-title);
    margin-bottom: 2px;
}

.profile-password-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.35;
}

.profile-password-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Error Banner */
.profile-error-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--danger-light);
    border: 1px solid #FECACA;
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    animation: profileShake 0.25s ease-in-out;
}

.profile-error-icon {
    display: inline-flex;
    flex-shrink: 0;
}

@keyframes profileShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Modal Footer Actions */
.profile-modal-footer {
    padding: 16px 26px 20px 26px;
    border-top: 1px solid var(--border);
    background: #FFFFFF;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.profile-btn-cancel {
    height: 40px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-body);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.profile-btn-cancel:hover {
    background: var(--border);
    color: var(--text-title);
}

.profile-btn-save {
    height: 40px;
    padding: 0 22px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 700;
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    box-shadow: 0 2px 8px var(--primary-glow);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 124px;
}

.profile-btn-save:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.profile-btn-save:active:not(:disabled) {
    transform: scale(0.98);
}

.profile-btn-save:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .profile-modal-card {
        max-height: calc(100vh - 24px);
        border-radius: 16px;
        margin: 12px;
    }

    .profile-modal-header {
        padding: 18px 18px 14px 18px;
    }

    .profile-modal-body {
        padding: 16px 18px;
        gap: 14px;
    }

    .profile-modal-footer {
        padding: 14px 18px 18px 18px;
    }

    .profile-btn-cancel,
    .profile-btn-save {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .profile-modal-card,
    .profile-avatar-container,
    .profile-avatar-hover-overlay,
    .profile-btn-save,
    .profile-close-btn,
    .profile-error-banner {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* =========================================================
   APP FOOTER (AUTHOR ATTRIBUTION) - MODERN MINIMALIST
   ========================================================= */

.app-footer {
    width: 100%;
    padding: 22px 28px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-footer-inner {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.app-footer-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.01em;
    user-select: none;
    line-height: 1.5;
}

.app-footer-author {
    color: var(--text-title);
    font-weight: 700;
    transition: color 0.15s ease;
}

.app-footer-author:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .app-footer {
        padding: 18px 16px;
    }

    .app-footer-text {
        font-size: 12px;
    }
}


