:root {
    --am-bg: #f4f7f9;
    --am-surface: #ffffff;
    --am-surface-2: #eef4f6;
    --am-line: #d9e2e7;
    --am-text: #1c2930;
    --am-muted: #63717a;
    --am-blue: #2457a6;
    --am-green: #1f8a70;
    --am-amber: #c47b24;
    --am-danger: #b64b4b;
    --am-shadow: 0 14px 36px rgba(27, 42, 50, 0.12);
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    color: var(--am-text);
    background: var(--am-bg);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--am-blue);
}

a:hover,
a:focus {
    color: #153a75;
    text-decoration: none;
}

.am-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--am-line);
    box-shadow: 0 8px 24px rgba(25, 44, 53, 0.08);
}

.am-topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1440px;
    min-height: 72px;
    margin: 0 auto;
    padding: 0 28px;
}

.am-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    color: var(--am-text);
}

.am-brand:hover {
    color: var(--am-text);
}

.am-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 6px 18px rgba(25, 44, 53, 0.16);
}

.am-brand strong,
.am-brand small {
    display: block;
}

.am-brand small {
    color: var(--am-muted);
    font-size: 12px;
}

.am-primary-nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    gap: 4px;
    overflow-x: auto;
}

.am-nav-link,
.am-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    border-radius: 8px;
    color: var(--am-muted);
    font-weight: 600;
    white-space: nowrap;
}

.am-nav-link {
    padding: 8px 11px;
}

.am-nav-link.active,
.am-nav-link:hover {
    color: var(--am-blue);
    background: #e8eef8;
}

.am-login {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.am-login a,
.am-login button {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 11px;
    border: 0;
    border-radius: 8px;
    color: var(--am-muted);
    background: transparent;
    font-weight: 600;
}

.am-login a:hover,
.am-login button:hover {
    color: var(--am-green);
    background: #e5f4ef;
}

.am-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px;
}

.am-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.am-kicker {
    margin: 0 0 4px;
    color: var(--am-green);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.am-page-heading h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0;
}

.am-page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.am-chip {
    padding: 7px 10px;
    border: 1px solid var(--am-line);
    background: var(--am-surface);
}

.am-chip.active,
.am-chip:hover {
    color: var(--am-green);
    border-color: #9ed4c4;
    background: #e8f6f2;
}

.am-content {
    padding: 22px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: var(--am-surface);
    box-shadow: var(--am-shadow);
}

.am-login-page {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
    gap: 20px;
    max-width: 980px;
    margin: 8px auto 12px;
}

.am-login-panel {
    min-height: 420px;
    padding: 28px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
}

.am-login-intro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: #203842;
}

.am-login-logo {
    width: 128px;
    height: 128px;
    border-radius: 16px;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

.am-login-intro .am-kicker {
    color: #86dcc2;
}

.am-login-intro h2 {
    margin: 12px 0 8px;
    font-size: 32px;
    font-weight: 700;
}

.am-login-intro p {
    color: #d8e5e9;
}

.am-login-highlights {
    display: grid;
    gap: 9px;
}

.am-login-highlights span {
    color: #eef6f8;
    font-weight: 600;
}

.am-login-highlights i {
    color: #86dcc2;
    margin-right: 7px;
}

.am-login-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

.am-login-form-header h3 {
    margin: 0 0 4px;
    font-size: 28px;
    font-weight: 700;
}

.am-login-form-header p {
    margin: 0 0 24px;
    color: var(--am-muted);
}

.am-login-form label {
    color: var(--am-muted);
    font-weight: 700;
}

.am-login-form .form-control {
    height: 44px;
}

.am-login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    margin: 4px 0 18px;
    color: var(--am-muted);
}

.am-login-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.am-login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--am-blue);
    border-radius: 8px;
    color: #fff;
    background: var(--am-blue);
    font-weight: 700;
}

.am-login-submit:hover,
.am-login-submit:focus {
    background: #183d77;
    border-color: #183d77;
}

.am-footer {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 28px 28px;
    color: var(--am-muted);
}

.panel {
    border: 1px solid var(--am-line);
    border-radius: 8px;
    box-shadow: none;
}

.panel-primary > .panel-heading,
.panel-heading {
    color: var(--am-text);
    border-color: var(--am-line);
    background: var(--am-surface-2);
}

