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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #fff;
}

/* ---- Nav ---- */

header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e5e5e5;
}

nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

nav .brand {
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    margin-right: auto;
}

nav a {
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
}

nav a:hover { color: #1a1a1a; }

nav button {
    font-size: 0.9rem;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 0;
}

nav button:hover { color: #1a1a1a; }

/* ---- Main ---- */

main {
    padding: 1.5rem 1.25rem 3rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ---- Registration form ---- */

.register-header {
    margin-bottom: 1.75rem;
}

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

.label-chip {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 2px 8px;
    margin: 0;
    letter-spacing: 0.04em;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    margin: 0 0 1rem;
}

.field {
    margin-bottom: 1.1rem;
}

.field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.field input[type="text"],
.field input[type="number"],
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.field select {
    display: block;
    width: 100%;
    font-size: 1rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

.field-check label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: normal;
}

.field-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 3px;
    cursor: pointer;
}

.field-error {
    display: block;
    font-size: 0.85rem;
    color: #c00;
    margin-top: 0.3rem;
}

.form-error {
    font-size: 0.9rem;
    color: #c00;
    background: #fff0f0;
    border: 1px solid #f5c6c6;
    border-radius: 4px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

.hint-inline {
    font-size: 0.8rem;
    color: #888;
    font-weight: normal;
}

/* ---- Mode toggle ---- */

.mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
}

.mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    border-right: 1px solid #ccc;
}

.mode-option:last-child { border-right: none; }

.mode-option input[type="radio"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ---- Notion page search ---- */

.search-results {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-top: 4px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 220px;
    overflow-y: auto;
}

.search-results li button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.85rem;
    background: none;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    min-height: 44px;
}

.search-results li:last-child button { border-bottom: none; }
.search-results li button:hover { background: #f7f7f7; }
.search-empty { padding: 0.65rem 0.85rem; color: #888; font-size: 0.9rem; }

.selected-page {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #1a7f4b;
    font-weight: 500;
}

/* ---- Log options ---- */

.log-options {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 6px;
}

/* ---- Form actions ---- */

.form-actions {
    padding-top: 0.5rem;
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 48px;
}

.btn-primary:active { background: #333; }
