:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #ef4444; /* Design accent color */
  --primary-hover: #dc2626;
  --primary-light: #fee2e2;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-soft: 0 20px 40px -15px rgba(0,0,0,0.05);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background-color: var(--bg-body); color: var(--text-main); line-height: 1.5; font-size: 14px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.02em; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500; border-radius: var(--radius-md);
  transition: var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-secondary { background: white; color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-body); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-block { width: 100%; padding: 0.75rem 1rem; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--text-main); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon { position: absolute; left: 0.75rem; color: var(--text-muted); pointer-events: none; }
.input-wrap input, .input-wrap select, .input-wrap textarea {
  width: 100%; padding: 0.625rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: white; color: var(--text-main); font-size: 0.875rem; transition: var(--transition);
}
.input-wrap input:focus, .input-wrap select:focus, .input-wrap textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.input-wrap:has(.input-icon) input { padding-left: 2.25rem; }
.input-wrap .pwd-toggle { position: absolute; right: 0.75rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0.25rem; }
.input-wrap .pwd-toggle:hover { color: var(--text-main); }
.field-error { display: block; margin-top: 0.375rem; font-size: 0.75rem; color: var(--danger); min-height: 1.125rem; }

/* Login Page */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; overflow: hidden; background: #0f172a; }
.login-bg { position: absolute; inset: 0; z-index: 0; opacity: 0.4; }
.login-bg-circle { position: absolute; border-radius: 50%; filter: blur(80px); }
.c1 { width: 400px; height: 400px; background: var(--primary); top: -100px; right: -100px; animation: float 10s infinite ease-in-out alternate; }
.c2 { width: 300px; height: 300px; background: #3b82f6; bottom: -50px; left: -100px; animation: float 12s infinite ease-in-out alternate-reverse; }
.login-card { position: relative; z-index: 1; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px); padding: 3rem; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; border: 1px solid rgba(255,255,255,0.2); }
.login-logo { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; font-weight: 600; font-size: 1.25rem; color: var(--text-main); }
.login-logo-icon { width: 40px; height: 40px; background: var(--primary); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.login-title { font-size: 1.75rem; margin-bottom: 0.5rem; }
.login-subtitle { color: var(--text-muted); margin-bottom: 2rem; }
.login-hint { margin-top: 2rem; text-align: center; font-size: 0.75rem; color: var(--text-muted); }
.login-alert { padding: 0.75rem; background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-md); font-size: 0.875rem; margin-bottom: 1rem; text-align: center; }

@keyframes float { 0% { transform: translate(0, 0); } 100% { transform: translate(30px, 30px); } }

/* App Layout */
.app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { width: 260px; background: white; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; transition: var(--transition); }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border-light); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; font-size: 1.25rem; }
.sidebar-logo-icon { width: 32px; height: 32px; background: var(--primary); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.sidebar-nav { flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--text-muted); border-radius: var(--radius-md); font-weight: 500; transition: var(--transition); }
.nav-item:hover { background: var(--bg-body); color: var(--text-main); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { padding: 0.5rem; color: var(--text-muted); border-radius: var(--radius-md); transition: var(--transition); }
.btn-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* Main Content */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-body); }
.content-page { flex: 1; padding: 2rem; overflow-y: auto; display: flex; flex-direction: column; }

/* Page Headers */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; }
.page-title { font-size: 1.5rem; margin-bottom: 0.25rem; }
.page-desc { color: var(--text-muted); font-size: 0.875rem; }

/* Top Toolbar */
.toolbar { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem; background: white; padding: 1rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.toolbar-search { flex: 1; max-width: 300px; }
.toolbar-filters { display: flex; gap: 0.75rem; }
.toolbar-actions { margin-left: auto; display: flex; gap: 0.75rem; }

/* Cards & Grids */
.bento-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.card { background: white; border-radius: var(--radius-lg); padding: 1.5rem; border: 1px solid var(--border-light); box-shadow: var(--shadow-soft); transition: var(--transition); display: flex; flex-direction: column; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--border); }
.card-title-wrap { display: flex; align-items: center; gap: 0.75rem; }
.card-avatar { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.25rem; flex-shrink: 0; }
.card-title { font-size: 1.125rem; font-weight: 600; }
.card-subtitle { font-size: 0.75rem; color: var(--text-muted); background: var(--bg-body); padding: 0.125rem 0.5rem; border-radius: 1rem; margin-top: 0.25rem; display: inline-block; }
.badge { font-size: 0.75rem; padding: 0.25rem 0.625rem; border-radius: 1rem; font-weight: 500; border: 1px solid currentColor; background: transparent; }
.badge.primary { color: var(--primary); background: var(--primary-light); border-color: transparent; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.info-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-muted); }
.info-row svg { color: var(--text-light); }
.info-value { color: var(--text-main); font-weight: 500; }
.progress-bar { display: flex; gap: 0.5rem; align-items: center; font-size: 0.75rem; margin-top: 0.5rem; }
.progress-pill { padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); background: var(--bg-body); color: var(--text-muted); }
.progress-pill.done { background: var(--success-bg); color: var(--success); }
.progress-pill.todo { background: var(--warning-bg); color: var(--warning); }
.card-footer { display: flex; justify-content: space-between; align-items: center; }
.status-dot { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--text-muted); }
.status-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.card-actions { display: flex; gap: 0.5rem; }