.panel-footer {
    border-color: var(--am-line);
    background: #fafcfd;
}

.label-primary {
    background: var(--am-blue);
}

.label-success {
    background: var(--am-green);
}

.am-button,
.btn,
input[type=submit] {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    color: var(--am-text);
    background: #fff;
    font-weight: 600;
    line-height: 1.4;
}

.am-button:hover,
.btn:hover,
input[type=submit]:hover {
    border-color: #aac0cc;
    background: var(--am-surface-2);
}

.am-button-primary,
.btn-primary {
    color: #fff;
    border-color: var(--am-blue);
    background: var(--am-blue);
}

.am-button-primary:hover,
.btn-primary:hover {
    color: #fff;
    border-color: #183d77;
    background: #183d77;
}

.btn-danger {
    color: #fff;
    border-color: var(--am-danger);
    background: var(--am-danger);
}

.form-control,
input,
select,
textarea {
    max-width: none;
    border: 1px solid #c9d6dc;
    border-radius: 8px;
    box-shadow: none;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--am-blue);
    box-shadow: 0 0 0 3px rgba(36, 87, 166, 0.14);
}

.form-horizontal .control-label {
    color: var(--am-muted);
    font-weight: 700;
}

.am-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--am-line);
    border-radius: 8px;
}

.am-data-table,
.table {
    width: 100%;
    margin-bottom: 0;
    background: #fff;
}

.am-data-table > thead > tr > th,
.am-data-table > tbody > tr > th,
.table > thead > tr > th,
.table > tbody > tr > th {
    color: var(--am-muted);
    background: #f7fafb;
    border-bottom: 1px solid var(--am-line);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.am-data-table > tbody > tr > td,
.table > tbody > tr > td {
    vertical-align: middle;
    border-top: 1px solid #edf2f4;
}

.am-data-table > tbody > tr:hover,
.table > tbody > tr:hover {
    background: #f7fbfa;
}

.am-data-table td:last-child,
.table td:last-child {
    white-space: nowrap;
}

.am-dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 18px;
    margin-bottom: 18px;
}

.am-hero-copy {
    padding: 22px;
    border-radius: 8px;
    color: #fff;
    background: #203842;
}

.am-hero-copy h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
}

.am-hero-copy p {
    max-width: 720px;
    margin: 0;
    color: #d7e4e8;
}

.am-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.am-stat {
    padding: 16px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
}

.am-stat span {
    display: block;
    color: var(--am-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.am-stat strong {
    display: block;
    margin-top: 6px;
    font-size: 30px;
    line-height: 1.1;
}

.am-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.am-module-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 12px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    color: var(--am-text);
    background: #fff;
    font-weight: 700;
}

.am-module-tile i {
    width: 28px;
    color: var(--am-green);
    text-align: center;
}

.am-module-tile:hover {
    border-color: #a7c2cf;
    background: #f7fbfb;
}

.am-contract-group {
    margin: 22px 0;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.am-contract-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    color: #fff;
    background: #203842;
}

.am-contract-group-heading h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.am-contract-group-heading span {
    color: #d8e5e9;
    font-weight: 700;
    white-space: nowrap;
}

.am-contract-department {
    padding: 16px;
    border-top: 1px solid var(--am-line);
}

.am-contract-department h4 {
    margin: 0 0 10px;
    color: var(--am-green);
    font-size: 15px;
    font-weight: 700;
}

.am-invoice-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.am-invoice-summary {
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.am-invoice-summary h3 {
    margin: 0;
    padding: 12px 14px;
    color: #fff;
    background: #203842;
    font-size: 16px;
    font-weight: 700;
}

.am-invoice-summary table {
    width: 100%;
}

.am-invoice-total-line,
.am-company-cost-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.am-company-cost-list {
    margin-top: 10px;
}

.am-company-cost-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
}

.am-pagination-summary {
    margin: 16px 0 10px;
    color: var(--am-muted);
    font-weight: 700;
}

.am-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.am-pagination a,
.am-pagination span {
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
    font-weight: 700;
}

/* Software project portfolio */
.am-toolbar,
.am-project-header,
.am-test-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.am-toolbar h2,
.am-project-header h2 {
    margin: 0;
}

.am-filter-form,
.am-form-actions,
.am-project-badges,
.am-link-list,
.am-evidence-upload {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.am-filter-form .form-control {
    width: auto;
    min-width: 150px;
}

.am-project-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.am-health,
.am-test-result {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.am-health-green { background: var(--am-green); }
.am-health-amber { background: var(--am-amber); }
.am-health-red { background: var(--am-danger); }

.am-progress {
    width: 110px;
    height: 8px;
    margin-bottom: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4eaed;
}

.am-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--am-blue);
}

.am-progress-large {
    width: 100%;
    height: 12px;
    margin-top: 18px;
}

.am-empty {
    padding: 28px !important;
    color: var(--am-muted);
    text-align: center;
}

.am-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.am-form-grid .form-group {
    margin: 0;
}

.am-form-grid label,
.am-compact-form label {
    color: var(--am-muted);
    font-weight: 700;
}

.am-form-span-2 { grid-column: span 2; }
.am-form-span-3 { grid-column: 1 / -1; }
.am-form-actions { margin-top: 18px; }

.am-project-header {
    align-items: flex-start;
}

.am-project-header p {
    max-width: 860px;
    margin: 10px 0 0;
    color: var(--am-muted);
}

.am-workspace-nav {
    position: sticky;
    top: 73px;
    z-index: 10;
    display: flex;
    gap: 4px;
    padding: 9px;
    overflow-x: auto;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
}

.am-workspace-nav a {
    padding: 7px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 700;
}

.am-workspace-nav a:hover { background: var(--am-surface-2); }

.am-workspace-section {
    padding-top: 28px;
    scroll-margin-top: 135px;
}

.am-workspace-section > h2 {
    margin: 0 0 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--am-line);
    font-size: 21px;
}

