:root {
  --a-black: #1d1d1b;
  --a-orange: #f28b18;
  --a-paper: #f7f2ea;
  --a-white: #fffaf2;
  --a-muted: #706d68;
  --a-line: rgba(29,29,27,.14);
  --a-shadow: 0 18px 50px rgba(29,29,27,.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--a-paper);
  color: var(--a-black);
}

a { color: inherit; text-decoration: none; }

.m-admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top right, rgba(242,139,24,.18), transparent 30rem),
    var(--a-paper);
  padding: 24px;
}

.m-login-card {
  width: min(430px, 100%);
  background: var(--a-white);
  border: 2px solid var(--a-black);
  border-radius: 30px;
  padding: 34px;
  box-shadow: 12px 12px 0 var(--a-black);
}

.m-login-card img {
  width: 180px;
  max-height: 70px;
  object-fit: contain;
  object-position: left;
  margin-bottom: 24px;
}

.m-login-card h1 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.m-login-card p {
  color: var(--a-muted);
  margin: 0 0 24px;
}

.m-login-card label {
  display: block;
  font-weight: 800;
  margin: 14px 0 7px;
}

.m-login-card input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--a-line);
  border-radius: 16px;
  background: #fff;
  font: inherit;
}

.m-login-card button,
.m-admin-actions a,
.m-admin-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--a-black);
  border-radius: 999px;
  background: var(--a-black);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.m-login-card button {
  width: 100%;
  margin-top: 22px;
}

.m-admin-alert {
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 14px;
  font-weight: 800;
}

.m-admin-alert.error {
  color: #9d001b;
  background: rgba(157,0,27,.08);
}

.m-admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.m-admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: var(--a-black);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.m-admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.m-admin-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
}

.m-admin-brand strong {
  font-size: 18px;
}

.m-admin-sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.m-admin-sidebar nav a {
  padding: 12px 14px;
  border-radius: 16px;
  color: rgba(255,255,255,.78);
  font-weight: 800;
}

.m-admin-sidebar nav a:hover {
  background: rgba(242,139,24,.18);
  color: #fff;
}

.m-admin-user {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.m-admin-user span {
  display: block;
  color: rgba(255,255,255,.55);
  font-size: 13px;
}

.m-admin-main {
  padding: 28px;
}

.m-admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  margin-bottom: 24px;
}

.m-admin-topbar h1 {
  margin: 0;
  font-size: 42px;
  letter-spacing: -0.06em;
}

.m-admin-topbar p {
  margin: 8px 0 0;
  color: var(--a-muted);
}

.m-admin-actions {
  display: flex;
  gap: 10px;
}

.m-admin-actions a:nth-child(2) {
  background: var(--a-orange);
  color: var(--a-black);
  border-color: var(--a-orange);
}

.m-admin-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.m-admin-stats div {
  background: var(--a-white);
  border: 1px solid var(--a-line);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(29,29,27,.05);
}

.m-admin-stats span {
  display: block;
  color: var(--a-muted);
  font-weight: 800;
  font-size: 13px;
}

.m-admin-stats strong {
  display: block;
  font-size: 38px;
  letter-spacing: -0.07em;
  margin-top: 8px;
}

.m-admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.m-admin-card {
  background: var(--a-white);
  border: 1px solid var(--a-line);
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(29,29,27,.05);
}

.m-admin-card h2 {
  margin: 0 0 18px;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.m-admin-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--a-line);
}

.m-admin-row:last-child {
  border-bottom: 0;
}

.m-admin-row span {
  color: var(--a-muted);
  font-weight: 800;
}

@media (max-width: 980px) {
  .m-admin-app {
    grid-template-columns: 1fr;
  }

  .m-admin-sidebar {
    position: static;
    height: auto;
  }

  .m-admin-stats,
  .m-admin-grid {
    grid-template-columns: 1fr;
  }

  .m-admin-topbar {
    display: block;
  }

  .m-admin-actions {
    margin-top: 16px;
    flex-wrap: wrap;
  }
}

.m-admin-alert.success {
  color: #0c6b32;
  background: rgba(12,107,50,.09);
}

.m-admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.m-admin-table {
  width: 100%;
  border-collapse: collapse;
}

