* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Outfit", Arial, sans-serif;
  color: #1a2621;
  background: #fcfaf7;
  -webkit-font-smoothing: antialiased;
}
.serif { font-family: "Cormorant Garamond", Georgia, serif; }

.ayur-texture {
  background-image: radial-gradient(rgba(197,160,89,0.06) 1px, transparent 1px);
  background-size: 22px 22px;
}
.ayur-banner {
  background: linear-gradient(90deg, #13382c 0%, #1e4d3b 50%, #13382c 100%);
  border-bottom: 2px solid #c5a059;
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 420px; background: #fff; border: 2px solid rgba(197,160,89,0.4);
  border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px -15px rgba(30,77,59,0.25);
}
.login-head { padding: 30px; text-align: center; }
.leaf-badge {
  width: 56px; height: 56px; border-radius: 50%; background: #f4ebd0; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.leaf-badge.sm { width: 40px; height: 40px; font-size: 20px; margin: 0; }
.brand-title { font-family: "Cormorant Garamond", serif; font-size: 1.9rem; font-weight: 700; color: #f4ebd0; letter-spacing: 1px; }
.brand-sub { color: rgba(244,235,208,0.8); font-size: 0.85rem; margin-top: 4px; }
.login-body { padding: 30px; display: flex; flex-direction: column; gap: 18px; }
.error-box { font-size: 0.85rem; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 8px 12px; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1.25rem; font-weight: 700; color: #f4ebd0; line-height: 1; }
.topbar-tag { font-size: 0.6rem; letter-spacing: 3px; color: rgba(244,235,208,0.7); text-transform: uppercase; }
.logout-btn { background: rgba(255,255,255,0.12); color: #f4ebd0; border: none; padding: 8px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 0.85rem; transition: background 0.2s; }
.logout-btn:hover { background: rgba(255,255,255,0.22); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.tabs { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.tab-btn { font-family: inherit; font-weight: 600; padding: 10px 18px; border-radius: 12px; cursor: pointer; background: #fff; color: #1e4d3b; border: 1px solid rgba(197,160,89,0.4); transition: all 0.2s; }
.tab-btn.active { background: #1e4d3b; color: #f4ebd0; border-color: #1e4d3b; box-shadow: 0 4px 12px -4px rgba(30,77,59,0.5); }

/* ---------- Cards / form ---------- */
.ayur-card { background: #fff; border: 1px solid rgba(197,160,89,0.3); border-radius: 16px; box-shadow: 0 4px 20px -2px rgba(197,160,89,0.1); margin-bottom: 22px; transition: box-shadow 0.25s, border-color 0.25s; }
.ayur-card:hover { border-color: rgba(197,160,89,0.55); box-shadow: 0 8px 30px -4px rgba(30,77,59,0.12); }
.ayur-card.dashed { border-style: dashed; }
.pad { padding: 20px; }
.ayur-section-title { font-family: "Cormorant Garamond", serif; font-size: 1.4rem; font-weight: 700; color: #13382c; border-bottom: 2px solid #c5a059; padding-bottom: 6px; margin-bottom: 16px; }
.ayur-label { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #52645c; margin-bottom: 5px; }
.hint { font-size: 0.72rem; color: #52645c; margin-bottom: 6px; }
.legal { font-size: 0.72rem; font-style: italic; color: #52645c; line-height: 1.6; }

.ayur-input { width: 100%; font-family: inherit; font-size: 0.9rem; color: #1a2621; background: #fcfaf7; border: 1px solid rgba(197,160,89,0.4); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.ayur-input:focus { border-color: #1e4d3b; box-shadow: 0 0 0 3px rgba(30,77,59,0.12); background: #fff; }
textarea.ayur-input { resize: vertical; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid3.end { align-items: end; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row-inline { display: flex; gap: 8px; }
.row-inline .ayur-input { flex: 1; }

@media (max-width: 760px) {
  .grid3, .grid2 { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */
.ayur-btn-primary, .ayur-btn-outline, .ayur-btn-gold {
  display: inline-flex; align-items: center; gap: 8px; font-family: inherit; font-weight: 600;
  border-radius: 999px; cursor: pointer; transition: background 0.2s, transform 0.1s, box-shadow 0.2s; border: 1px solid;
}
.ayur-btn-primary { font-size: 0.9rem; color: #f4ebd0; background: #1e4d3b; border-color: #13382c; padding: 10px 20px; }
.ayur-btn-primary:hover { background: #13382c; box-shadow: 0 6px 18px -4px rgba(30,77,59,0.5); }
.ayur-btn-outline { font-size: 0.9rem; color: #1e4d3b; background: #fff; border-color: #1e4d3b; padding: 10px 20px; }
.ayur-btn-outline:hover { background: #f4efe6; }
.ayur-btn-gold { font-size: 0.88rem; color: #13382c; background: #f4ebd0; border-color: #c5a059; padding: 9px 16px; }
.ayur-btn-gold:hover { background: #eaddb4; }
.ayur-btn-primary:active, .ayur-btn-outline:active, .ayur-btn-gold:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.link-btn { background: none; border: none; color: #1e4d3b; text-decoration: underline; cursor: pointer; font-size: 0.75rem; font-family: inherit; padding: 0; }
.link-btn:hover { color: #c5a059; }

/* ---------- Image upload ---------- */
.img-upload { display: flex; gap: 12px; align-items: center; background: #fcfaf7; border: 1px solid rgba(197,160,89,0.3); border-radius: 10px; padding: 10px; }
.img-thumb { width: 56px; height: 56px; border-radius: 8px; border: 1px solid rgba(197,160,89,0.4); background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; }
.img-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-thumb img:not([src]) , .img-thumb img[src=""] { display: none; }
.img-label { font-size: 0.85rem; font-weight: 600; color: #1a2621; }

/* ---------- Medicine table ---------- */
.table-scroll { overflow-x: auto; border: 1px solid rgba(197,160,89,0.4); border-radius: 12px; }
.med-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 0.85rem; }
.med-table thead tr { background: #1e4d3b; color: #f4ebd0; }
.med-table th { text-align: left; padding: 10px; font-weight: 600; }
.med-table td { padding: 6px 8px; }
.med-table tbody tr:nth-child(even) { background: #f4efe6; }
.med-cell { width: 100%; font-family: inherit; font-size: 0.82rem; color: #1a2621; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; outline: none; transition: border-color 0.15s, background 0.15s; }
.med-cell:focus { border-color: #1e4d3b; background: #fff; }
.del-btn { color: #dc2626; background: none; border: none; cursor: pointer; font-size: 1rem; padding: 6px; border-radius: 6px; }
.del-btn:hover { background: #fef2f2; }

/* ---------- Action bar ---------- */
.action-bar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 12px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 12px 0; background: rgba(252,250,247,0.95); backdrop-filter: blur(6px); border-top: 1px solid rgba(197,160,89,0.3); }
.sync-status { margin-right: auto; font-size: 0.8rem; color: #52645c; }

/* ---------- History results ---------- */
.rec-card { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.pid-chip { font-family: monospace; font-size: 0.82rem; font-weight: 600; color: #1e4d3b; background: #f4ebd0; padding: 2px 8px; border-radius: 6px; }
.rec-name { font-family: "Cormorant Garamond", serif; font-size: 1.15rem; font-weight: 600; color: #13382c; }
.rec-meta { font-size: 0.72rem; color: #52645c; margin-top: 4px; }
.rec-actions { display: flex; gap: 8px; }
.empty { text-align: center; color: #52645c; padding: 40px 0; }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 20px; right: 20px; z-index: 100; background: #13382c; color: #f4ebd0; padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px -8px rgba(0,0,0,0.4); font-size: 0.88rem; opacity: 0; transform: translateY(-10px); transition: opacity 0.25s, transform 0.25s; pointer-events: none; border-left: 4px solid #c5a059; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-left-color: #dc2626; }
