:root {
    --bg: #F5F4F0;
    --sidebar-bg: #F5F4F0;
    --card-bg: #FFFFFF;
    --text-main: #1A1C19;
    --text-muted: #6B6C68;
    --primary: #1A1C19;
    --primary-dim: rgba(26, 28, 25, 0.05);
    --accent: #E8483B;
    --success: #1B5E20;
    --success-bg: rgba(27, 94, 32, 0.1);
    --border: #1A1C19;
    --border-light: rgba(26, 28, 25, 0.15);
    --shadow: 4px 4px 0px #1A1C19;
    --shadow-hover: 6px 6px 0px #1A1C19;
    
    --radius-lg: 0px;
    --radius-md: 0px;
    --radius-sm: 0px;

    /* Semantic / Component colors */
    --table-header-bg: #f4f1ea;
    --cat-software: #EBF3FE;
    --cat-hardware: #FEF3C7;
    --cat-advanced: #FCE7F3;
    --cat-default: #F5F4F0;
    --banner-text: #1A1C19;
    --icon-bg: #ffffff;
    --tag-text: #ffffff;
  }

  [data-theme="dark"] {
    --bg: #121212;
    --sidebar-bg: #121212;
    --card-bg: #1E1E1E;
    --text-main: #F5F4F0;
    --text-muted: #A0A0A0;
    --primary: #F5F4F0;
    --primary-dim: rgba(245, 244, 240, 0.1);
    --accent: #FF5252;
    --success: #4CAF50;
    --success-bg: rgba(76, 175, 80, 0.2);
    --border: #F5F4F0;
    --border-light: rgba(245, 244, 240, 0.2);
    --shadow: 4px 4px 0px #F5F4F0;
    --shadow-hover: 6px 6px 0px #F5F4F0;

    --table-header-bg: #2C2C2C;
    /* Banners stay light pastel, but slightly dimmed */
    --cat-software: #C9DFF9;
    --cat-hardware: #EADCAE;
    --cat-advanced: #E8CCDB;
    --cat-default: #E1DFD6;
    --banner-text: #121212;
    --icon-bg: #ffffff;
    --tag-text: #121212;
  }
  
  * { box-sizing: border-box; }
  
  body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4 { font-family: 'Fraunces', serif; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
  p { margin: 0; }
  
  /* Layout */
  .layout {
    display: flex;
    min-height: 100vh;
  }
  
  .sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
  }
  
  .brand {
    padding: 0 24px 24px;
    white-space: nowrap;
    flex-wrap: nowrap;
    font-family: 'Fraunces', serif;
    font-weight: 800;
    font-size: 24px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
  }
  .brand .tag {
    font-family: 'Manrope', sans-serif;
    font-size: 10px; font-weight: 800; background: var(--text-main); color: var(--tag-text);
    padding: 4px 8px; text-transform: uppercase; letter-spacing: 1px;
  }
  
  .nav-links { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; }
  .nav-link {
    display: flex; align-items: center; gap: 14px; padding: 12px 16px;
    color: var(--text-muted); font-weight: 700; font-size: 14px;
    cursor: pointer; transition: all 0.2s;
    border: 2px solid transparent;
  }
  .nav-link:hover { color: var(--text-main); }
  .nav-link.active { 
    color: var(--text-main); 
    border: 2px solid var(--border);
    background: var(--card-bg);
    box-shadow: 2px 2px 0px var(--border);
  }
  .nav-link .icon { font-size: 18px; display: flex; align-items: center; justify-content: center; }

  .content { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
  
  /* Topbar */
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 24px 40px; border-bottom: 2px solid var(--border);
    background: var(--card-bg);
  }
  .search-bar {
    display: flex; align-items: center; gap: 10px; background: var(--card-bg);
    padding: 10px 16px; border: 2px solid var(--border); width: 340px;
    box-shadow: 2px 2px 0px var(--border);
  }
  .search-bar input {
    border: none; outline: none; background: transparent; font-family: inherit;
    font-size: 14px; font-weight: 600; color: var(--text-main); width: 100%;
  }
  .search-bar input::placeholder { color: var(--text-muted); }
  .user-menu { display: flex; align-items: center; gap: 24px; }
  .user-menu .profile { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; font-family: 'Fraunces', serif; }
  .user-menu .logout {
    font-size: 13px; color: var(--text-main); background: var(--card-bg); border: 2px solid var(--border);
    padding: 6px 16px; cursor: pointer; font-weight: 700; font-family: inherit;
    box-shadow: 2px 2px 0px var(--border); transition: all 0.1s;
  }
  .user-menu .logout:active { box-shadow: 0px 0px 0px var(--border); transform: translate(2px, 2px); }

  /* Dashboard Grid */
  .dashboard { padding: 40px; display: flex; gap: 40px; }
  .main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 40px; }

  .section-title { font-size: 24px; font-weight: 800; margin-bottom: 24px; border-bottom: 2px solid var(--border); padding-bottom: 12px; display: flex; align-items: center; justify-content: space-between;}

  /* Typographic Hero */
  .hero-statement {
    font-family: 'Fraunces', serif;
    font-size: 36px;
    line-height: 1.2;
    color: var(--text-main);
    max-width: 800px;
    padding-bottom: 20px;
  }
  .hero-statement .highlight { color: var(--accent); position: relative; display: inline-block; }
  .hero-statement .highlight::after { content: ''; position: absolute; bottom: 4px; left: 0; width: 100%; height: 4px; background: var(--accent); z-index: -1; opacity: 0.3; }

  /* Table / My Course */
  .table-card { background: var(--card-bg); border: 2px solid var(--border); box-shadow: var(--shadow); }
  .table { width: 100%; border-collapse: collapse; text-align: left; }
  .table th { padding: 16px 24px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--text-main); border-bottom: 2px solid var(--border); background: var(--table-header-bg); }
  .table td { padding: 16px 24px; font-size: 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; font-weight: 600; }
  .table tr:last-child td { border-bottom: none; }
  
  .course-info { display: flex; align-items: center; gap: 16px; }
  .course-icon { width: 44px; height: 44px; background: var(--icon-bg); border: 2px solid var(--border); box-shadow: 2px 2px 0px var(--border); display: flex; align-items: center; justify-content: center; font-size: 20px; }
  .course-info h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; font-family: 'Fraunces', serif; }
  .course-info p { font-size: 13px; color: var(--text-muted); font-weight: 600; font-family: monospace; }

  /* Admin Card Grid */
  .admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 32px; }
  .admin-card { background: var(--card-bg); box-shadow: var(--shadow); border: 2px solid var(--border); display: flex; flex-direction: column; transition: transform 0.1s; position: relative; content-visibility: auto; contain-intrinsic-size: 300px; }
  .admin-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-hover); }
  
  .admin-card-banner { width: 100%; padding: 24px; border-bottom: 2px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
  .admin-card-banner h3 { font-size: 20px; line-height: 1.2; word-wrap: break-word; color: var(--banner-text); }
  .admin-card-icon { width: 32px; height: 32px; border: 2px solid var(--border); border-radius: 50%; background: var(--icon-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 2px 2px 0px var(--border); color: var(--banner-text); }
  
  .admin-card-content { padding: 24px; flex: 1; display: flex; flex-direction: column; background: var(--card-bg); }
  .admin-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; }
  
  .admin-card-footer { padding: 0 24px 24px; background: var(--card-bg); }
  
  /* Punch Cards */
  .punch-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
  .punch-hole { 
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); 
    background: var(--card-bg); cursor: pointer; transition: 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  }
  .punch-hole:hover { background: var(--border-light); transform: scale(1.1); }
  .punch-hole.done { background: var(--accent); border-color: var(--border); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }
  .punch-hole.done:hover { background: #d03d31; opacity: 0.8; transform: scale(0.9); }
  .punch-hole:active { transform: scale(0.9); }
  
  .prog-text { font-size: 13px; color: var(--text-main); font-weight: 700; font-family: 'Fraunces', serif; }
  
  /* Login Mode */
  .login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); background-image: radial-gradient(var(--border-light) 1px, transparent 1px); background-size: 24px 24px; }
  .login-card { background: var(--card-bg); padding: 48px; width: 440px; box-shadow: 8px 8px 0px var(--border); border: 2px solid var(--border); text-align: center; }
  .login-card h2 { font-size: 32px; font-weight: 800; margin-bottom: 12px; color: var(--text-main); font-family: 'Fraunces', serif; }
  .login-card p { color: var(--text-muted); font-size: 15px; margin-bottom: 32px; font-weight: 600; }
  .login-card button { width: 100%; background: var(--card-bg); color: var(--text-main); border: 2px solid var(--border); padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 4px 4px 0px var(--border); transition: all 0.1s; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: inherit; }
  .login-card button:active { box-shadow: 0px 0px 0px var(--border); transform: translate(4px, 4px); }
  
  /* Toasts */
  #toast-container { position: fixed; bottom: 32px; right: 32px; display: flex; flex-direction: column; gap: 16px; z-index: 9999; }
  .toast { background: var(--card-bg); border: 2px solid var(--border); box-shadow: 4px 4px 0px var(--border); padding: 20px; width: 340px; animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; display: flex; flex-direction: column; gap: 6px; }
  .toast-title { font-weight: 800; font-size: 15px; color: var(--text-main); font-family: 'Fraunces', serif; }
  .toast-body { font-size: 14px; color: var(--text-muted); line-height: 1.5; font-weight: 600; }
  @keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }

  /* Notifications */
  .notif-bell { position: relative; cursor: pointer; display: flex; align-items: center; }
  .notif-badge { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; background: var(--accent); border: 2px solid #fff; border-radius: 50%; display: none; }
  .notif-badge.active { display: block; }
  .notif-dropdown { position: absolute; top: 36px; right: -10px; width: 320px; background: #fff; border: 2px solid var(--border); box-shadow: 6px 6px 0px var(--border); display: none; flex-direction: column; z-index: 100; text-align: left; cursor: default; }
  .notif-dropdown.open { display: flex; }
  .notif-header { padding: 16px; border-bottom: 2px solid var(--border); font-size: 14px; font-weight: 800; color: var(--text-main); font-family: 'Fraunces', serif; background: var(--bg); }
  .notif-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; }
  .notif-item { padding: 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; line-height: 1.5; color: var(--text-main); font-weight: 600; }
  .notif-item:last-child { border-bottom: none; }
  .notif-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 14px; font-style: italic; }

  .loading-state { text-align: center; padding: 120px; color: var(--text-main); font-size: 24px; font-weight: 700; font-family: 'Fraunces', serif; display: flex; flex-direction: column; align-items: center; gap: 16px; }
  .cursor-blink { width: 16px; height: 24px; background: var(--text-main); animation: blink 1s step-end infinite; }
  @keyframes blink { 50% { opacity: 0; } }


  @media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 2px solid var(--border); padding: 16px 0; }
    .brand { padding: 0 16px 16px; margin-bottom: 16px; font-size: 20px; }
    .nav-links { flex-direction: row; flex-wrap: wrap; padding: 0 8px; }
    .nav-link { padding: 8px 12px; }
    .topbar { padding: 16px; flex-direction: column; gap: 16px; align-items: stretch; }
    .search-bar { width: 100%; }
    .user-menu { justify-content: space-between; }
    .dashboard { padding: 16px; flex-direction: column; gap: 24px; }
    .admin-grid { grid-template-columns: 1fr; }
    .hero-statement { font-size: 28px; }
    .login-card { width: 90%; padding: 32px 24px; }
  }



  /* Save Bar */
  .save-bar { position: fixed; bottom: 0; left: 240px; right: 0; background: #fff; border-top: 2px solid var(--border); padding: 16px 40px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 -4px 0px rgba(26,28,25,0.05); transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 100; }
  .save-bar.visible { transform: translateY(0); }
  .save-btn { background: var(--text-main); color: #fff; border: 2px solid var(--border); padding: 10px 24px; font-weight: 800; font-family: 'Fraunces', serif; cursor: pointer; box-shadow: 4px 4px 0px var(--accent); transition: all 0.1s; }
  .save-btn:active { box-shadow: 0px 0px 0px var(--accent); transform: translate(4px, 4px); }
  .save-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }
  
  @media (max-width: 768px) {
    .save-bar { left: 0; padding: 16px; flex-direction: column; gap: 12px; text-align: center; }
  }