.am-section-intro { color: var(--am-muted); }

.am-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.am-detail-grid > div {
    padding: 12px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fafcfd;
}

.am-detail-grid span,
.am-detail-grid strong {
    display: block;
}

.am-detail-grid span {
    color: var(--am-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.am-detail-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.am-preline { white-space: pre-line; }

.am-add-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed #aabdc6;
    border-radius: 8px;
    background: #fafcfd;
}

.am-add-panel summary {
    color: var(--am-blue);
    cursor: pointer;
    font-weight: 700;
}

.am-add-panel[open] summary { margin-bottom: 14px; }

.am-compact-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: end;
    gap: 10px;
}

.am-compact-form textarea { min-height: 70px; }
.am-checkbox { display: inline-flex; align-items: center; gap: 7px; }
.am-checkbox input { margin: 0; }
.am-inline-form { display: inline; }

.am-link-button {
    padding: 0;
    border: 0;
    color: var(--am-danger);
    background: transparent;
    font: inherit;
}

.am-severity {
    display: inline-block;
    min-width: 30px;
    padding: 3px 7px;
    border-radius: 6px;
    color: #fff;
    background: var(--am-amber);
    text-align: center;
    font-weight: 700;
}

.am-test-card {
    margin: 14px 0;
    padding: 16px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
}

.am-test-heading { align-items: flex-start; }
.am-test-heading h3 { display: inline; margin: 0 0 0 8px; }
.am-test-heading > span { color: var(--am-muted); }
.am-test-result-passed { background: var(--am-green); }
.am-test-result-failed { background: var(--am-danger); }
.am-test-result-blocked { background: var(--am-amber); }
.am-test-result-notrun { background: var(--am-muted); }

.am-test-outcomes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.am-test-outcomes > div {
    padding: 12px;
    border-radius: 8px;
    background: var(--am-surface-2);
}

.am-evidence-list { display: grid; gap: 7px; }
.am-evidence-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--am-line); border-radius: 7px; }
.am-evidence-item small { flex: 1 1 auto; color: var(--am-muted); }
.am-evidence-upload { margin-top: 10px; }
.am-evidence-upload .form-control { flex: 1 1 220px; }
.am-test-delete { display: block; margin-top: 12px; text-align: right; }

.am-timeline article {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;
    padding-bottom: 20px;
}

.am-timeline-marker {
    width: 12px;
    height: 12px;
    margin-top: 5px;
    border-radius: 50%;
}

.am-timeline article h3 { margin: 0 0 10px; font-size: 16px; }

