:root {
    --brand-blue: #04026F;
    --text: #323F4B;
    --muted: #7B8794;
    --border: #CBD2D9;
    --surface: #F5F7FA;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background-color: #ffffff;
    color: var(--text);
    font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--brand-blue);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.6em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

a {
    color: var(--brand-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
}

.site-header .logo {
    display: inline-block;
    line-height: 0;
}

.site-header .logo img {
    height: 36px;
    width: auto;
    display: block;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

.button,
button[type="submit"] {
    background-color: var(--brand-blue);
    color: #ffffff;
    border: 1px solid var(--brand-blue);
    border-radius: 100px;
    padding: 14px 30px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    text-transform: lowercase;
    text-align: center;
    cursor: pointer;
    display: inline-block;
    transition: background-color .2s ease, color .2s ease;
}

.button:hover,
button[type="submit"]:hover {
    background-color: #ffffff;
    color: var(--brand-blue);
    text-decoration: none;
}

.button.secondary {
    background-color: #ffffff;
    color: var(--brand-blue);
}

.button.secondary:hover {
    background-color: var(--brand-blue);
    color: #ffffff;
}

.button.danger {
    background-color: #ffffff;
    color: #ef4444;
    border-color: #ef4444;
}

.button.danger:hover {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.button.small {
    padding: 8px 18px;
    font-size: 13px;
}

.button.icon-only {
    padding: 14px;
    line-height: 0;
}

.button.icon-only svg {
    display: block;
    width: 16px;
    height: 16px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
select {
    width: 100%;
    height: 50px;
    border: 1px solid var(--border);
    border-radius: 100px;
    background-color: #ffffff;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 300;
    padding: 0 30px;
    box-sizing: border-box;
}

textarea {
    width: 100%;
    min-height: 175px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background-color: #ffffff;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 300;
    padding: 24px 30px;
    box-sizing: border-box;
    line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--brand-blue);
    outline-offset: 2px;
}

form > div {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--surface);
    vertical-align: middle;
}

th {
    background-color: var(--surface);
    color: var(--brand-blue);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td .button.small + .button.small,
td .button.small + form,
td form + .button.small {
    margin-left: 6px;
}

td form {
    display: inline;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0;
}

.filter-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-form input[type="search"],
.filter-form select {
    width: auto;
    flex: 0 1 auto;
    padding: 0 20px;
}

.filter-form input[type="search"] {
    width: 200px;
}

.filter-form select {
    width: 220px;
}

.login-form {
    max-width: 420px;
    margin: 64px auto 0;
}

.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 20px;
    font-weight: 500;
}

.dashboard-section {
    margin-top: 40px;
}

.stat-card {
    display: inline-flex;
    flex-direction: column;
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 32px;
    min-width: 220px;
}

.stat-value {
    color: var(--brand-blue);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    color: var(--muted);
    font-weight: 500;
    margin-top: 4px;
}

.chart {
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
}

.chart-row {
    display: grid;
    grid-template-columns: 140px 1fr 48px;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.chart-row:last-child {
    margin-bottom: 0;
}

.chart-label {
    color: var(--text);
    font-weight: 500;
}

.chart-track {
    height: 18px;
    background-color: var(--surface);
    border-radius: 9999px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 9999px;
    min-width: 2px;
}

.chart-count {
    text-align: right;
    font-weight: 500;
    color: var(--brand-blue);
}

.timeline-section {
    margin-top: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.section-header h1,
.section-header h2 {
    margin: 0;
}

.section-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.section-actions form {
    display: inline;
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 7px;
    width: 2px;
    background-color: var(--surface);
}

.timeline-entry {
    position: relative;
    padding-left: 32px;
    margin-bottom: 16px;
}

.timeline-entry:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--border);
}

.timeline-body {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 12px 16px;
}

.timeline-headline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.timeline-from-to {
    color: var(--text);
}

.timeline-from-to strong {
    color: var(--brand-blue);
    font-weight: 700;
}

.timeline-headline time {
    color: var(--muted);
    font-size: 13px;
}

.timeline-meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.notes {
    margin-top: 32px;
}

.notes-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.notes-list {
    flex: 1;
    min-width: 0;
}

.notes-form {
    flex: 0 0 360px;
}

@media (max-width: 720px) {
    .notes-layout {
        flex-direction: column;
    }

    .notes-form {
        flex-basis: auto;
        width: 100%;
    }
}

.note {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.note-header strong {
    color: var(--brand-blue);
    font-weight: 500;
}

.note-content {
    margin: 0;
    white-space: pre-line;
}

.info-banner {
    background-color: #ecfeff;
    border-left: 4px solid #0ea5e9;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    color: #0c4a6e;
}

.info-banner a {
    color: var(--brand-blue);
    font-weight: 500;
}

.chain-timeline {
    margin-top: 32px;
}

.chain-timeline-intro {
    color: var(--text-muted, #6b7280);
    margin-bottom: 16px;
}

.chain-segment {
    margin-bottom: 24px;
}

.chain-segment-header h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 500;
}

.chain-segment-tag {
    color: var(--text-muted, #6b7280);
    font-weight: 400;
    font-size: 0.875rem;
}

.chain-segment-current .chain-segment-header h3 {
    color: var(--brand-blue);
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-nav a {
    color: var(--brand-blue);
    font-weight: 500;
    text-decoration: none;
}

.site-nav a:hover {
    text-decoration: underline;
}
