:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #161616;
  --muted: #686e76;
  --line: #dfe3e8;
  --soft: #eef0f3;
  --danger: #b42318;
  --success: #027a48;
  --shadow: 0 18px 48px rgba(18, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Old Standard TT", Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 246, 248, 1) 430px),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--surface);
  background: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover,
.open-link:hover,
.admin-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

button.secondary,
.admin-link {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

button.danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

a {
  color: inherit;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo {
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #ffffff;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.06;
  letter-spacing: 0;
}

h1 {
  font-size: 2.75rem;
  font-weight: 700;
}

h2 {
  font-size: 1.45rem;
  font-weight: 700;
}

.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.count-pill,
.admin-name {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--surface);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.count-pill {
  min-width: 44px;
}

.admin-link,
.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease;
}

.open-link {
  min-width: 78px;
  color: var(--surface);
  background: var(--ink);
}

.admin-shell {
  margin: 28px 0 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.admin-body {
  padding: 20px;
}

.login-grid,
.manager-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field label,
.search-field label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field input,
.field select,
.search-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus,
.field select:focus,
.search-field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 22, 22, 0.1);
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-12 {
  grid-column: span 12;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--danger);
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.logout-form {
  margin: 0;
}

.list-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 34px 0 18px;
}

.search-field {
  display: grid;
  gap: 7px;
  width: min(360px, 100%);
}

.link-list {
  display: grid;
  gap: 12px;
}

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 14px 16px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(18, 24, 40, 0.05);
}

.link-name {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.25;
}

.link-url {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.empty-state {
  border: 1px dashed #c8ced6;
  border-radius: 8px;
  padding: 28px 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
  font-weight: 700;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

@media (max-width: 780px) {
  .page {
    width: min(100% - 22px, 1120px);
    padding-top: 18px;
  }

  .header {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.22rem;
  }

  .meta {
    white-space: normal;
  }

  .admin-heading,
  .admin-body {
    padding-right: 14px;
    padding-left: 14px;
  }

  .login-grid,
  .manager-grid {
    grid-template-columns: 1fr;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-12 {
    grid-column: 1 / -1;
  }

  .admin-top,
  .list-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .link-card {
    grid-template-columns: 1fr;
  }

  .open-link,
  .admin-link {
    width: 100%;
  }
}
