* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #333; background: #f5f7fa; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Nav */
.nav-header { display: flex; align-items: center; justify-content: space-between; background: #1e293b; color: #fff; padding: 0 20px; height: 56px; }
.nav-left { display: flex; align-items: center; gap: 20px; }
.nav-brand { font-weight: 700; font-size: 18px; white-space: nowrap; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab { padding: 8px 16px; color: #94a3b8; border-radius: 6px; font-size: 14px; }
.nav-tab:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,0.1); }
.nav-tab.active { color: #fff; background: #2563eb; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.user-profile { display: flex; align-items: center; gap: 8px; cursor: default; position: relative; }
.user-profile:hover .user-email-tooltip { opacity: 1; transform: translateY(0); pointer-events: auto; }
.user-name { font-size: 13px; color: #e2e8f0; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid #475569; }
.user-avatar-initials { width: 32px; height: 32px; border-radius: 50%; background: #2563eb; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 2px solid #475569; }
.user-email-tooltip { position: absolute; top: 100%; right: 0; margin-top: 8px; background: #1e293b; color: #94a3b8; padding: 6px 12px; border-radius: 6px; font-size: 12px; white-space: nowrap; opacity: 0; transform: translateY(-4px); pointer-events: none; transition: all 0.15s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.role-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; margin-left: 4px; vertical-align: middle; }
.role-badge.role-superAdmin { background: #7c3aed; color: #fff; }
.role-badge.role-admin { background: #2563eb; color: #fff; }
.role-badge.role-accountOwner { background: #059669; color: #fff; }
.role-badge.role-normal { background: #475569; color: #cbd5e1; }

/* Buttons */
.btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; color: #94a3b8; border: 1px solid #475569; }
.btn-outline:hover { color: #fff; border-color: #94a3b8; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 56px); }
.login-card { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); text-align: center; min-width: 360px; }
.login-card h1 { margin-bottom: 8px; }
.login-card p { color: #64748b; margin-bottom: 24px; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Tables */
.table-wrapper { overflow-x: auto; }
.data-table, .schedule-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.data-table th, .data-table td, .schedule-table th, .schedule-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.data-table th, .schedule-table th { background: #f8fafc; font-weight: 600; color: #475569; position: sticky; top: 0; }
.data-table tr:hover, .schedule-table tr:hover { background: #f8fafc; }

/* Schedule table */
.schedule-table .account-cell { min-width: 120px; font-weight: 500; }
.account-id { font-size: 13px; }
.account-region { font-size: 11px; color: #64748b; }
.account-displayname { font-size: 11px; color: #6366f1; font-style: italic; }
.schedule-cell { min-width: 100px; vertical-align: top; }
.schedule-item { padding: 3px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-bottom: 3px; display: inline-block; cursor: default; position: relative; }
.schedule-item:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1e293b; color: #e2e8f0; padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; white-space: nowrap; z-index: 10; pointer-events: none; margin-bottom: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.schedule-item.completed { opacity: 0.4; text-decoration: line-through; }
.scale-up { background: #dcfce7; color: #166534; }
.scale-down { background: #fee2e2; color: #991b1b; }
.legend { margin-top: 12px; display: flex; gap: 16px; font-size: 13px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.scale-up { background: #22c55e; }
.dot.scale-down { background: #ef4444; }

.schedule-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.schedule-period { font-weight: 600; font-size: 16px; }
#weekSelect { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; background: #fff; min-width: 240px; }
.th-today { background: #2563eb !important; color: #fff !important; }
.cell-today { background: #eff6ff !important; }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; }
.filters select { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 100; }
.modal-content { background: #fff; padding: 24px; border-radius: 12px; min-width: 400px; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-content h3 { margin-bottom: 16px; padding-right: 28px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 20px; line-height: 1; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: #475569; background: #f1f5f9; }
.modal-content label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-top: 12px; margin-bottom: 4px; }
.modal-content input, .modal-content select { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.btn-cancel { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.btn-cancel:hover { color: #334155; background: #f8fafc; border-color: #cbd5e1; }
.radio-group { display: flex; gap: 16px; margin-top: 4px; }
.radio-group label { display: flex; align-items: center; gap: 4px; font-weight: 400; }

/* Config */
.config-section { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.config-section h3 { margin-top: 24px; margin-bottom: 8px; }
.config-section label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-top: 12px; margin-bottom: 4px; }
.config-section input { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; }
.domain-input { display: flex; gap: 8px; margin-top: 8px; }
.domain-input input { flex: 1; }
.domain-tag { display: inline-block; background: #e0e7ff; color: #3730a3; padding: 4px 10px; border-radius: 20px; font-size: 13px; margin: 2px; }
.domain-tag button { background: none; border: none; cursor: pointer; margin-left: 4px; color: #6366f1; }

/* Records page */
.account-selector { margin-bottom: 20px; }
.account-selector label { display: block; font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.account-selector select { width: 100%; max-width: 400px; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; background: #fff; }

/* Tabs */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.tab-btn { padding: 10px 24px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; font-size: 14px; font-weight: 500; color: #64748b; }
.tab-btn:hover { color: #334155; }
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }
.tab-content { min-height: 300px; }

/* Calendar */
.calendar-nav { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e2e8f0; border-radius: 8px; overflow: hidden; border: 1px solid #e2e8f0; }
.cal-header { background: #f8fafc; padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 600; color: #64748b; }
.cal-cell { background: #fff; padding: 6px; min-height: 80px; position: relative; }
.cal-cell.empty { background: #f8fafc; }
.cal-cell.past { background: #f8fafc; opacity: 0.5; }
.cal-cell.beyond { background: #f8fafc; opacity: 0.5; }
.cal-cell.today { background: #eff6ff; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:hover { background: #f0f9ff; }
.cal-day-num { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.cal-tag { padding: 2px 4px; border-radius: 3px; font-size: 10px; font-weight: 600; margin-bottom: 2px; display: block; }
.cal-tag.scale-up { background: #dcfce7; color: #166534; }
.cal-tag.scale-down { background: #fee2e2; color: #991b1b; }

/* Day detail */
.day-schedule-list { display: flex; flex-direction: column; gap: 8px; }
.day-schedule-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f8fafc; border-radius: 6px; }
.day-schedule-comment { font-size: 12px; color: #64748b; margin-top: 4px; font-style: italic; }
.comment-cell { font-size: 12px; color: #6366f1; background: #eef2ff; padding: 2px 8px; border-radius: 4px; display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help; }
.page-desc { color: #64748b; font-size: 14px; margin-bottom: 20px; margin-top: -8px; }

/* Error page */
.error-page { text-align: center; padding: 60px 20px; }
.error-page h1 { font-size: 48px; color: #dc2626; }
.error-page p { font-size: 18px; color: #64748b; margin: 12px 0 24px; }

h2 { margin-bottom: 16px; }

/* Toast notifications */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,0.15); opacity: 0; transform: translateX(40px); transition: all 0.3s ease; pointer-events: auto; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: #166534; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }
.toast-info { background: #1e293b; color: #fff; }
.toast-icon { font-size: 16px; }

/* Infra type badges */
.infra-type-badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.infra-type-badge.type-eksNodeGroup { background: #dbeafe; color: #1e40af; }
.infra-type-badge.type-rdsInstance { background: #fef3c7; color: #92400e; }

/* Infrastructure cards */
.infra-list { display: flex; flex-direction: column; gap: 12px; }
.infra-group-header { font-size: 13px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 16px; margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; }
.infra-group-header:first-child { margin-top: 0; }
.infra-card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow: hidden; }
.infra-card-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.infra-card-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; color: #1e293b; }
.infra-card-actions { display: flex; gap: 6px; }
.infra-card-body { padding: 12px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.infra-detail { font-size: 12px; }
.infra-detail-label { color: #94a3b8; font-weight: 500; margin-bottom: 2px; }
.infra-detail-value { color: #334155; font-weight: 500; }

/* Scale config blocks */
.infra-config { display: flex; gap: 12px; margin-top: 8px; }
.infra-config-block { flex: 1; padding: 8px 12px; border-radius: 6px; font-size: 12px; }
.infra-config-block.scale-up { background: #f0fdf4; border: 1px solid #bbf7d0; }
.infra-config-block.scale-down { background: #fef2f2; border: 1px solid #fecaca; }
.infra-config-label { font-weight: 600; margin-bottom: 4px; }
.infra-config-block.scale-up .infra-config-label { color: #166534; }
.infra-config-block.scale-down .infra-config-label { color: #991b1b; }
.infra-config-values { color: #475569; line-height: 1.5; }
.infra-config-values span { display: inline-block; margin-right: 8px; }
.infra-config-key { color: #94a3b8; font-size: 11px; }

/* Infra empty state */
.infra-empty { text-align: center; padding: 48px 20px; color: #94a3b8; }
.infra-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.infra-empty-text { font-size: 14px; margin-bottom: 4px; }
.infra-empty-hint { font-size: 12px; color: #cbd5e1; }

/* Infra modal section */
.infra-modal-section { border: none; border-top: 1px solid #e2e8f0; margin: 16px 0 0; padding-top: 4px; }
.infra-modal-section-title { font-size: 12px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; margin: 12px 0 8px; }

/* Config hints */
.config-hint { font-size: 12px; color: #64748b; background: #f8fafc; padding: 8px; border-radius: 6px; margin-top: 4px; line-height: 1.5; }

/* Day checkboxes */
.day-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding: 8px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; }

/* Account checkboxes */
.account-checkboxes { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; max-height: 200px; overflow-y: auto; padding: 8px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; }
.no-accounts { color: #94a3b8; font-size: 13px; font-style: italic; }
.owned-cell { font-size: 12px; color: #475569; max-width: 300px; }

/* Spinner / Loading */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; margin-right: 6px; vertical-align: middle; }
.btn.is-loading { opacity: 0.8; cursor: wait; }
@keyframes spin { to { transform: rotate(360deg); } }
