* {
  box-sizing: border-box;
}

:root {
  --bg: #0b1020;
  --bg-soft: #111930;
  --card: #ffffff;
  --text: #111827;
  --muted: #5e6b85;
  --line: #dbe2ee;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(79, 70, 229, 0.24), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(124, 58, 237, 0.2), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

.container {
  max-width: 1040px;
  margin: 26px auto;
  padding: 0 16px 48px;
}

h1 {
  margin: 10px 0 18px;
  color: #f8fbff;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  letter-spacing: 0.2px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow:
    0 10px 30px rgba(5, 16, 45, 0.25),
    0 2px 8px rgba(5, 16, 45, 0.08);
  backdrop-filter: blur(5px);
}

label {
  display: block;
  margin: 10px 0 7px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #27324a;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.06s ease;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #8b8ffb;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

button {
  margin-top: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.secondary-btn {
  background: #f5f7fb;
  color: #1f2a44;
  border: 1px solid #d5dced;
  box-shadow: none;
}

.secondary-btn:hover {
  background: #eef2fa;
}

.msg {
  padding: 11px 13px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}

.error {
  background: #fff0f2;
  color: #9f1239;
  border-color: #fecdd3;
}

.success {
  background: #e9fbf0;
  color: #0f6b36;
  border-color: #bbf7d0;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logout {
  text-decoration: none;
  font-weight: 700;
  color: #4f46e5;
}

.search {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.search input {
  flex: 1;
  min-width: 0;
}

.search button {
  width: auto;
  min-width: 120px;
  margin-top: 0;
  white-space: nowrap;
}

.clear-search {
  text-decoration: none;
  font-weight: 700;
  color: #364062;
  border: 1px solid #d5dced;
  border-radius: 12px;
  padding: 10px 13px;
  background: #fff;
}

.search-meta {
  margin: 9px 0 4px;
  color: var(--muted);
  font-size: 14px;
}

.export-row {
  margin-bottom: 8px;
}

.export-btn {
  text-decoration: none;
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.search-hint {
  margin: 8px 0 4px;
  color: #6b7482;
  font-size: 13px;
}

.import-textarea {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.45;
}

.password-block {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #24314c;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid #e3e8f2;
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #eef2f8;
  vertical-align: top;
}

th {
  background: #f7f9ff;
  color: #2b3858;
  font-size: 0.88rem;
}

tr:hover td {
  background: #fafcff;
}

.edit-btn {
  width: auto;
  min-width: 72px;
  margin-top: 0;
  padding: 7px 11px;
  font-size: 13px;
}

.mobile-action-bar {
  display: none;
}

@media (max-width: 700px) {
  body {
    background:
      radial-gradient(700px 380px at 10% -10%, rgba(79, 70, 229, 0.2), transparent 60%),
      linear-gradient(180deg, #0b1020, #111930);
  }

  .container {
    margin: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 90px);
  }

  h1 {
    font-size: 1.35rem;
    margin: 6px 0 14px;
  }

  .search {
    flex-wrap: wrap;
  }

  .export-row {
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .export-btn {
    width: 100%;
    text-align: center;
  }

  .search button,
  .clear-search,
  .form-actions button {
    width: 100%;
    text-align: center;
    min-height: 46px;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  input,
  textarea,
  button,
  .clear-search {
    font-size: 16px;
    min-height: 46px;
    border-radius: 12px;
  }

  .import-textarea {
    min-height: 190px;
  }

  .table-wrap {
    border-radius: 12px;
  }

  th,
  td {
    padding: 10px;
    font-size: 14px;
  }

  .edit-btn {
    min-width: 64px;
    padding: 8px 10px;
  }

  .mobile-action-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border-radius: 14px;
    background: rgba(16, 24, 44, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(5, 16, 45, 0.35);
    z-index: 50;
  }

  .mobile-action-bar button {
    margin: 0;
    min-height: 42px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: none;
  }
}
