/* ==========================================================================
   mysapserver.in - design system for the redesigned portal
   One stylesheet for the whole site: public pages, auth screens, customer
   dashboard and admin. Replaces the old per-page css files.
   ========================================================================== */

:root {
  --bg:            #f6f7fb;
  --surface:       #ffffff;
  --surface-2:     #f2f4f9;
  --border:        #e2e6ef;
  --border-strong: #cbd2e0;

  --text:          #182031;
  --text-muted:    #5c6780;
  --text-faint:    #8b95ab;

  --brand:         #1f4fd8;
  --brand-dark:    #1a41b0;
  --brand-soft:    #eaf0ff;

  --ok:            #0f7b52;
  --ok-soft:       #e3f5ec;
  --warn:          #9a6100;
  --warn-soft:     #fdf0d8;
  --danger:        #b3261e;
  --danger-soft:   #fce9e7;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .06);
  --shadow-lg:     0 8px 32px rgba(20, 30, 60, .12);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --wrap: 1140px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Stops mobile Safari/Chrome inflating text in landscape. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* Deliberately NOT using `overflow-x: hidden` here as a catch-all: it turns the
   body into a scroll container and breaks the sticky site header. The real
   overflow causes (grid track floors, non-wrapping input rows) are fixed at
   source instead. */

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: .875rem; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }

/* --- header --------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  height: 66px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #4b7bff);
  color: #fff; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
}
.site-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.site-nav a {
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .925rem; font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.site-nav a.active { color: var(--brand); background: var(--brand-soft); }

/* --- buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font: inherit; font-size: .925rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-whatsapp { background: #25d366; color: #0b2e19; }
.btn-whatsapp:hover { background: #1eb958; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.btn:disabled, .btn.is-disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}

/* --- cards / panels ------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-head h3 { margin: 0; }
.card-body { padding: 22px; }
.card-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex; gap: 10px; flex-wrap: wrap;
}

.grid { display: grid; gap: 18px; }
/* min() on the track floor is what stops these overflowing. A bare
   minmax(320px, 1fr) keeps a 320px column even when its container is narrower -
   inside a card on a 360px phone there is only ~276px, so the row would push
   ~44px off-screen and the whole page would scroll sideways. */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }

/* --- badges --------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 650; letter-spacing: .01em;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-active    { background: var(--ok-soft);     color: var(--ok); }
.badge-expiring  { background: var(--warn-soft);   color: var(--warn); }
.badge-expired   { background: var(--danger-soft); color: var(--danger); }
.badge-suspended { background: var(--surface-2);   color: var(--text-muted); }
.badge-neutral   { background: var(--brand-soft);  color: var(--brand); }

/* --- alerts --------------------------------------------------------------- */

.alert {
  padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: .925rem;
  margin-bottom: 18px;
}
.alert-error   { background: var(--danger-soft); border-color: #f2c4c0; color: #8c1d17; }
.alert-success { background: var(--ok-soft);     border-color: #b8e2ce; color: #0b5c3e; }
.alert-info    { background: var(--brand-soft);  border-color: #c6d6ff; color: #16389b; }
.alert-warn    { background: var(--warn-soft);   border-color: #edd39a; color: #7a4d00; }

/* --- forms ---------------------------------------------------------------- */

.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: .875rem; font-weight: 600; color: var(--text);
}
.field .hint { font-size: .82rem; color: var(--text-muted); margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 79, 216, .13);
}
.input::placeholder { color: var(--text-faint); }
/* Wraps rather than squashing: the renew row (two number fields + a button) and
   the search row would otherwise compress to unusable slivers on a phone. */
.input-group { display: flex; gap: 8px; flex-wrap: wrap; }
.input-group .input, .input-group .select { flex: 1 1 150px; min-width: 0; }
.input-group .btn { flex: 0 0 auto; }

/* Inline forms that sit in a card footer (module routing, renew) - give each
   field a floor so wrapping produces readable rows instead of thin columns. */
.card-foot .field { flex: 1 1 150px; min-width: 140px; }

/* --- secret reveal (SAP password on the dashboard) ------------------------ */

.secret {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .95rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.secret-value { flex: 1; letter-spacing: .02em; word-break: break-all; }
.secret-value.is-masked { letter-spacing: .18em; color: var(--text-muted); }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); padding: 4px 6px; border-radius: 6px;
  font-size: .8rem; font-weight: 600; font-family: var(--font);
}
.icon-btn:hover { background: var(--border); color: var(--text); }

/* --- definition rows ------------------------------------------------------ */

.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 9px 16px; font-size: .925rem; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; font-weight: 550; }

/* --- tables --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 650; background: var(--surface-2);
  white-space: nowrap;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }

/* --- stats ---------------------------------------------------------------- */

.stat { padding: 18px 20px; }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 650; }
.stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }

/* --- auth screens --------------------------------------------------------- */

.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { padding: 30px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.auth-title { text-align: center; margin-bottom: 6px; font-size: 1.4rem; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: .925rem; margin-bottom: 24px; }

/* --- app shell (dashboard / admin) ---------------------------------------- */

.app-main { padding: 30px 0 60px; }
.page-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 { margin: 0; font-size: 1.65rem; }
.page-head .spacer { margin-left: auto; }

/* --- public hero ---------------------------------------------------------- */

.hero { padding: 72px 0 60px; text-align: center; }
.hero h1 { max-width: 780px; margin: 0 auto .8rem; }
.hero p.lede { font-size: 1.1rem; color: var(--text-muted); max-width: 620px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section-head p { color: var(--text-muted); margin: 0; }

.feature { padding: 24px; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 1.1rem; margin-bottom: 14px;
}
.feature h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature p { font-size: .92rem; color: var(--text-muted); margin: 0; }

.steps { counter-reset: step; display: grid; gap: 16px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-size: .85rem; font-weight: 700;
}
.step h3 { font-size: 1rem; margin-bottom: 3px; }
.step p { font-size: .92rem; color: var(--text-muted); margin: 0; }

/* --- pricing -------------------------------------------------------------- */

.price-card { padding: 26px; display: flex; flex-direction: column; }
.price-card h3 { font-size: 1.1rem; }
.price-amount { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; margin: 6px 0 2px; }
.price-term { font-size: .85rem; color: var(--text-muted); }
.price-list { list-style: none; padding: 0; margin: 18px 0; font-size: .92rem; }
.price-list li { padding: 5px 0 5px 22px; position: relative; color: var(--text-muted); }
.price-list li::before {
  content: "\2713"; position: absolute; left: 0; color: var(--ok); font-weight: 700;
}
.price-card .btn { margin-top: auto; }

/* --- footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 32px 0; margin-top: 60px;
  font-size: .9rem; color: var(--text-muted);
}
.site-footer .wrap { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.site-footer .spacer { margin-left: auto; }

/* --- filter chips --------------------------------------------------------- */

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  font: inherit; font-size: .875rem; font-weight: 600; color: var(--text-muted);
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.chip .count { opacity: .7; font-weight: 500; margin-left: 4px; }

/* Search box with a clear button tucked inside. */
.search-wrap { position: relative; flex: 1 1 260px; }
.search-wrap .input { padding-right: 38px; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer;
  color: var(--text-faint); font-size: 1.1rem; line-height: 1;
  padding: 6px 8px; border-radius: 6px;
}
.search-clear:hover { background: var(--surface-2); color: var(--text); }

@media (hover: none) and (pointer: coarse) {
  .chip { min-height: 40px; }
}

/* --- modal ---------------------------------------------------------------- */

/* `hidden` must win over the display rules below, otherwise a hidden backdrop
   still paints as a grid. */
[hidden] { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 20, 35, .55);
  display: grid; place-items: center; padding: 20px;
  animation: modalFade .12s ease-out;
}
.modal {
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 430px;
  animation: modalPop .14s ease-out;
}
.modal h3 { margin: 0; }
.modal-head { padding: 22px 24px 0; }
.modal-body { padding: 10px 24px 20px; color: var(--text-muted); font-size: .95rem; }
.modal-body strong { color: var(--text); }
.modal-foot {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
@keyframes modalFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalPop { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }

@media (max-width: 640px) {
  .modal-foot .btn { flex: 1 1 auto; }
}

/* --- misc ----------------------------------------------------------------- */

.empty {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty h3 { color: var(--text); }

.divider { height: 1px; background: var(--border); margin: 22px 0; border: 0; }

@media (max-width: 640px) {
  .site-header .wrap { height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
  .site-nav { width: 100%; margin-left: 0; overflow-x: auto; }
  .hero { padding: 48px 0 40px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }

  /* iOS Safari zooms into any focused input smaller than 16px and never zooms
     back out, which makes the activation form feel broken on an iPhone. */
  .input, .select, textarea.input { font-size: 16px; }

  .wrap { padding: 0 16px; }
  .card-body, .card-pad { padding: 18px; }
  .card-head, .card-foot { padding-left: 18px; padding-right: 18px; }
  .page-head h1 { font-size: 1.4rem; }

  /* Full-width actions read better than a row of small buttons on a phone. */
  .card-foot .btn { flex: 1 1 auto; }
}

/* Touch devices only - keeps the desktop UI compact while making the same
   controls big enough to hit. ~44px is the usual minimum. */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 9px 14px; font-size: .9rem; }
  .icon-btn { min-height: 40px; min-width: 44px; padding: 8px 10px; font-size: .85rem; }
  .site-nav a { padding: 11px 13px; }
  table.data th, table.data td { padding: 14px; }
}
