:root {
  --bg: #ffffff;
  --surface: #f8fafb;
  --border: #d9e8ea;
  --text: #1a3a3b;
  --text-muted: #5a7a7c;
  --teal: #007b7e;
  --teal-soft: rgba(0, 123, 126, 0.08);
  --lime: #8cc63f;
  --sky: #76ceeb;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 123, 126, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.portal {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}

.portal-logo {
  height: 48px;
  width: auto;
}

.portal-header h1 {
  font-size: 1.4rem;
  color: var(--teal);
  font-weight: 700;
}

.portal-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.portal-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.portal-main {
  flex: 1;
}

.portal-intro {
  text-align: center;
  margin-bottom: 2rem;
}

.portal-intro h2 {
  font-size: 1.35rem;
  color: var(--teal);
  margin-bottom: 0.5rem;
}

.portal-intro p {
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  font-size: 0.95rem;
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

#productionGrid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entity-grid-future-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding-left: 0.15rem;
}

.entity-grid-future {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  max-width: 360px;
  gap: 0.65rem;
}

.entity-tile-future {
  padding: 0.7rem 0.55rem;
  opacity: 0.72;
  border-style: dashed;
}

.entity-tile-future .entity-flag {
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}

.entity-tile-future .entity-name {
  font-size: 0.78rem;
  line-height: 1.25;
}

.entity-tile-future .entity-subtitle {
  font-size: 0.72rem;
}

.entity-tile-future .entity-badge {
  margin-top: 0.45rem;
  font-size: 0.58rem;
  padding: 0.15rem 0.4rem;
}

.entity-tile {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: var(--shadow);
  position: relative;
}

.entity-tile:hover:not(.disabled) {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 123, 126, 0.15);
}

.entity-tile.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.entity-tile.active {
  border-color: var(--teal);
}

.entity-flag {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.entity-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.2rem;
}

.entity-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.entity-badge {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.entity-badge.live {
  background: rgba(140, 198, 63, 0.2);
  color: #5a9e2e;
}

.entity-badge.soon {
  background: var(--teal-soft);
  color: var(--text-muted);
}

.entity-badge.control {
  background: rgba(0, 123, 126, 0.12);
  color: var(--teal);
}

.entity-tile-control {
  border-color: var(--teal);
  background: white;
}

.entity-tile-control .entity-flag {
  background: var(--teal-soft);
}

.entity-tile[data-target="india-chahade"].active {
  background: white;
}

.entity-tile[data-target="india-chahade"] .entity-flag-icon.entity-flag-svg {
  background: var(--teal-soft);
  color: var(--teal);
}

.entity-flag-icon.entity-flag-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.5rem;
  border-radius: 12px;
  font-size: 0;
}

.entity-flag-icon.entity-flag-svg svg {
  width: 1.45rem;
  height: 1.45rem;
}

.entity-tile-control .entity-flag-icon.entity-flag-svg {
  width: 3rem;
  height: 3rem;
  background: var(--teal);
  color: white;
  box-shadow: var(--shadow);
}

.entity-tile-control .entity-flag-icon.entity-flag-svg svg {
  width: 1.55rem;
  height: 1.55rem;
}

.entity-tile-future .entity-flag-icon.entity-flag-svg {
  width: 2.2rem;
  height: 2.2rem;
  background: rgba(118, 206, 235, 0.12);
  color: var(--text-muted);
}

.back-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.back-link:hover {
  background: var(--teal-soft);
}

.portal-wide {
  max-width: 900px;
}

.panel-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 123, 126, 0.06);
}

.panel-section h2 {
  font-size: 1rem;
  color: var(--teal);
  margin-bottom: 0.25rem;
}

.section-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: start;
}

.user-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-form input,
.user-form select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.site-checkboxes {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.site-checkboxes legend {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
}

.checkbox-label.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.user-form .btn-primary {
  grid-column: 1 / -1;
  justify-self: start;
}

.form-error {
  grid-column: 1 / -1;
  color: #c0392b;
  font-size: 0.82rem;
}

.user-table-wrap {
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.user-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.5rem 0.65rem;
  border-bottom: 2px solid var(--border);
}

.user-table td {
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.user-table .mono {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
}

.role-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
}

.role-pill.role-admin {
  background: rgba(0, 123, 126, 0.15);
  color: #006568;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
}

.you-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--teal);
}

@media (max-width: 640px) {
  .user-form {
    grid-template-columns: 1fr;
  }
}

.portal-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.portal-footer-copy {
  margin-bottom: 0.25rem;
}

.portal-footer-address {
  font-size: 0.72rem;
  opacity: 0.9;
}

.btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--teal);
  color: white;
}

.btn-primary:hover {
  background: #006568;
}

.btn-ghost {
  background: white;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
}

.dialog {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0, 123, 126, 0.18);
}

.dialog::backdrop {
  background: rgba(26, 58, 59, 0.4);
}

.dialog h3 {
  color: var(--teal);
  margin-bottom: 0.35rem;
}

.dialog-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.dialog label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.dialog input {
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.dialog-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.dialog-error {
  color: #c0392b;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 600px) {
  .entity-grid {
    grid-template-columns: 1fr;
  }

  .portal-header {
    flex-wrap: wrap;
  }

  .portal-user {
    margin-left: 0;
    width: 100%;
  }
}

.portal-dashboard .portal-intro {
  text-align: left;
  margin-bottom: 0.5rem;
}

.dashboard-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
}

.dashboard-section {
  margin-bottom: 2.25rem;
}

.dashboard-section-head {
  margin-bottom: 1rem;
}

.dashboard-section-head h2 {
  font-size: 1.05rem;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dashboard-section-head .section-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.entity-tile-restricted {
  opacity: 0.92;
}

.entity-tile-restricted .entity-badge {
  background: rgba(201, 135, 10, 0.15);
  color: #9a6208;
}

.coming-soon-panel {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem 1rem;
}

.portal-admin-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.82rem;
}

.portal-admin-link a {
  color: var(--teal);
  font-weight: 600;
}
