.pagination {
	float: right;
}

.pagination a {
	color: black;
	float: left;
	padding: 8px 16px;
 	text-decoration: none;
	transition: background-color .3s;
	border: 1px solid #ddd;
	margin: 0 4px;
}


.pagination a.active {
	background-color: #4CAF50;
	color: white;
	border: 1px solid #4CAF50;
}

.pagination a:hover:not(.active) {
	background-color: #ddd;
}

:root {
            --teal-deep: #0d7377;
            --teal-mid: #14919b;
            --teal-light: #45b5aa;
            --teal-pale: #b8e6e0;
            --teal-ghost: #e8f6f4;
            --sand: #d4a76a;
            --bg-main: #f7f9fa;
            --bg-card: #ffffff;
            --text-primary: #1a2a2a;
            --text-secondary: #5a7070;
            --text-muted: #8fa5a5;
            --border: #d4e4e2;
            --shadow-sm: 0 2px 8px rgba(13,115,119,0.06);
            --shadow-md: 0 4px 20px rgba(13,115,119,0.1);
            --shadow-lg: 0 8px 40px rgba(13,115,119,0.14);
            --radius-sm: 8px;
            --radius-md: 14px;
            --radius-lg: 22px;
            --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        html { scroll-behavior: smooth; }
        body {
            font-family: 'Outfit', sans-serif;
            background: var(--bg-main);
            color: var(--text-primary);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            overflow-x: hidden;
        }
        body::before {
            content: ''; position: fixed; top: -200px; right: -200px;
            width: 600px; height: 600px; border-radius: 50%;
            background: radial-gradient(circle, rgba(20,145,155,0.06) 0%, transparent 70%);
            pointer-events: none; z-index: 0;
        }
        body::after {
            content: ''; position: fixed; bottom: -150px; left: -150px;
            width: 500px; height: 500px; border-radius: 50%;
            background: radial-gradient(circle, rgba(212,167,106,0.06) 0%, transparent 70%);
            pointer-events: none; z-index: 0;
        }

        .navbar {
            position: sticky; top: 0; z-index: 100;
            background: rgba(255,255,255,0.85); backdrop-filter: blur(18px);
            border-bottom: 1px solid rgba(212,228,226,0.5); padding: 0 2rem;
        }
        .navbar-inner {
            max-width: 1100px; margin: 0 auto;
            display: flex; align-items: center; justify-content: space-between; height: 68px;
        }
        .navbar-brand {
            display: flex; align-items: center; gap: 10px;
            text-decoration: none; color: var(--teal-deep);
            font-weight: 700; font-size: 1.3rem; letter-spacing: -0.5px;
        }
        .navbar-brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
        .nav-links { display: flex; gap: 4px; }
        .nav-link {
            display: flex; align-items: center; gap: 7px;
            padding: 9px 18px; border-radius: var(--radius-md);
            text-decoration: none; color: var(--text-secondary);
            font-weight: 500; font-size: 0.92rem;
            transition: var(--transition); cursor: pointer; border: none; background: none;
        }
        .nav-link:hover { background: var(--teal-ghost); color: var(--teal-deep); }
        .nav-link.active { background: var(--teal-deep); color: #fff; box-shadow: 0 2px 12px rgba(13,115,119,0.25); }
        .nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
        .hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
        .hamburger svg { width: 26px; height: 26px; color: var(--teal-deep); }
        @media (max-width: 640px) {
            .hamburger { display: block; }
            .nav-links {
                display: none; position: absolute; top: 68px; left: 0; right: 0;
                background: rgba(255,255,255,0.97); backdrop-filter: blur(18px);
                flex-direction: column; padding: 12px 16px;
                border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
            }
            .nav-links.open { display: flex; }
        }

        .page { display: none; flex: 1; position: relative; z-index: 1; animation: fadeIn 0.4s ease; }
        .page.active { display: flex; flex-direction: column; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

        .home-page {
            flex: 1; display: flex; flex-direction: column;
            align-items: center; justify-content: center;
            padding: 2rem; gap: 2rem; min-height: calc(100vh - 68px);
        }
        .home-logo-container { position: relative; }
        .home-logo-container::before {
            content: ''; position: absolute; inset: -20px; border-radius: 50%;
            background: radial-gradient(circle, var(--teal-ghost) 0%, transparent 70%);
            animation: logoPulse 4s ease-in-out infinite;
        }
        @keyframes logoPulse { 0%,100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.08); opacity: 1; } }
        .home-logo {
            width: 200px; height: 200px; border-radius: 50%; object-fit: cover;
            position: relative; z-index: 1; box-shadow: var(--shadow-lg);
            border: 4px solid rgba(255,255,255,0.8);
        }
        .home-tagline { font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--teal-deep); text-align: center; font-weight: 600; }
        .home-subtitle { color: var(--text-muted); font-size: 1rem; text-align: center; max-width: 400px; line-height: 1.6; }

        .clock-container {
            position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
            display: flex; justify-content: center; padding: 16px; pointer-events: none;
        }
        .clock-widget {
            pointer-events: auto; background: rgba(255,255,255,0.9); backdrop-filter: blur(14px);
            border: 1px solid rgba(212,228,226,0.6); border-radius: var(--radius-lg);
            padding: 14px 28px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-md);
        }
        .clock-face { position: relative; width: 52px; height: 52px; }
        .clock-face svg { width: 52px; height: 52px; }
        .clock-digital { display: flex; flex-direction: column; gap: 2px; }
        .clock-time { font-size: 1.5rem; font-weight: 700; color: var(--teal-deep); letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
        .clock-time .seconds { font-size: 0.85rem; font-weight: 400; color: var(--teal-mid); }
        .clock-date { font-size: 0.78rem; color: var(--text-muted); }
        .clock-label { font-size: 0.65rem; color: var(--sand); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; }

        .config-page { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem 120px; width: 100%; }
        .config-page h1 { font-family: 'Playfair Display', serif; font-size: 1.8rem; color: var(--teal-deep); margin-bottom: 0.5rem; }
        .config-page .subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.92rem; }

        .sheet-status {
            display: flex; align-items: center; gap: 8px;
            padding: 10px 16px; border-radius: var(--radius-sm);
            margin-bottom: 1.5rem; font-size: 0.85rem; font-weight: 500;
        }
        .sheet-status.loading { background: #fef9e7; color: #92730c; }
        .sheet-status.connected { background: #e8f6f4; color: var(--teal-deep); }
        .sheet-status.error { background: #fde8e8; color: #c0392b; }
        .sheet-status-dot { width: 8px; height: 8px; border-radius: 50%; }
        .sheet-status.loading .sheet-status-dot { background: #f1c40f; animation: blink 1s infinite; }
        .sheet-status.connected .sheet-status-dot { background: #27ae60; }
        .sheet-status.error .sheet-status-dot { background: #e74c3c; }
        @keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }

        .card {
            background: var(--bg-card); border-radius: var(--radius-md);
            border: 1px solid var(--border); box-shadow: var(--shadow-sm);
            padding: 1.5rem; margin-bottom: 1.5rem;
        }
        .card-title {
            font-size: 1rem; font-weight: 600; color: var(--teal-deep);
            margin-bottom: 1rem; display: flex; align-items: center; gap: 8px;
        }
        .card-title svg { width: 20px; height: 20px; }

        .recipients-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
        @media (max-width: 700px) { .recipients-grid { grid-template-columns: 1fr; } }

        .recipient-card {
            background: var(--bg-card); border-radius: var(--radius-md);
            border: 2px solid var(--border); padding: 1.4rem;
            transition: var(--transition); min-height: 180px;
        }
        .recipient-card.filled { border-color: var(--teal-light); background: linear-gradient(135deg, #fff 0%, var(--teal-ghost) 100%); }
        .recipient-card.filled .recipient-number { background: var(--teal-deep); color: #fff; }

        .recipient-body { display: flex; gap: 14px; align-items: flex-start; }
        .recipient-img-wrap {
            width: 90px; height: 90px; border-radius: var(--radius-sm);
            overflow: hidden; flex-shrink: 0; background: var(--teal-ghost);
            display: flex; align-items: center; justify-content: center;
            border: 1px solid var(--border);
        }
        .recipient-img-wrap img {
            width: 100%; height: 100%; object-fit: cover;
        }
        .recipient-img-wrap .img-placeholder {
            color: var(--teal-pale); display: flex; align-items: center; justify-content: center;
        }
        .recipient-img-wrap .img-placeholder svg { width: 36px; height: 36px; }
        .recipient-details { flex: 1; min-width: 0; }

        .recipient-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
        .recipient-number {
            width: 36px; height: 36px; border-radius: 50%;
            background: var(--teal-ghost); color: var(--teal-deep);
            display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 1rem; transition: var(--transition); flex-shrink: 0;
        }
        .recipient-label { font-weight: 600; color: var(--text-primary); font-size: 0.95rem; }
        .recipient-clear {
            margin-left: auto; background: none; border: none; cursor: pointer;
            color: var(--text-muted); padding: 4px; border-radius: 4px;
            transition: var(--transition); display: none;
        }
        .recipient-card.filled .recipient-clear { display: block; }
        .recipient-clear:hover { color: #c0392b; background: #fde8e8; }
        .recipient-clear svg { width: 16px; height: 16px; }

        .recipient-field { margin-bottom: 0.8rem; }
        .recipient-field label {
            display: block; font-size: 0.75rem; font-weight: 600;
            color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
        }
        .recipient-field select, .recipient-field input {
            width: 100%; padding: 8px 10px;
            border: 1.5px solid var(--border); border-radius: var(--radius-sm);
            font-family: 'Outfit', sans-serif; font-size: 0.85rem;
            color: var(--text-primary); background: #fff;
            transition: var(--transition); outline: none;
        }
        .recipient-field select:focus, .recipient-field input:focus {
            border-color: var(--teal-mid); box-shadow: 0 0 0 3px rgba(20,145,155,0.1);
        }

        .recipient-summary {
            padding: 10px; background: var(--teal-ghost);
            border-radius: var(--radius-sm); font-size: 0.82rem;
            color: var(--teal-deep); line-height: 1.5;
        }

        .btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 10px 20px; border-radius: var(--radius-sm);
            font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.88rem;
            border: none; cursor: pointer; transition: var(--transition);
        }
        .btn svg { width: 18px; height: 18px; }
        .btn-primary { background: var(--teal-deep); color: #fff; box-shadow: 0 2px 10px rgba(13,115,119,0.2); }
        .btn-primary:hover { background: var(--teal-mid); transform: translateY(-1px); }
        .btn-secondary { background: var(--teal-ghost); color: var(--teal-deep); }
        .btn-secondary:hover { background: var(--teal-pale); }
        .btn-sm { padding: 6px 12px; font-size: 0.8rem; }
        .btn-danger { background: #fde8e8; color: #c0392b; }
        .btn-danger:hover { background: #f8c9c9; }
        .btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1rem; }

        .form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 1rem; }
        .form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
        .form-input, .form-select {
            padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
            font-family: 'Outfit', sans-serif; font-size: 0.88rem;
            color: var(--text-primary); background: #fff; transition: var(--transition); outline: none;
        }
        .form-input:focus, .form-select:focus { border-color: var(--teal-mid); box-shadow: 0 0 0 3px rgba(20,145,155,0.1); }
        .add-med-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; }
        @media (max-width: 640px) { .add-med-form { grid-template-columns: 1fr; } }

        .history-page { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem 120px; width: 100%; }
        .history-page h1 { font-family: 'Playfair Display', serif; font-size: 1.8rem; color: var(--teal-deep); margin-bottom: 0.5rem; }
        .history-page .subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.92rem; }
        .history-empty { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
        .history-empty svg { width: 64px; height: 64px; color: var(--teal-pale); margin-bottom: 1rem; }

        .history-entry {
            background: var(--bg-card); border-radius: var(--radius-md);
            border: 1px solid var(--border); box-shadow: var(--shadow-sm);
            padding: 1.2rem; margin-bottom: 1rem; animation: fadeIn 0.3s ease;
        }
        .history-entry-header {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 0.8rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border);
        }
        .history-timestamp { font-weight: 600; color: var(--teal-deep); font-size: 0.9rem; }
        .history-badge {
            padding: 3px 10px; border-radius: 12px; font-size: 0.75rem;
            font-weight: 600; background: var(--teal-ghost); color: var(--teal-deep);
        }
        .history-recipients { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
        @media (max-width: 640px) { .history-recipients { grid-template-columns: 1fr; } }
        .history-recipient {
            padding: 8px 12px; border-radius: var(--radius-sm);
            background: var(--teal-ghost); font-size: 0.82rem;
        }
        .history-recipient.empty { background: #f5f5f5; color: var(--text-muted); font-style: italic; }
        .history-recipient strong { color: var(--teal-deep); }
        .btn-delete-history {
            background: none; border: none; cursor: pointer; color: var(--text-muted);
            padding: 4px; border-radius: 4px; transition: var(--transition);
        }
        .btn-delete-history:hover { color: #c0392b; background: #fde8e8; }
        .moment-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; }
        .moment-badge.dimineata { background: #fef3c7; color: #92400e; }
        .moment-badge.pranz { background: #dbeafe; color: #1e40af; }
        .moment-badge.seara { background: #ede9fe; color: #5b21b6; }

        .toast-container { position: fixed; top: 80px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
        .toast {
            background: #fff; border-radius: var(--radius-sm); padding: 12px 18px;
            box-shadow: var(--shadow-lg); border-left: 4px solid var(--teal-deep);
            font-size: 0.88rem; animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s; max-width: 340px;
        }
        .toast.success { border-left-color: #27ae60; }
        .toast.error { border-left-color: #e74c3c; }
        @keyframes toastIn { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:translateX(0); } }
        @keyframes toastOut { from { opacity:1; } to { opacity:0; } }

        .config-overlay {
            display: none; position: fixed; inset: 0;
            background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
            z-index: 300; align-items: center; justify-content: center; padding: 1rem;
        }
        .config-overlay.open { display: flex; }
        .config-modal {
            background: #fff; border-radius: var(--radius-lg); padding: 2rem;
            max-width: 480px; width: 100%; box-shadow: var(--shadow-lg); animation: modalIn 0.3s ease;
        }
        @keyframes modalIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
        .config-modal h2 { font-family: 'Playfair Display', serif; color: var(--teal-deep); margin-bottom: 1rem; font-size: 1.3rem; }
        .settings-btn {
            background: none; border: none; cursor: pointer; color: var(--text-muted);
            padding: 6px; border-radius: var(--radius-sm); transition: var(--transition);
        }
        .settings-btn:hover { color: var(--teal-deep); background: var(--teal-ghost); }
        .settings-btn svg { width: 20px; height: 20px; }
        .spinner { width: 24px; height: 24px; border: 3px solid var(--teal-pale); border-top-color: var(--teal-deep); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 2rem auto; }
        @keyframes spin { to { transform: rotate(360deg); } }