/* Task List Item */
.task-item { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border-light); padding: 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.task-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.task-item-title { display: flex; align-items: center; gap: 1rem; font-size: 1.125rem; font-weight: 600; }
.task-no { background: var(--bg-body); color: var(--primary); padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.875rem; font-family: monospace; }
.task-guide { padding: 1rem; background: var(--bg-body); border-radius: var(--radius-md); font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; border-left: 3px solid var(--primary); }
.task-guide-label { font-weight: 600; color: var(--text-main); margin-bottom: 0.25rem; }
.task-hint { display: flex; gap: 0.5rem; padding: 0.75rem; background: var(--warning-bg); border-radius: var(--radius-md); font-size: 0.875rem; color: #b45309; }

/* Table */
.table-wrap { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { background: var(--bg-body); padding: 1rem; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table td { padding: 1rem; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-body); }

/* Modals & Drawers */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); z-index: 50; display: flex; justify-content: center; align-items: center; opacity: 1; transition: opacity 0.2s; }
#exec-overlay { z-index: 60; }
.modal-overlay.hidden { display: none !important; opacity: 0; }
.modal-box { background: white; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 500px; display: flex; flex-direction: column; max-height: 90vh; transform: scale(1); transition: transform 0.2s; }
.modal-box--md { max-width: 600px; }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1.25rem; font-weight: 600; }
.modal-close { color: var(--text-muted); padding: 0.5rem; border-radius: var(--radius-sm); margin: -0.5rem; }
.modal-close:hover { background: var(--bg-body); color: var(--text-main); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1.5rem; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* Drawer */
.drawer-box { position: absolute; right: 0; top: 0; bottom: 0; width: 100%; max-width: 1100px; background: white; box-shadow: -10px 0 30px rgba(0,0,0,0.1); display: flex; flex-direction: column; transform: translateX(0); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-overlay.hidden .drawer-box { transform: translateX(100%); }
.drawer-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; background: #fdfdfd; }
.drawer-header-left { display: flex; align-items: center; gap: 1rem; }
.drawer-icon { width: 40px; height: 40px; background: var(--primary-light); color: var(--primary); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.drawer-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.125rem; }
.drawer-subtitle { font-size: 0.875rem; color: var(--text-muted); }

/* Drawer Tabs */
.drawer-tabs { display: flex; gap: 1.5rem; padding: 0 2rem; background: #fdfdfd; border-bottom: 1px solid var(--border-light); }
.drawer-tab { padding: 1rem 0; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent; cursor: pointer; transition: var(--transition); }
.drawer-tab:hover { color: var(--text-main); }
.drawer-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.drawer-body { padding: 2rem; overflow-y: auto; flex: 1; background: var(--bg-body); }

/* Execution Panel (inside drawer) */
.exec-stats { display: flex; gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: white; border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 1rem 1.5rem; min-width: 120px; display: flex; flex-direction: column; align-items: center; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-val { font-size: 1.5rem; font-weight: 700; font-family: monospace; }
.stat-val.total { color: var(--text-main); }
.stat-val.done { color: var(--success); }
.stat-val.todo { color: var(--warning); }
.drawer-table-wrap { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
.exec-status-badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 500; }
.exec-status-badge.done { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.exec-status-badge.todo { color: var(--text-light); }

/* Empty State */
.empty-state { padding: 4rem 2rem; text-align: center; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; background: white; border-radius: var(--radius-lg); border: 1px dashed var(--border); }
.empty-icon { width: 64px; height: 64px; background: var(--bg-body); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; color: var(--border); }

/* Confirm */
.confirm-box { background: white; padding: 2rem; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); max-width: 360px; text-align: center; }
.confirm-icon { width: 48px; height: 48px; background: var(--danger-bg); color: var(--danger); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }
.confirm-title { font-size: 1.125rem; margin-bottom: 0.5rem; }
.confirm-msg { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.confirm-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* Toast */
.toast-container { position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; align-items: center; }
.toast { background: white; padding: 1rem 1.25rem; border-radius: var(--radius-md); box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; font-weight: 500; transform: translateY(-20px); opacity: 0; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); pointer-events: auto; border-left: 4px solid var(--primary); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }


.hero-tab-btn { background: transparent; border: none; padding: 0.5rem 1.25rem; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); border-radius: 6px; cursor: pointer; transition: all 0.2s; } .hero-tab-btn:hover { color: var(--text-main); } .hero-tab-btn.active { background: white; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

#modal-overlay { z-index: 60; }
#confirm-overlay { z-index: 70; }
