:root {
  --background: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --text: #172033;
  --muted: #667085;
  --border: #d8dee9;
  --primary: #3347b0;
  --primary-hover: #26378f;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(51, 71, 176, 0.08), transparent 35rem),
    var(--background);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.login-layout {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px 0;
}

.login-card {
  width: min(100%, 430px);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: var(--primary);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 650;
}

input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(51, 71, 176, 0.12);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #fff;
  background: var(--primary);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface);
}

.button-secondary:hover:not(:disabled) {
  border-color: #aeb7c6;
  background: #f9fafb;
}

.app-layout {
  padding: 38px 0 70px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-name {
  max-width: 280px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumbs {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.breadcrumb-button {
  padding: 5px 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.breadcrumb-button:disabled {
  color: var(--text);
  cursor: default;
}

.breadcrumb-separator {
  color: #98a2b3;
}

.toolbar {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 8px 0 16px;
  flex-wrap: wrap;
}

.toolbar-note {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.message {
  min-height: 22px;
  margin: 3px 0 13px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

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

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 18px;
}

.content-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.035);
  cursor: pointer;
  text-align: left;
  transition: transform 130ms ease, box-shadow 130ms ease, border-color 130ms ease;
}

.content-card:hover {
  border-color: #aeb7c6;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.08);
  transform: translateY(-2px);
}

.content-card:focus-visible {
  outline: 3px solid rgba(51, 71, 176, 0.22);
  outline-offset: 2px;
}

.folder-visual,
.image-wrapper {
  display: grid;
  height: 148px;
  place-items: center;
  background: var(--surface-muted);
}

.folder-visual svg {
  width: 86px;
  fill: #8a98d8;
}

.image-wrapper {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.85rem;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-load-error {
  padding: 20px;
}

.card-title,
.card-meta {
  display: block;
  overflow: hidden;
  padding-right: 13px;
  padding-left: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title {
  padding-top: 13px;
  font-weight: 750;
}

.card-meta {
  padding-top: 4px;
  padding-bottom: 14px;
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-state {
  padding: 65px 20px;
  border: 1px dashed #b8c1cf;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  color: var(--text);
}

.empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-muted);
  font-size: 1.8rem;
}

.dialog,
.image-dialog {
  width: min(calc(100% - 32px), 470px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
}

.image-dialog {
  width: min(calc(100% - 32px), 1000px);
}

.dialog::backdrop,
.image-dialog::backdrop {
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(3px);
}

.dialog-card,
.image-dialog-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-size: 1.3rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.image-dialog-card {
  display: grid;
  max-height: 90vh;
  gap: 16px;
}

.image-dialog-card img {
  width: 100%;
  max-height: 65vh;
  border-radius: 12px;
  background: #111827;
  object-fit: contain;
}

.image-dialog-card .button {
  justify-self: start;
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 22px, 1220px);
  }

  .login-card {
    padding: 27px 22px;
  }

  .app-layout {
    padding-top: 24px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .account-actions {
    justify-content: space-between;
  }

  .account-name {
    max-width: 190px;
  }

  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }

  .folder-visual,
  .image-wrapper {
    height: 120px;
  }

  .toolbar-note {
    width: 100%;
  }
}