@media (max-width: 1050px) {
    .am-project-stats { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
    .am-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .am-project-stats,
    .am-form-grid,
    .am-detail-grid,
    .am-test-outcomes { grid-template-columns: 1fr; }
    .am-form-span-2,
    .am-form-span-3 { grid-column: auto; }
    .am-toolbar,
    .am-project-header,
    .am-test-heading { align-items: stretch; flex-direction: column; }
}

/* Asset assignment confirmation */
.am-assignment-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.am-assignment-header h2 { margin: 8px 0 2px; }
.am-assignment-header p { margin: 0; color: var(--am-muted); }

.am-confirmation-status {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.am-confirmation-status-pending { background: var(--am-amber); }
.am-confirmation-status-confirmed { background: var(--am-green); }
.am-confirmation-status-denied { background: var(--am-danger); }

.am-assignment-note {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: var(--am-surface-2);
}

.am-assignment-note h3 { margin: 0 0 6px; font-size: 16px; }
.am-assignment-note p { margin: 0; white-space: pre-line; }

.am-confirmation-page {
    max-width: 780px;
    margin: 10px auto;
}

.am-confirmation-card,
.am-confirmation-result {
    padding: 26px;
    border: 1px solid var(--am-line);
    border-radius: 10px;
    background: #fff;
}

.am-confirmation-card > h2 { margin: 4px 0 8px; }

.am-confirmation-asset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.am-confirmation-asset > div {
    padding: 13px;
    border-radius: 8px;
    background: var(--am-surface-2);
}

.am-confirmation-asset span,
.am-confirmation-asset strong { display: block; }
.am-confirmation-asset span { color: var(--am-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }

.am-confirmation-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.am-confirm-button,
.am-deny-button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
}

.am-confirm-button { background: var(--am-green); }
.am-deny-button { background: var(--am-danger); }

.am-confirmation-result { text-align: center; }
.am-confirmation-result i { font-size: 48px; }
.am-confirmation-result-success i { color: var(--am-green); }
.am-confirmation-result-error i { color: var(--am-danger); }

@media (max-width: 620px) {
    .am-assignment-header { align-items: stretch; flex-direction: column; }
    .am-confirmation-asset,
    .am-confirmation-actions { grid-template-columns: 1fr; }
}

/* Cellphone month-to-month comparison */
.am-comparison-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: var(--am-surface-2);
}

.am-comparison-filter label { display: block; color: var(--am-muted); font-weight: 700; }
.am-comparison-period { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; font-size: 16px; }
.am-comparison-period span { padding: 4px 8px; border-radius: 999px; background: #e8eef8; color: var(--am-blue); font-size: 12px; font-weight: 700; }

.am-increase-list { display: grid; gap: 10px; }
.am-increase-list article { padding: 14px; border: 1px solid #e5c1c1; border-radius: 8px; background: #fffafa; }
.am-increase-heading { display: flex; justify-content: space-between; gap: 12px; }
.am-increase-heading span { display: block; color: var(--am-muted); font-size: 12px; }
.am-increase-heading > strong { color: var(--am-danger); font-size: 18px; }
.am-increase-bar { height: 8px; margin: 10px 0 7px; overflow: hidden; border-radius: 999px; background: #f0dddd; }
.am-increase-bar span { display: block; height: 100%; border-radius: inherit; background: var(--am-danger); }
.am-increase-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--am-muted); font-size: 12px; }
.am-cost-increase-row { background: #fff8f8 !important; }

.am-project-company-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.am-project-company { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--am-line); border-radius: 999px; background: #fff; }
.am-project-company small { color: var(--am-green); font-weight: 700; }

@media (max-width: 1000px) {
    .am-comparison-filter { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 620px) {
    .am-comparison-filter { grid-template-columns: 1fr; }
}

/* Cellphone contract allocation history */
.am-contract-detail-heading,
.am-contract-history-title,
.am-contract-history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.am-contract-detail-heading {
    align-items: flex-start;
    margin-bottom: 20px;
}

.am-contract-detail-heading h2,
.am-contract-detail-heading p,
.am-contract-history-title h2,
.am-contract-history-title p {
    margin-top: 0;
}

.am-contract-detail-heading > div:last-child {
    display: flex;
    gap: 8px;
}

.am-contract-history {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--am-line);
}

.am-contract-history-title > span {
    color: var(--am-muted);
    font-weight: 700;
}

.am-contract-history-list {
    position: relative;
    margin-top: 18px;
}

.am-contract-history-list::before {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 7px;
    width: 2px;
    background: var(--am-line);
    content: "";
}

.am-contract-history-item {
    position: relative;
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.am-contract-history-marker {
    z-index: 1;
    width: 16px;
    height: 16px;
    margin-top: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--am-green);
    box-shadow: 0 0 0 1px var(--am-green);
}

.am-contract-history-card {
    padding: 16px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
}

.am-contract-history-meta strong,
.am-contract-history-meta span {
    display: block;
}

.am-contract-history-meta > span,
.am-contract-history-meta div span {
    color: var(--am-muted);
    font-size: 12px;
}

.am-contract-changes {
    margin: 10px 0;
    color: var(--am-blue);
    font-weight: 700;
}

.am-contract-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}

.am-contract-snapshot-grid > div {
    padding: 10px;
    border-radius: 7px;
    background: var(--am-surface-2);
}

.am-contract-snapshot-grid span,
.am-contract-snapshot-grid strong,
.am-contract-snapshot-grid small {
    display: block;
}

.am-contract-snapshot-grid span {
    color: var(--am-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.am-contract-snapshot-grid small {
    margin-top: 2px;
    color: var(--am-muted);
}

.am-contract-history-comments {
    margin: 10px 0 0;
}

@media (max-width: 900px) {
    .am-contract-snapshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .am-contract-detail-heading,
    .am-contract-history-title,
    .am-contract-history-meta { align-items: stretch; flex-direction: column; }
    .am-contract-snapshot-grid { grid-template-columns: 1fr; }
}

/* Employee lifecycle */
.am-employee-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.am-employee-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    color: var(--am-text);
    background: #fff;
}

.am-employee-filter span { color: var(--am-muted); font-weight: 700; }
.am-employee-filter strong { font-size: 26px; }
.am-employee-filter.active { border-color: #93cbbb; background: #edf8f4; }
.am-employee-filter.departed { border-color: #d5aaaa; background: #fbf1f1; }

.am-employment-status {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.am-employment-status-active { background: var(--am-green); }
.am-employment-status-departed { background: var(--am-danger); }
.am-former-employee-row { background: #fcf7f7; }

.am-employee-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.am-employee-detail-header h2 { margin: 8px 0 2px; }
.am-employee-detail-header p { margin: 0; color: var(--am-muted); }

.am-departure-banner {
    display: grid;
    grid-template-columns: .7fr 1fr 2fr;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #dfb7b7;
    border-radius: 8px;
    background: #fff5f5;
}

.am-departure-banner span,
.am-departure-banner strong { display: block; }
.am-departure-banner span { color: var(--am-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }

.am-departure-intro {
    margin-bottom: 18px;
    padding: 18px;
    border-radius: 8px;
    color: #fff;
    background: #203842;
}

.am-departure-intro h2 { margin: 0 0 5px; }
.am-departure-intro p { margin: 0; color: #d8e5e9; }

.am-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding: 16px;
    border: 1px solid #e1b9b9;
    border-radius: 8px;
    background: #fff8f8;
}

.am-danger-zone p { margin: 3px 0 0; color: var(--am-muted); }

@media (max-width: 720px) {
    .am-employee-summary,
    .am-departure-banner { grid-template-columns: 1fr; }
    .am-employee-detail-header,
    .am-danger-zone { align-items: stretch; flex-direction: column; }
}

.am-pagination span {
    color: var(--am-muted);
}

.am-pagination a:hover {
    border-color: var(--am-blue);
    background: #e8eef8;
}

.am-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.am-chart {
    min-height: 330px;
    padding: 12px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: #fff;
}

.text-danger {
    color: var(--am-danger);
}

@media (max-width: 980px) {
    .am-topbar-inner,
    .am-page-heading,
    .am-dashboard-hero {
        display: block;
    }

    .am-primary-nav,
    .am-page-actions,
    .am-login {
        margin-top: 12px;
    }

    .am-page-actions {
        justify-content: flex-start;
    }

    .am-chart-grid,
    .am-stat-grid,
    .am-login-page {
        grid-template-columns: 1fr;
    }

    .am-login-panel {
        min-height: auto;
    }
}

@media (max-width: 640px) {
    .am-shell {
        padding: 16px;
    }

    .am-content {
        padding: 14px;
    }

    .am-page-heading h1 {
        font-size: 24px;
    }

    .am-topbar-inner {
        padding: 14px 16px;
    }
}
