:root {
  --bg: #f3f6f4;
  --ink: #14201c;
  --muted: #5b6b64;
  --line: #d5e0da;
  --card: #ffffff;
  --brand: #0f6b5c;
  --brand-2: #148f7b;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 18px 50px rgba(20, 32, 28, 0.08);
  --radius: 18px;
  --font: "DM Sans", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d8efe8 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #e7f1ff 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
}
.brand {
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.top-link { color: var(--muted); font-weight: 500; }

.container {
  width: min(920px, calc(100% - 32px));
  margin: 24px auto 64px;
}

.hero-search {
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(255,255,255,.78));
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 48px);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .75rem;
  color: var(--brand);
  font-weight: 700;
  margin: 0 0 10px;
}
.hero-search h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 10px;
  line-height: 1.1;
}
.lead { color: var(--muted); margin: 0 0 28px; max-width: 48ch; }

.search-card label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row input {
  flex: 1 1 260px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  background: #fff;
}
.search-row button, .btn, .login-card button {
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}
.alert {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 500;
}
.alert-error { background: #fee4e2; color: var(--danger); }
.alert-success { background: #dcfae6; color: var(--ok); }

.page-admin { display: flex; min-height: 100vh; background: #eef3f1; }
.sidebar {
  width: 240px;
  background: #10241f;
  color: #dce9e4;
  padding: 24px 18px;
  flex-shrink: 0;
}
.sidebar-brand {
  font-weight: 700;
  margin-bottom: 24px;
  font-size: 1.05rem;
}
.sidebar nav { display: grid; gap: 8px; }
.sidebar a {
  color: #dce9e4;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
}
.sidebar a:hover { background: rgba(255,255,255,.08); }
.admin-main { flex: 1; padding: 28px; }
.admin-main-full { width: 100%; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel-head, .actions, .filter-row, .form-actions, .row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.panel-head { justify-content: space-between; margin-bottom: 16px; }
.muted { color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 18px 0; }
.stat {
  background: #f5faf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.stat span { display: block; color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 2rem; }

.table-wrap { overflow: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.thumb {
  width: 42px; height: 42px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line);
}
.thumb-empty {
  display: inline-flex; align-items: center; justify-content: center; background: #f3f6f4; color: #99a;
}
.row-actions form { display: inline; }
.link-danger {
  background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; padding: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-span-2 { grid-column: span 2; }
.form-field label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea, .login-card input, .filter-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}
.preview { margin-top: 10px; width: 120px; height: 140px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}
.login-card h1 { margin: 0; font-family: var(--display); }
.login-card p { margin: 0 0 8px; color: var(--muted); }

@media (max-width: 820px) {
  .page-admin { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: span 1; }
}


/* ==========================================================================
   ADMIN PROFESSIONAL DESIGN & THEME COMPONENT STYLES
   ========================================================================== */

.settings-page-wrapper {
    max-width: 1080px;
    margin: 0 auto;
}
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.settings-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
}
.settings-desc {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 0.95rem;
}
.header-actions .btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 9px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
}
.header-actions .btn-outline:hover {
    border-color: #0f172a;
    color: #0f172a;
    background: #f8fafc;
}

/* CARDS GRID */
.settings-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
.setting-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
}
.card-title-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.card-icon {
    font-size: 1.4rem;
}
.card-title-bar h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}
.card-title-bar p {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: #64748b;
}

/* LOGO PREVIEW */
.logo-preview-box {
    background: #DDB448;
    border-radius: 12px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1px dashed rgba(0,0,0,0.15);
    margin-bottom: 14px;
}
.logo-preview-box img {
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
}

/* BG PREVIEW */
.bg-preview-box {
    border-radius: 12px;
    height: 140px;
    background-size: cover;
    background-position: center;
    position: relative;
    border: 1px dashed rgba(0,0,0,0.15);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
}
.preview-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.65);
    color: #ffffff;
    padding: 4px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

/* CUSTOM UPLOAD BUTTON */
.custom-file-input {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.custom-file-input input[type="file"] {
    display: none;
}
.upload-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f1f5f9;
    color: #334155;
    padding: 9px 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.upload-trigger-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.file-chosen-text {
    font-size: 0.85rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* RESET BUTTON */
.card-actions-bar {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}
.btn-reset {
    background: transparent;
    border: 0;
    color: #b42318;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    transition: color 0.2s ease;
}
.btn-reset:hover {
    color: #912018;
    text-decoration: underline;
}

/* FIELDS & INPUTS */
.fields-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.input-block label, .color-item label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #ffffff;
    transition: border-color 0.2s ease;
}
.form-control:focus {
    outline: 0;
    border-color: #0f172a;
}

.colors-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 20px;
}
.color-picker-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}
.color-picker-wrap input[type="color"] {
    width: 44px;
    height: 42px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: #ffffff;
}

/* FOOTER */
.settings-footer {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    color: #ffffff;
    border: 0;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-primary:hover {
    background: #000000;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

@media (max-width: 768px) {
    .settings-cards-grid {
        grid-template-columns: 1fr;
    }
    .fields-split, .colors-row {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   PATIENTS MANAGEMENT PAGE PROFESSIONAL STYLES
   ========================================================================== */

.patients-admin-wrap {
    max-width: 1400px;
    margin: 0 auto;
}

/* HEADER */
.patients-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.breadcrumbs .sep { color: #cbd5e1; }
.breadcrumbs .active { color: #0f172a; }

.patients-page-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}
.patients-page-header .subtitle {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.92rem;
}

.btn-create-patient {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    color: #ffffff;
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-create-patient:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.35);
    color: #f8fafc;
    text-decoration: none;
}

/* METRICS ROW */
.patients-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.metric-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.metric-icon-box.bg-gold { background: #fef3c7; color: #b45309; }
.metric-icon-box.bg-blue { background: #e0f2fe; color: #0284c7; }
.metric-icon-box.bg-purple { background: #f3e8ff; color: #7e22ce; }

.metric-info {
    display: flex;
    flex-direction: column;
}
.metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.metric-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

/* TABLE CARD */
.patients-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    overflow: hidden;
}

/* TOOLBAR */
.table-toolbar {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    background: #fafcff;
    flex-wrap: wrap;
    gap: 14px;
}
.search-form-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 520px;
}
.search-input-box {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.search-input-box .search-ico {
    position: absolute;
    left: 12px;
    color: #94a3b8;
    pointer-events: none;
}
.search-input-box input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #ffffff;
    transition: all 0.2s ease;
}
.search-input-box input:focus {
    outline: 0;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.clear-search-btn {
    position: absolute;
    right: 12px;
    color: #94a3b8;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 700;
}
.clear-search-btn:hover { color: #0f172a; }

.btn-filter-submit {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-filter-submit:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.table-count-tag {
    font-size: 0.85rem;
    color: #64748b;
}

/* TABLE STYLES */
.custom-table-container {
    overflow-x: auto;
}
.pro-patient-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.pro-patient-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 18px;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
}
.pro-patient-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.patient-row:hover {
    background: #fbfcfe;
}

/* CELLS */
.photo-cell {
    padding-right: 8px;
}
.pro-avatar-frame {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.pro-avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.name-primary {
    font-weight: 700;
    font-size: 0.98rem;
    color: #0f172a;
}
.meta-secondary {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 2px;
}
.text-strong {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.92rem;
}
.text-muted { color: #94a3b8; }

.ic-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.04em;
}

.gender-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.pill-male {
    background: #e0f2fe;
    color: #0369a1;
}
.pill-female {
    background: #fce7f3;
    color: #be185d;
}

.location-text {
    font-weight: 600;
    color: #334155;
    font-size: 0.92rem;
}

/* ACTIONS */
.action-btn-group {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}
.act-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.act-view {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}
.act-view:hover {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
    text-decoration: none;
}

.act-edit {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}
.act-edit:hover {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    text-decoration: none;
}

.act-delete {
    background: #fff1f2;
    color: #e11d48;
    border-color: #fecdd3;
    padding: 6px 8px;
}
.act-delete:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #e11d48;
}

/* EMPTY STATE */
.empty-state-cell {
    padding: 60px 20px !important;
    text-align: center;
}
.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.empty-icon-wrap {
    font-size: 2.8rem;
    margin-bottom: 12px;
}
.empty-state-content h4 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}
.empty-state-content p {
    margin: 0 0 18px;
    color: #64748b;
    font-size: 0.92rem;
}
.btn-empty-action {
    display: inline-flex;
    background: #0f172a;
    color: #ffffff;
    padding: 9px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
}

@media (max-width: 900px) {
    .patients-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-form-wrap {
        max-width: 100%;
        width: 100%;
    }
}
