* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: #f4f6f9; color: #1b1f27; }
a { color: var(--brand); }

.ajn-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #101522, #1c2740); padding: 20px; }
.ajn-login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.ajn-login-card h1 { font-size: 20px; text-align: center; margin: 0 0 4px; }
.ajn-login-card .subtle { text-align: center; color: #667085; font-size: 13.5px; margin-bottom: 22px; }
.ajn-login-logo { display: block; max-width: 160px; max-height: 64px; margin: 0 auto 16px; }
.ajn-sidebar-logo { display: block; max-width: 100%; max-height: 40px; margin-bottom: 8px; }

.ajn-field { margin-bottom: 14px; }
.ajn-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.ajn-field input, .ajn-field select, .ajn-field textarea { width: 100%; padding: 9px 11px; border: 1px solid #e2e6ec; border-radius: 8px; font-size: 14px; font-family: inherit; }
.ajn-field textarea { min-height: 70px; }

.ajn-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: none; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; }
.ajn-btn:hover { filter: brightness(0.92); }
.ajn-btn-secondary { background: #fff; color: #1b1f27; border: 1px solid #e2e6ec; }
.ajn-btn-sm { padding: 6px 12px; font-size: 13px; }
.ajn-btn-ghost { background: none; color: #667085; padding: 4px 8px; }

.ajn-error { background: #fdecea; color: #d0421e; padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; }

.ajn-shell { display: flex; min-height: 100vh; }
.ajn-sidebar { width: 220px; flex-shrink: 0; background: #14181f; color: #cfd4dd; padding: 20px 0; display: flex; flex-direction: column; }
.ajn-sidebar .brand { padding: 0 20px 16px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 12px; }
.ajn-sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.ajn-sidebar nav a { color: #cfd4dd; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.ajn-sidebar nav a:hover { background: rgba(255,255,255,0.06); }
.ajn-sidebar nav a.active { background: var(--brand); color: #fff; }
.ajn-sidebar .user { margin-top: auto; padding: 12px 20px 0; border-top: 1px solid rgba(255,255,255,0.08); font-size: 13px; }
.ajn-sidebar .user a { color: #cfd4dd; display: inline-block; margin-top: 6px; }

.ajn-main { flex: 1; min-width: 0; padding: 28px; }
.ajn-main h2 { margin-top: 0; }
.ajn-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.ajn-header h2 { margin: 0; }

.ajn-card { background: #fff; border: 1px solid #e2e6ec; border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.ajn-card-table { padding: 0; }
.ajn-card-table table { margin: 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 14px; border-bottom: 1px solid #e2e6ec; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: #667085; }
td { padding: 12px 14px; border-bottom: 1px solid #e2e6ec; font-size: 14px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
.ajn-subtle { color: #667085; }
.ajn-empty { padding: 30px; text-align: center; color: #667085; }

.ajn-filter-bar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.ajn-filter-bar select { padding: 8px 10px; border: 1px solid #e2e6ec; border-radius: 8px; }

.ajn-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ajn-badge-pending { background: #fff6df; color: #9a6700; }
.ajn-badge-scheduled { background: #eaf1fd; color: #164a9e; }
.ajn-badge-in_progress { background: #fde9d0; color: #a15c07; }
.ajn-badge-completed { background: #e7f7ef; color: #16794c; }
.ajn-badge-invoiced { background: #ece7fb; color: #5b3fb0; }
.ajn-badge-cancelled { background: #f1f2f5; color: #667085; }
.ajn-badge-draft { background: #f1f2f5; color: #667085; }
.ajn-badge-sent { background: #eaf1fd; color: #164a9e; }
.ajn-badge-accepted { background: #e7f7ef; color: #16794c; }
.ajn-badge-declined { background: #fdecea; color: #d0421e; }
.ajn-badge-expired { background: #f1f2f5; color: #667085; }
.ajn-badge-paid { background: #e7f7ef; color: #16794c; }
.ajn-badge-overdue { background: #fdecea; color: #d0421e; }
.ajn-priority-urgent { color: #d0421e; font-weight: 700; }
.ajn-priority-high { color: #a15c07; font-weight: 600; }

.ajn-modal-backdrop { position: fixed; inset: 0; background: rgba(15,18,25,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.ajn-modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
.ajn-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid #e2e6ec; }
.ajn-modal-header h3 { margin: 0; font-size: 16px; }
.ajn-modal-body { padding: 20px 22px; }
.ajn-modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid #e2e6ec; }
.ajn-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.ajn-log-entry { padding: 12px 0; border-bottom: 1px solid #e2e6ec; }
.ajn-log-entry:last-child { border-bottom: none; }
.ajn-log-meta { font-size: 12px; color: #667085; margin-top: 4px; }
.ajn-log-actions { margin-top: 6px; display: flex; gap: 6px; }
.ajn-log-edit-form { padding: 8px 0 4px; }
.ajn-log-edit-error { margin: 6px 0; }
.ajn-btn-danger { background: #dc3545; color: #fff; }

.ajn-line-items input { padding: 6px 8px; font-size: 13px; }

.ajn-sched-grid { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 900px; }
.ajn-sched-grid th { position: sticky; top: 0; background: #fff; z-index: 1; text-align: left; padding: 10px 8px; border-bottom: 1px solid #e2e6ec; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #667085; }
.ajn-sched-grid th.ajn-sched-today { color: var(--brand); }
.ajn-sched-grid td { border: 1px solid #e2e6ec; vertical-align: top; padding: 6px; }
.ajn-sched-cell { min-height: 64px; min-width: 130px; transition: background .1s; }
.ajn-sched-cell.ajn-sched-dragover { background: #eaf1fd; }
.ajn-sched-tray { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; padding: 6px; border-radius: 8px; }
.ajn-sched-tray.ajn-sched-dragover { outline: 2px dashed var(--brand); }
.ajn-sched-card { background: #fff; border: 1px solid #e2e6ec; border-left: 3px solid var(--brand); border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; font-size: 12.5px; cursor: grab; box-shadow: 0 1px 2px rgba(16,24,40,.05); width: 160px; }
.ajn-sched-card:active { cursor: grabbing; }
.ajn-sched-card a { color: #1b1f27; font-weight: 600; display: block; text-decoration: none; }
.ajn-sched-card a:hover { color: var(--brand); }
.ajn-sched-controls { display: flex; gap: 4px; margin-bottom: 3px; }
.ajn-sched-time, .ajn-sched-duration { width: auto; padding: 1px 4px; font-size: 11px; font-weight: 600; color: #164a9e; border: 1px solid transparent; border-radius: 4px; background: #eaf1fd; }
.ajn-sched-overlap { border-left-color: #d0421e; background: #fdecea; }
.ajn-sched-warning { display: block; font-size: 10.5px; font-weight: 700; color: #d0421e; margin-bottom: 2px; }

.ajn-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 820px; margin-bottom: 20px; }
.ajn-stat-card { background: #fff; border: 1px solid #e2e6ec; border-radius: 10px; padding: 18px 20px; }
.ajn-stat-label { font-size: 12.5px; color: #667085; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ajn-stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }

.ajn-stage { border: 1px solid #e2e6ec; border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: #f4f6f9; }
.ajn-stage-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ajn-stage-title-input { font-weight: 700; font-size: 14px; }
.ajn-stage-block { margin-bottom: 18px; }
.ajn-stage-block-title { font-weight: 700; font-size: 14px; color: #164a9e; padding: 8px 4px; border-bottom: 2px solid var(--brand); margin-bottom: 4px; }
