@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base: #F0F4F9;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F7FAFC;
  --bg-hover: #EDF2F7;
  --border: #E2E8F0;
  --accent: #0EA5E9;
  --accent-hover: #0284C7;
  --accent-subtle: rgba(14,165,233,0.08);
  --text-primary: #1A202C;
  --text-secondary: #4A5568;
  --text-muted: #A0AEC0;
  --success: #059669;
  --danger: #DC2626;
  --warning: #D97706;
  --sidebar-width: 248px;
  --header-height: 60px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
  --font: 'Inter', -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--bg-base); color: var(--text-primary); font-family: var(--font); -webkit-font-smoothing: antialiased; line-height: 1.5; }
a { text-decoration: none; color: inherit; }

/* Shell */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-width); background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.content-area { flex: 1; overflow-y: auto; padding: 1.5rem; background: var(--bg-base); }

/* Sidebar */
.sidebar-logo { display: flex; align-items: center; gap: 0.65rem; padding: 1.25rem; border-bottom: 1px solid var(--border); }
.sidebar-logo-mark { width: 32px; height: 32px; background: var(--accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0; }
.sidebar-logo-text { font-size: 0.9rem; font-weight: 700; }
.sidebar-logo-sub { font-size: 0.65rem; color: var(--text-muted); }
.nav-section { padding: 1rem 0.75rem 0; }
.nav-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 0 0.5rem; margin-bottom: 0.35rem; }
.nav-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.12s; margin-bottom: 2px; text-decoration: none; }
.nav-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-item.active { color: var(--accent); background: var(--accent-subtle); font-weight: 600; }
.nav-icon { font-size: 1rem; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding: 0.75rem; border-top: 1px solid var(--border); }
.user-pill { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--border); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: #fff; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.68rem; color: var(--text-muted); }

/* Topbar */
.topbar { height: var(--header-height); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem; background: var(--bg-surface); flex-shrink: 0; }
.topbar-title { font-size: 1rem; font-weight: 700; }
.topbar-breadcrumb { font-size: 0.78rem; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
.topbar-back { flex-shrink: 0; margin-right: 0.25rem; border-right: 1px solid var(--border); padding-right: 0.75rem; }

/* Buttons */
button, .btn { cursor: pointer; font-family: var(--font); font-size: 0.875rem; font-weight: 500; border: none; border-radius: var(--radius-sm); padding: 0.6rem 1.25rem; transition: all 0.15s ease; display: inline-flex; align-items: center; gap: 0.4rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-surface); color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-elevated); }
.btn-danger { background: #FEF2F2; color: var(--danger); border: 1.5px solid #FCA5A5; }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-success { background: #ECFDF5; color: var(--success); border: 1.5px solid #6EE7B7; }
.btn-success:hover:not(:disabled) { background: var(--success); color: #fff; }
.btn-warning { background: #FFFBEB; color: var(--warning); border: 1.5px solid #FDE68A; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }

/* Cards */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg-elevated); }
.card-header h2, .card-header h3 { font-size: 0.9rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.25rem 1.5rem; box-shadow: var(--shadow-sm); cursor: pointer; transition: all 0.15s; position: relative; overflow: hidden; text-decoration: none; display: block; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--card-accent, var(--accent)); }
.stat-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.6rem; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; }
.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* Tables */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th { background: var(--bg-elevated); color: var(--text-muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
tbody td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }
.tr-link { cursor: pointer; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 100px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-available { background: #ECFDF5; color: #059669; border: 1px solid #6EE7B7; }
.badge-in-use { background: #EFF6FF; color: #2563EB; border: 1px solid #BFDBFE; }
.badge-maintenance { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.badge-retired { background: #F9FAFB; color: #6B7280; border: 1px solid #E5E7EB; }
.badge-pending { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.badge-approved { background: #EFF6FF; color: #2563EB; border: 1px solid #BFDBFE; }
.badge-ongoing { background: #EDE9FE; color: #7C3AED; border: 1px solid #DDD6FE; }
.badge-completed { background: #ECFDF5; color: #059669; border: 1px solid #6EE7B7; }
.badge-cancelled { background: #F9FAFB; color: #6B7280; border: 1px solid #E5E7EB; }
.badge-rejected { background: #FEF2F2; color: #DC2626; border: 1px solid #FCA5A5; }
.badge-active { background: #ECFDF5; color: #059669; border: 1px solid #6EE7B7; }
.badge-inactive { background: #F9FAFB; color: #6B7280; border: 1px solid #E5E7EB; }
.badge-suspended { background: #FEF2F2; color: #DC2626; border: 1px solid #FCA5A5; }
.badge-scheduled { background: #EFF6FF; color: #2563EB; border: 1px solid #BFDBFE; }
.badge-in-progress { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }

/* Forms */
input, select, textarea { background: var(--bg-surface); border: 1.5px solid var(--border); color: var(--text-primary); padding: 0.6rem 0.875rem; border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.875rem; outline: none; width: 100%; transition: border-color 0.15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,0.15); }
label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.35rem; }
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 0.5rem; }
.alert-error { background: #FEF2F2; border: 1px solid #FCA5A5; color: #DC2626; }
.alert-success { background: #ECFDF5; border: 1px solid #6EE7B7; color: #059669; }
.alert-warning { background: #FFFBEB; border: 1px solid #FDE68A; color: #D97706; }
.alert-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #2563EB; }

/* Auth */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#EFF6FF 0%,#F0FDF4 50%,#FFF7ED 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 2.5rem; box-shadow: 0 10px 25px rgba(0,0,0,0.08); }

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.text-right { text-align: right; }
.section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.75rem; }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 0.9rem; }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.loading-row td { text-align: center; padding: 2.5rem; color: var(--text-muted); }
.tab-nav { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn { background: none; border: none; padding: 0.65rem 1.25rem; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1.5px; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Detail info grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.info-item label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.25rem; }
.info-item .value { font-size: 0.9rem; font-weight: 500; }

/* Detail grid (used on detail pages) */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; padding: 1.25rem 1.5rem; }
.detail-item { padding: 0.65rem 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.2rem; }
.detail-item:last-child { border-bottom: none; }
.detail-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.detail-value { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }

/* Card title */
.card-title { font-size: 0.9rem; font-weight: 600; }

/* Form helpers */
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.35rem; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.3rem; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