.m-admin-table th {
  text-align: left;
  color: var(--a-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 12px;
  border-bottom: 1px solid var(--a-line);
}

.m-admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--a-line);
  vertical-align: middle;
}

.m-admin-media-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.m-admin-media-title img {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--a-line);
  padding: 6px;
}

.m-admin-media-title strong {
  display: block;
}

.m-admin-media-title span {
  display: block;
  color: var(--a-muted);
  font-size: 13px;
  margin-top: 3px;
}

.m-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.m-row-actions a,
.m-row-actions button {
  border: 1px solid var(--a-line);
  background: #fff;
  color: var(--a-black);
  padding: 8px 11px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.m-row-actions button.danger {
  color: #a40018;
  border-color: rgba(164,0,24,.25);
}

.m-status {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.m-status.published {
  color: #0c6b32;
  background: rgba(12,107,50,.1);
}

.m-status.draft {
  color: #9c5d00;
  background: rgba(242,139,24,.16);
}

.m-admin-form-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  align-items: start;
}

.m-admin-card label {
  display: block;
  font-weight: 900;
  margin: 14px 0 7px;
}

.m-admin-card input,
.m-admin-card textarea,
.m-admin-card select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--a-line);
  border-radius: 16px;
  background: #fff;
  font: inherit;
}

.m-admin-card textarea {
  resize: vertical;
}

.m-admin-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.m-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  background: rgba(242,139,24,.1);
  border-radius: 16px;
  padding: 12px;
}

.m-check input {
  width: auto;
}

