* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(180deg, #f7fafc 0%, #edf2f7 100%);
  color: #1a202c;
}

body.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 34%),
    radial-gradient(circle at right center, rgba(15, 23, 42, 0.12), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, #e7eef8 100%);
}

.topbar {
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar a { color: #93c5fd; text-decoration: none; margin-left: 12px; }

.container {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  padding: 20px;
  margin-bottom: 18px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.login-panel {
  width: 100%;
  max-width: 460px;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.2);
  animation: login-panel-enter 0.45s ease-out;
}

.login-panel-header {
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  color: #fff;
  padding: 34px 30px 28px;
  text-align: center;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.login-panel-header h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.15;
}

.login-panel-header p {
  margin: 10px auto 0;
  max-width: 300px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.5;
}

.login-panel-body {
  padding: 30px;
}

.login-intro {
  margin-bottom: 20px;
}

.login-intro h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #0f172a;
}

.login-intro p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

.login-form-row {
  margin-bottom: 16px;
}

.login-form-row label {
  font-size: 13px;
  letter-spacing: 0.01em;
  color: #334155;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap input {
  padding: 13px 14px 13px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-input-wrap .login-password-input {
  padding-right: 76px;
}

.login-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  min-width: 36px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #ffffff;
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-password-toggle:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.login-password-toggle svg {
  width: 16px;
  height: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-password-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.login-input-wrap input:focus {
  background: #fff;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.login-submit {
  margin-top: 8px;
  min-height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.26);
}

.login-meta {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
}

@keyframes login-panel-enter {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1, h2, h3 { margin-top: 0; }

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input, select, textarea, button {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

button {
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: #475569; }
button.success { background: #16a34a; }
button.danger { background: #dc2626; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.info { background: #e0f2fe; color: #0c4a6e; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px;
  font-size: 14px;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.tag.pending { background: #fef3c7; color: #92400e; }
.tag.approved { background: #dcfce7; color: #166534; }
.tag.rejected, .tag.revoked { background: #fee2e2; color: #991b1b; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }

  .login-shell {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 10px 14px 20px;
  }

  .login-panel-header {
    padding: 28px 22px 22px;
  }

  .login-panel-header h1 {
    font-size: 25px;
  }

  .login-panel-body {
    padding: 22px;
  }
}

@media (max-width: 900px) {
  table.mobile-stack,
  table.mobile-stack tbody,
  table.mobile-stack tr,
  table.mobile-stack td {
    display: block;
    width: 100%;
  }

  table.mobile-stack thead {
    display: none;
  }

  table.mobile-stack tr {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 10px;
    background: #fff;
    overflow: hidden;
  }

  table.mobile-stack td {
    border-bottom: 1px solid #f1f5f9;
    padding: 10px 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  table.mobile-stack td:last-child {
    border-bottom: none;
  }

  table.mobile-stack td[colspan]::before {
    content: none;
  }

  table.mobile-stack td[data-label="Action"] > div {
    display: flex !important;
    flex-direction: column;
    gap: 8px !important;
  }

  table.mobile-stack td[data-label="Action"] form {
    width: 100%;
    display: block !important;
  }

  table.mobile-stack td[data-label="Action"] button {
    width: 100% !important;
    min-height: 40px;
  }

  table.mobile-stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .pmf-link-form {
    grid-template-columns: 1fr !important;
  }

  .pm-create-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pm-create-footer > * {
    width: 100%;
  }

  .pm-create-footer button {
    width: 100% !important;
  }
}
