/* Typography & Base Elements */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-background);
    line-height: 1.6;
}

h1 { font-size: var(--font-size-3xl); font-weight: 700; line-height: 1.2; }
h2 { font-size: var(--font-size-2xl); font-weight: 600; line-height: 1.3; }
h3 { font-size: var(--font-size-xl); font-weight: 600; line-height: 1.4; }
h4 { font-size: var(--font-size-lg); font-weight: 600; line-height: 1.4; }

a {
    color: var(--color-brand);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-brand-hover);
}

a:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Forms */
label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-1);
    font-size: var(--font-size-sm);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: var(--font-size-base);
    line-height: 1.5;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(49, 93, 70, 0.15);
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: var(--color-background);
    color: var(--color-muted);
    cursor: not-allowed;
}

textarea {
    min-height: 5rem;
    resize: vertical;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23687069' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-8);
}

/* Tables */
table {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
}

thead {
    background: var(--color-background);
}

th {
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-muted);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: rgba(49, 93, 70, 0.03);
}

/* Small text */
small, .text-small {
    font-size: var(--font-size-sm);
}

.text-muted {
    color: var(--color-muted);
}

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

.text-success {
    color: var(--color-success);
}

.text-warning {
    color: var(--color-warning);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-mono {
    font-family: var(--font-mono);
}

/* Visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