@media (max-width: 980px) {
  .m-admin-form-grid,
  .m-admin-two {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   PHASE 5 ADMIN POLISH + MOBILE RESPONSIVE
========================================================= */

.m-admin-main {
  min-width: 0;
}

.m-admin-card,
.m-login-card {
  backdrop-filter: blur(8px);
}

.m-admin-btn,
.m-admin-actions a,
.m-row-actions a,
.m-row-actions button {
  transition: .18s ease;
}

.m-admin-btn:hover,
.m-admin-actions a:hover,
.m-row-actions a:hover,
.m-row-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(29,29,27,.10);
}

.m-admin-card input:focus,
.m-admin-card textarea:focus,
.m-admin-card select:focus,
.m-login-card input:focus,
.m-admin-editor-form input:focus,
.m-admin-editor-form textarea:focus,
.m-admin-editor-form select:focus,
.m-seo-filter input:focus,
.m-seo-filter select:focus {
  outline: 3px solid rgba(242,139,24,.25);
  border-color: var(--a-orange);
}

.m-admin-table td,
.m-admin-table th {
  white-space: nowrap;
}

.m-admin-table td:first-child,
.m-admin-table th:first-child {
  white-space: normal;
}

.m-admin-sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.m-admin-sidebar nav a::after {
  content: "›";
  opacity: .35;
  font-size: 18px;
}

.m-admin-sidebar nav a:hover::after {
  opacity: 1;
  color: var(--a-orange);
}

/* Better desktop widths */
@media (min-width: 1400px) {
  .m-admin-main {
    padding: 34px;
  }

  .m-admin-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .m-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablet admin */
@media (max-width: 1180px) {
  .m-admin-app {
    grid-template-columns: 238px 1fr;
  }

  .m-admin-sidebar {
    padding: 18px;
  }

  .m-admin-brand {
    align-items: flex-start;
  }

  .m-admin-brand img {
    width: 50px;
    height: 50px;
  }

  .m-admin-brand strong {
    font-size: 16px;
  }

  .m-admin-sidebar nav a {
    padding: 11px 12px;
    font-size: 14px;
  }

  .m-admin-main {
    padding: 22px;
  }

  .m-admin-topbar h1 {
    font-size: 36px;
  }

  .m-admin-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .m-admin-form-grid,
  .m-media-layout,
  .m-services-layout {
    grid-template-columns: 1fr;
  }

  .m-media-layout > form,
  .m-services-layout > form,
  .m-seo-list {
    position: static;
    max-height: none;
  }

  .m-media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile admin becomes top navigation */
@media (max-width: 980px) {
  body.m-admin-app {
    display: block;
  }

  .m-admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 80;
    height: auto;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }

  .m-admin-brand {
    padding-bottom: 10px;
  }

  .m-admin-brand img {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .m-admin-user {
    display: none;
  }

  .m-admin-sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 10px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .m-admin-sidebar nav a {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    font-size: 13px;
  }

  .m-admin-sidebar nav a::after {
    display: none;
  }

  .m-admin-main {
    padding: 16px;
  }

  .m-admin-topbar {
    display: block;
    margin-bottom: 18px;
  }

  .m-admin-topbar h1 {
    font-size: 34px;
  }

  .m-admin-topbar p {
    font-size: 14px;
  }

  .m-admin-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .m-admin-actions a,
  .m-admin-actions button,
  .m-admin-btn {
    min-height: 42px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .m-admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .m-admin-stats div {
    padding: 16px;
    border-radius: 20px;
  }

  .m-admin-stats strong {
    font-size: 30px;
  }

  .m-admin-grid {
    grid-template-columns: 1fr;
  }

  .m-admin-card {
    border-radius: 22px;
    padding: 18px;
  }

  .m-admin-card h2 {
    font-size: 22px;
  }

  .m-admin-form-grid,
  .m-admin-two,
  .m-seo-layout,
  .m-media-layout,
  .m-services-layout {
    grid-template-columns: 1fr;
  }

  .m-admin-table-wrap {
    margin-inline: -18px;
    padding-inline: 18px;
    width: calc(100% + 36px);
  }

  .m-admin-table {
    min-width: 760px;
  }

  .m-row-actions {
    gap: 6px;
  }

  .m-row-actions a,
  .m-row-actions button {
    padding: 7px 10px;
    font-size: 12px;
  }

  .m-seo-list,
  .m-media-layout > form,
  .m-services-layout > form {
    position: static;
    max-height: none;
  }

  .m-seo-edit-head {
    display: block;
  }

  .m-seo-edit-head h2 {
    font-size: 26px;
  }

  .m-seo-edit-head strong {
    margin-top: 12px;
  }

  .m-media-head {
    display: block;
  }

  .m-media-filter {
    margin-top: 14px;
  }

  .m-media-filter select,
  .m-media-filter button {
    width: 100%;
  }

  .m-media-grid {
    grid-template-columns: 1fr;
  }

  .m-enquiry-head,
  .m-enquiry-foot {
    display: block;
  }

  .m-enquiry-foot .m-row-actions {
    margin-top: 12px;
  }
}

/* Small mobile admin */
@media (max-width: 640px) {
  .m-admin-sidebar {
    padding: 10px;
  }

  .m-admin-brand strong {
    font-size: 15px;
  }

  .m-admin-sidebar nav a {
    font-size: 12px;
    padding: 9px 11px;
  }

  .m-admin-main {
    padding: 12px;
  }

  .m-admin-topbar h1 {
    font-size: 30px;
  }

  .m-admin-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .m-admin-actions a,
  .m-admin-actions button,
  .m-admin-btn {
    width: 100%;
  }

  .m-admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .m-admin-stats span {
    font-size: 12px;
  }

  .m-admin-stats strong {
    font-size: 28px;
  }

  .m-admin-card {
    padding: 16px;
    border-radius: 20px;
  }

  .m-admin-card input,
  .m-admin-card textarea,
  .m-admin-card select,
  .m-admin-editor-form input,
  .m-admin-editor-form textarea,
  .m-admin-editor-form select {
    padding: 12px;
    border-radius: 14px;
    font-size: 14px;
  }

  .m-admin-media-title {
    min-width: 220px;
  }

  .m-admin-media-title img {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .m-seo-pills,
  .m-enquiry-pills {
    gap: 6px;
  }

  .m-seo-pills a,
  .m-enquiry-pills a {
    font-size: 12px;
    padding: 8px 10px;
  }

  .m-seo-item {
    display: block;
  }

  .m-seo-item em {
    margin-top: 10px;
  }

  .m-media-thumb {
    height: 210px;
  }

  .m-enquiry-head,
  .m-enquiry-message,
  .m-enquiry-foot {
    padding: 16px;
  }

  .m-enquiry-head h2 {
    font-size: 21px;
  }
}

/* Very small admin phones */
@media (max-width: 390px) {
  .m-admin-stats {
    grid-template-columns: 1fr;
  }

  .m-admin-topbar h1 {
    font-size: 28px;
  }

  .m-admin-card {
    padding: 14px;
  }
}

/* =========================================================
   SEO MANAGER FIX
========================================================= */

.m-seo-layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.m-seo-list {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 44px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.m-seo-filter {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.m-seo-filter input,
.m-seo-filter select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--a-line);
  border-radius: 16px;
  background: #fff;
  font: inherit;
}

.m-seo-filter button {
  width: fit-content;
}

.m-seo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.m-seo-pills a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid var(--a-line);
  border-radius: 999px;
  background: #fff;
  color: var(--a-black);
  font-size: 13px;
  font-weight: 900;
}

.m-seo-pills a.active {
  background: var(--a-black);
  color: #fff;
  border-color: var(--a-black);
}

.m-seo-pills a span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(242,139,24,.16);
  color: var(--a-orange);
  font-size: 12px;
}

.m-seo-items {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.m-seo-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--a-line);
  border-radius: 20px;
  background: #fff;
  transition: .18s ease;
}

.m-seo-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(29,29,27,.08);
}

.m-seo-item.active {
  border-color: var(--a-black);
  background: linear-gradient(135deg, rgba(242,139,24,.14), #fff);
  box-shadow: inset 4px 0 0 var(--a-orange);
}

.m-seo-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.25;
}

.m-seo-item span {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--a-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.m-seo-item small {
  display: block;
  max-width: 285px;
  color: var(--a-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-seo-item em {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--a-black);
  color: #fff;
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
}

.m-seo-edit {
  min-width: 0;
}

.m-seo-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--a-line);
}

.m-seo-edit-head span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(242,139,24,.14);
  color: var(--a-black);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.m-seo-edit-head h2 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -.06em;
}

