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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    font-size: 15px;
    line-height: 1.6;
}

/* NAV */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { color: white; text-decoration: none; font-size: 1.1rem; font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-link { color: #ecf0f1; text-decoration: none; font-size: 0.9rem; }
.nav-link:hover { color: white; }
.nav-user { color: #bdc3c7; font-size: 0.85rem; }
.search-form { display: flex; gap: 0.3rem; }
.search-input { padding: 0.3rem 0.6rem; border-radius: 4px; border: none; font-size: 0.85rem; width: 180px; }

/* CONTAINER */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ALERTS */
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #d4edda; color: #155724; }
.alert-danger  { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info    { background: #d1ecf1; color: #0c5460; }

/* BUTTONS */
.btn {
    display: inline-block; padding: 0.45rem 1rem; border-radius: 5px;
    border: 1px solid #ccc; background: white; color: #2d3436;
    cursor: pointer; font-size: 0.9rem; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #2c3e50; color: white; border-color: #2c3e50; }
.btn-primary:hover { background: #1a252f; }
.btn-danger { background: #e74c3c; color: white; border-color: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-block { width: 100%; text-align: center; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header h2 { flex: 1; font-size: 1.4rem; }
.entry-actions { display: flex; gap: 0.5rem; }

/* DASHBOARD GRID */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.section-card {
    background: white; border-radius: 10px; padding: 1.2rem 1rem;
    text-decoration: none; color: #2d3436;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.15s, transform 0.15s;
    display: block;
}
.section-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.section-icon { font-size: 2rem; margin-bottom: 0.4rem; }
.section-name { font-weight: 600; font-size: 1rem; }
.section-desc { font-size: 0.8rem; color: #636e72; margin-top: 0.25rem; }

/* EXPIRY BANNER */
.expiry-banner {
    background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px;
    padding: 1rem; margin-bottom: 1.5rem;
}
.expiry-banner h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.expiry-banner ul { padding-left: 1.2rem; }
.expiry-banner li { margin-bottom: 0.25rem; font-size: 0.9rem; }
.expiry-date { color: #e67e22; font-size: 0.85rem; font-weight: 500; }
.badge {
    background: #dfe6e9; border-radius: 4px; padding: 0.1rem 0.4rem;
    font-size: 0.75rem; margin: 0 0.3rem;
}

/* ENTRY LIST */
.entry-list { display: flex; flex-direction: column; gap: 0.75rem; }
.entry-card {
    background: white; border-radius: 8px; padding: 1rem 1.2rem;
    text-decoration: none; color: #2d3436;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.15s;
    display: block;
}
.entry-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.entry-title { font-weight: 600; font-size: 1rem; }
.entry-summary { font-size: 0.9rem; color: #636e72; margin-top: 0.2rem; }
.entry-meta { font-size: 0.8rem; color: #b2bec3; margin-top: 0.3rem; }
.entry-summary-large { font-size: 1rem; color: #636e72; margin-bottom: 1rem; }

/* FIELDS TABLE */
.fields-table { background: white; border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; border: 1px solid #e0e0e0; }
.fields-table h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.fields-table table { width: 100%; border-collapse: collapse; }
.fields-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.field-label { color: #636e72; width: 35%; font-weight: 500; }
.field-val { color: #2d3436; }

/* NOTES */
.notes-block { background: white; border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; border: 1px solid #e0e0e0; }
.notes-block h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.notes-block pre { white-space: pre-wrap; font-family: inherit; font-size: 0.9rem; color: #2d3436; }

/* ATTACHMENTS */
.attachments-block { background: white; border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; border: 1px solid #e0e0e0; }
.attachments-block h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.attachments-block ul { padding-left: 1.2rem; }
.attachments-block li { margin-bottom: 0.35rem; }
.attachments-block a { color: #2980b9; text-decoration: none; }
.attachments-block a:hover { text-decoration: underline; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; color: #636e72; }
.form-control {
    width: 100%; padding: 0.5rem 0.75rem;
    border: 1px solid #dfe6e9; border-radius: 5px;
    font-size: 0.9rem; font-family: inherit;
    background: white; color: #2d3436;
}
.form-control:focus { outline: none; border-color: #2c3e50; }
.form-control-sm { padding: 0.3rem 0.5rem; font-size: 0.8rem; width: auto; }
textarea.form-control { resize: vertical; }
.field-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.field-row .field-name { flex: 0 0 35%; }
.field-row .field-value { flex: 1; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.entry-form hr { margin: 1.5rem 0; border: none; border-top: 1px solid #f0f0f0; }
.entry-form h3 { font-size: 0.95rem; margin-bottom: 0.75rem; color: #2d3436; }

/* ADMIN */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-panel { background: white; border-radius: 8px; padding: 1.2rem; border: 1px solid #e0e0e0; }
.admin-panel h3 { font-size: 1rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid #f0f0f0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 1rem; }
.admin-table th { text-align: left; padding: 0.4rem 0.5rem; color: #636e72; border-bottom: 1px solid #e0e0e0; }
.admin-table td { padding: 0.5rem; border-bottom: 1px solid #f5f6fa; vertical-align: top; }
.add-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; }
.permissions-form { font-size: 0.8rem; padding: 0.5rem 0; }
.perm-group { display: inline-flex; align-items: center; gap: 0.3rem; margin-right: 0.75rem; margin-bottom: 0.3rem; }
.perm-group label { display: flex; align-items: center; gap: 0.2rem; font-weight: normal; }

/* LOGIN PAGE */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #2c3e50; }
.login-box { background: white; border-radius: 12px; padding: 2.5rem 2rem; width: 100%; max-width: 380px; }
.login-box h1 { text-align: center; font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-subtitle { text-align: center; color: #636e72; font-size: 0.9rem; margin-bottom: 1.5rem; }

/* MISC */
.back-link { margin-top: 1.5rem; font-size: 0.9rem; }
.back-link a { color: #636e72; text-decoration: none; }
.back-link a:hover { color: #2d3436; }
.empty-state { text-align: center; padding: 3rem 1rem; color: #636e72; }
.empty-state h2 { margin-bottom: 1rem; }
.text-muted { color: #b2bec3; font-weight: normal; font-size: 0.85rem; }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }
