:root {
  --ink: #122a42;
  --ink-soft: #204462;
  --accent: #0e847a;
  --accent-hover: #0a7068;
  --bg: #f1f5f8;
  --mute: #647484;
  --line: #dce4ec;
}

body {
  background: var(--bg);
  color: #1c2833;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.app-shell { min-height: 100vh; }

.sidebar {
  width: 248px;
  min-width: 248px;
  background: var(--ink);
}

.sidebar .nav-link {
  color: rgba(255,255,255,.82);
  border-radius: .5rem;
  padding: .7rem 1rem;
  font-weight: 600;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: var(--accent);
  color: #fff;
}

.main-area { min-width: 0; }

.topbar h1 { color: var(--ink); }

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.stat-card .accent-bar {
  position: absolute;
  top: 14px;
  left: 0;
  width: 6px;
  height: calc(100% - 28px);
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.stat-card .label { color: var(--mute); font-size: .9rem; }
.stat-card .value { color: var(--ink); font-size: 1.7rem; font-weight: 700; margin: .35rem 0; }
.stat-card .sub { color: var(--mute); font-size: .85rem; }

.card-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .75rem;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-ink:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }

.table thead th {
  background: var(--ink);
  color: #fff;
  white-space: nowrap;
  vertical-align: middle;
}

.table tr.row-link {
  cursor: pointer;
}
.table tr.row-link:hover {
  background: var(--accent-soft, #e0f4f1) !important;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #122a42 0%, #0e6e68 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  min-height: 460px;
}

.login-form { padding: 2.2rem 2.4rem; }
.login-hero {
  background: linear-gradient(180deg, #0e6460, #123448);
  color: #fff;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.login-hero h2 { font-size: 1.9rem; font-weight: 700; line-height: 1.35; }

/* تفاصيل الوصفة */
.rx-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(18, 42, 66, .06);
}
.rx-detail__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.35rem;
  background: linear-gradient(135deg, #122a42 0%, #0e6e68 100%);
  color: #fff;
}
.rx-detail__eyebrow {
  font-size: .8rem;
  opacity: .75;
  margin-bottom: .15rem;
}
.rx-detail__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}
.rx-detail__head-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.rx-detail__date {
  background: rgba(255,255,255,.12);
  border-radius: .5rem;
  padding: .35rem .7rem;
  font-size: .9rem;
}
.rx-state {
  display: inline-block;
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .85rem;
  font-weight: 700;
}
.rx-state-new { background: #ffe8c7; color: #8a5a10; }
.rx-state-lab { background: #d9ecff; color: #1b4f86; }
.rx-state-done { background: #d7f5e8; color: #14785a; }

.rx-detail__body { padding: 1.2rem 1.35rem 1.4rem; }
.rx-patient,
.rx-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
  margin-bottom: 1.1rem;
}
.rx-field {
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: .7rem;
  padding: .7rem .85rem;
}
.rx-field__label {
  display: block;
  color: var(--mute);
  font-size: .78rem;
  margin-bottom: .25rem;
}
.rx-field__value {
  display: block;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  word-break: break-word;
}

.rx-eyes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.rx-eye-card {
  border: 1px solid var(--line);
  border-radius: .85rem;
  overflow: hidden;
  background: #fff;
}
.rx-eye-card__title {
  background: #e8f5f3;
  color: var(--ink);
  font-weight: 700;
  padding: .7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rx-eye-card__title span {
  color: var(--accent);
  font-size: .85rem;
}
.rx-measure {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}
.rx-measure th,
.rx-measure td {
  text-align: center;
  padding: .75rem .4rem;
  border-top: 1px solid var(--line);
}
.rx-measure th {
  background: #f8fafc;
  color: var(--mute);
  font-size: .8rem;
  font-weight: 600;
}
.rx-measure td {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.rx-near {
  margin-bottom: 1.1rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  padding: .9rem 1rem;
  background: #fbfcfd;
}
.rx-near__title {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .7rem;
}
.rx-near__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .6rem;
}
.rx-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: .55rem .65rem;
  text-align: center;
}
.rx-chip span {
  display: block;
  color: var(--mute);
  font-size: .72rem;
  margin-bottom: .2rem;
}
.rx-chip strong {
  color: var(--ink);
  font-size: .98rem;
}

.rx-money {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
}
.rx-money > div {
  border-radius: .85rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  background: #f7fafc;
}
.rx-money__total { font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.rx-money__paid { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.rx-money__rest { font-size: 1.2rem; font-weight: 700; color: #a86e12; }

.rx-note {
  border: 1px dashed #c9d6e2;
  border-radius: .85rem;
  padding: .9rem 1rem;
  background: #fcfdfe;
}
.rx-note__text {
  color: var(--ink);
  margin-top: .25rem;
  line-height: 1.6;
}

@media (max-width: 992px) {
  .rx-patient,
  .rx-meta,
  .rx-money,
  .rx-eyes { grid-template-columns: 1fr 1fr; }
  .rx-near__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 576px) {
  .rx-patient,
  .rx-meta,
  .rx-money,
  .rx-eyes,
  .rx-near__grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; }
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { min-height: 180px; }
}