.m-seo-edit-head a {
  display: inline-flex;
  color: var(--a-orange);
  font-weight: 900;
}

.m-seo-edit-head strong {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 96px;
  border-radius: 28px;
  background: var(--a-black);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.m-admin-editor-form {
  display: grid;
  gap: 12px;
}

.m-admin-editor-form label {
  display: block;
  margin-top: 4px;
  font-weight: 900;
}

.m-admin-editor-form label small {
  color: var(--a-muted);
  font-weight: 700;
}

.m-admin-editor-form input,
.m-admin-editor-form textarea,
.m-admin-editor-form select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--a-line);
  border-radius: 16px;
  background: #fff;
  font: inherit;
}

.m-seo-suggestion {
  margin: 10px 0;
  padding: 16px;
  border: 1px dashed rgba(29,29,27,.22);
  border-radius: 20px;
  background: rgba(242,139,24,.08);
}

.m-seo-suggestion strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.m-seo-suggestion p {
  margin: 8px 0 0;
  color: var(--a-muted);
  line-height: 1.45;
}

.danger-btn {
  background: #a40018 !important;
  border-color: #a40018 !important;
  color: #fff !important;
}

@media (max-width: 1180px) {
  .m-seo-layout {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  .m-seo-item small {
    max-width: 220px;
  }
}

@media (max-width: 980px) {
  .m-seo-layout {
    grid-template-columns: 1fr;
  }

  .m-seo-list {
    position: static;
    max-height: none;
  }

  .m-seo-items {
    overflow: visible;
  }

  .m-seo-edit-head {
    display: block;
  }

  .m-seo-edit-head h2 {
    font-size: 28px;
  }

  .m-seo-edit-head strong {
    margin-top: 12px;
    min-width: 86px;
    height: 64px;
    border-radius: 20px;
  }
}

@media (max-width: 640px) {
  .m-seo-filter button {
    width: 100%;
  }

  .m-seo-item {
    display: block;
  }

  .m-seo-item small {
    max-width: 100%;
    white-space: normal;
  }

  .m-seo-item em {
    margin-top: 10px;
    width: fit-content;
    min-width: 64px;
    height: 42px;
    border-radius: 999px;
  }

  .m-seo-edit-head h2 {
    font-size: 24px;
  }
}