*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}

a { color: #2563eb; }
a:hover { color: #1d4ed8; }

/* Auth */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 { margin: 0 0 1.5rem; font-size: 1.5rem; }

/* Page layout */
.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 { margin: 0; font-size: 1.5rem; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.subhead { color: #6b7280; font-size: .9rem; }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 2rem 0 .75rem;
}

.section-header h2 { margin: 0; font-size: 1.1rem; }

/* Buttons */
.button, button[type=submit] {
    display: inline-block;
    padding: .4rem 1rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.button:hover, button[type=submit]:hover { background: #1d4ed8; color: #fff; }
.button.secondary { background: #6b7280; }
.button.secondary:hover { background: #4b5563; }

/* Forms */
.field { margin-bottom: 1.25rem; }
.field label { display: block; margin-bottom: .3rem; font-size: .9rem; font-weight: 500; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    border-color: #2563eb;
}

.form-actions { display: flex; align-items: center; gap: 1.5rem; margin-top: 1.5rem; }

.required { color: #dc2626; }

/* Messages */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: .6rem .9rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

/* Detail list */
.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .4rem 1.5rem;
    margin: 0 0 1.5rem;
}

.detail-list dt { font-weight: 500; color: #6b7280; font-size: .9rem; padding-top: .1rem; }
.detail-list dd { margin: 0; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}

.data-table th {
    text-align: left;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    padding: .5rem .75rem;
    border-bottom: 2px solid #e5e7eb;
}

.data-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }

.row-actions { text-align: right; font-size: .875rem; }

/* Misc */
.empty-state { color: #9ca3af; font-style: italic; padding: 1rem 0; }

/* Type toggle (client form) */
.type-section { display: none; }
.type-section.visible { display: block; }

/* Home navigation */
.home-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 360px;
}

.home-nav a {
    display: block;
    padding: .75rem 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    color: #1a1a1a;
}

.home-nav a:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}
