:root {
  --black: #1a1a1a;
  --cream: #faf9f6;
  --white: #ffffff;
  --grey-100: #f2f2f0;
  --grey-200: #e8e8e8;
  --grey-500: #888888;
  --green: #2e7d32;
  --red: #c0392b;
  --amber: #b7791f;
  --shadow: 0 18px 45px rgba(26, 26, 26, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--black);
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
}

img,
video,
iframe {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 520px);
}

.auth-card,
.form-panel,
.viewer-panel,
.remarks-panel,
.empty-state {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 32px;
}

.auth-card-wide {
  width: min(100%, 620px);
}

.brand-mark,
.logo span {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--black);
  color: var(--white);
  border-radius: 6px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  font-size: 16px;
}

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

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form label,
.reply-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.stack-form label span,
.reply-form label span {
  color: var(--grey-500);
  font-size: 12px;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(26, 26, 26, 0.16);
  border-color: var(--black);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

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

.btn-secondary,
.btn-ghost {
  border-color: var(--grey-200);
  background: var(--white);
  color: var(--black);
}

.btn-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.auth-switch {
  margin: 18px 0 0;
  color: var(--grey-500);
  text-align: center;
}

.auth-switch a,
.text-link,
.remark-extra a {
  color: var(--black);
  font-weight: 700;
}

.alert {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 6px;
  font-weight: 700;
}

.alert-danger {
  border: 1px solid rgba(192, 57, 43, 0.25);
  background: rgba(192, 57, 43, 0.08);
  color: var(--red);
}

.alert-success {
  border: 1px solid rgba(46, 125, 50, 0.25);
  background: rgba(46, 125, 50, 0.08);
  color: var(--green);
}

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

.role-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
}

.role-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-card strong {
  font-size: 18px;
}

.role-card span {
  color: var(--grey-500);
}

.role-card.selected {
  border-color: var(--black);
  box-shadow: inset 0 0 0 1px var(--black);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--grey-200);
  background: rgba(250, 249, 246, 0.94);
  backdrop-filter: blur(10px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.username {
  color: var(--grey-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-pill,
.status-badge,
.remark-type {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.role-pill.designer,
.remark-type.basic {
  background: var(--grey-200);
}

.role-pill.marketer {
  background: rgba(183, 121, 31, 0.15);
  color: var(--amber);
}

.role-pill.superadmin {
  background: rgba(26, 26, 26, 0.1);
  color: var(--black);
}

.status-badge.pending {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.status-badge.approved {
  background: rgba(46, 125, 50, 0.14);
  color: var(--green);
}

.remark-type.todo {
  background: rgba(192, 57, 43, 0.1);
  color: var(--red);
}

.page-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 48px) 56px;
}

.narrow-shell {
  width: min(100%, 780px);
}

.page-heading,
.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.action-cluster.left {
  justify-content: flex-start;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.asset-card {
  display: grid;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.08);
}

.asset-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--grey-100);
  overflow: hidden;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-thumb .status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

.file-icon {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--grey-200);
  border-radius: 8px;
  background: var(--white);
  font-weight: 700;
}

.file-icon.large {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  font-size: 18px;
}

.asset-card-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.asset-card-body h2 {
  margin-bottom: 0;
}

.asset-card-body p {
  min-height: 42px;
  margin-bottom: 0;
  color: var(--grey-500);
}

.asset-meta,
.detail-meta,
.remark-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--grey-500);
  font-size: 12px;
}

.rating-row {
  border-top: 1px solid var(--grey-200);
  padding-top: 10px;
  font-weight: 700;
}

.empty-state {
  padding: 32px;
  text-align: center;
}

.empty-state.compact {
  padding: 22px;
  box-shadow: none;
}

.form-panel {
  padding: 24px;
}

.credential-panel {
  display: grid;
  gap: 18px;
}

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

.credential-grid label,
.credential-message {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.credential-grid label span,
.credential-message span {
  color: var(--grey-500);
  font-size: 12px;
  text-transform: uppercase;
}

.users-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.users-panel {
  min-width: 0;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  padding: 18px;
  box-shadow: var(--shadow);
}

.users-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(180px, 1.45fr) minmax(110px, 0.65fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--grey-100);
  padding: 12px;
}

.user-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.user-cell span {
  color: var(--grey-500);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-cell strong,
.user-cell code {
  overflow-wrap: anywhere;
}

.user-cell code {
  border-radius: 5px;
  background: var(--white);
  padding: 4px 6px;
}

.inline-action-form {
  margin: 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr);
  align-items: start;
  gap: 24px;
}

.viewer-panel,
.remarks-panel {
  min-width: 0;
  padding: 18px;
}

.version-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  min-height: 38px;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  background: var(--white);
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.tab-button.active {
  background: var(--black);
  color: var(--white);
}

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

.version-links {
  flex-wrap: wrap;
}

.version-pane {
  display: none;
  min-height: 420px;
}

.version-pane.active {
  display: block;
}

.detail-image,
.detail-video,
.doc-frame,
.download-panel,
.missing-version {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--grey-100);
}

.detail-image {
  display: block;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
}

.detail-video,
.doc-frame {
  height: 68vh;
}

.download-panel,
.missing-version {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 24px;
  text-align: center;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title-row h2 {
  margin-bottom: 0;
}

.panel-title-row span {
  color: var(--grey-500);
  font-size: 12px;
  font-weight: 700;
}

.comment-version-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--grey-200);
  padding-bottom: 16px;
}

.comment-version-toggle a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 44px;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.comment-version-toggle a.active {
  background: var(--black);
  color: var(--white);
}

.remark-form {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--grey-200);
  padding-bottom: 20px;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.remarks-list {
  display: grid;
  gap: 14px;
}

.version-comment-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--grey-200);
  padding-top: 16px;
}

.version-comment-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.version-comment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.version-comment-heading h3 {
  margin-bottom: 0;
}

.version-comment-heading span {
  color: var(--grey-500);
  font-size: 12px;
  font-weight: 700;
}

.remark-card {
  border: 1px solid var(--grey-200);
  border-left: 4px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--white);
}

.remark-card.todo {
  border-left-color: var(--red);
}

.remark-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.remark-head div {
  display: grid;
  gap: 2px;
}

.remark-head span,
.ack-count {
  color: var(--grey-500);
  font-size: 12px;
}

.todo-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.done-button {
  min-width: 92px;
}

.done-button:disabled {
  border-color: rgba(46, 125, 50, 0.2);
  background: rgba(46, 125, 50, 0.12);
  color: var(--green);
}

.remark-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.reply-toggle {
  min-height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--grey-500);
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.reply-toggle:hover,
.reply-toggle[aria-expanded="true"] {
  background: var(--grey-200);
  color: var(--black);
}

.reply-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-left: 14px;
  border-left: 2px solid var(--grey-200);
}

.reply-card {
  border-radius: 6px;
  background: var(--grey-100);
  padding: 10px;
}

.reply-card span {
  display: block;
  color: var(--grey-500);
  font-size: 12px;
}

.reply-card p {
  margin: 6px 0 0;
}

.reply-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.reply-form.is-hidden,
.reply-form[hidden] {
  display: none;
}

.viewer-body {
  background: var(--white);
}

.file-viewer-shell {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 22px;
}

.file-viewer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--grey-200);
  padding-bottom: 14px;
}

.file-viewer-header h1 {
  margin-bottom: 4px;
  font-size: 22px;
}

.file-preview-image {
  display: block;
  max-height: 82vh;
  margin: 0 auto;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  object-fit: contain;
}

.file-preview-frame {
  height: 78vh;
  background: var(--white);
}

.office-preview {
  display: grid;
  gap: 16px;
}

.browser-preview {
  min-height: 420px;
}

.preview-loading {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--grey-100);
  padding: 18px;
  color: var(--grey-500);
  font-weight: 700;
  text-align: center;
}

.preview-loading.is-muted {
  margin-bottom: 14px;
}

.pdf-pages {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.pdf-canvas {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.08);
}

.docx-preview,
.pptx-preview {
  overflow: auto;
  min-height: 420px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  padding: 22px;
}

.docx-preview:empty,
.pptx-preview:empty {
  display: none;
}

.pptx-preview {
  display: grid;
  gap: 22px;
  justify-items: center;
  background: var(--grey-100);
}

.ppt-slide {
  position: relative;
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.08);
}

.ppt-slide-label {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 5;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.72);
  color: var(--white);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.ppt-element {
  position: absolute;
  overflow: hidden;
}

.ppt-text {
  display: flex;
  align-items: center;
  border-radius: 4px;
  padding: 6px;
  white-space: pre-wrap;
}

.ppt-image {
  object-fit: contain;
}

.ppt-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--grey-500);
  font-weight: 700;
}

.office-page {
  min-height: 220px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--white);
  padding: 24px;
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.08);
}

.office-page h2 {
  margin-bottom: 12px;
}

.office-page p {
  white-space: pre-wrap;
}

@media (max-width: 1023px) {
  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .users-layout {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr 1fr;
  }

  .email-cell {
    grid-column: 1 / -1;
  }

  .remarks-panel {
    order: 2;
  }
}

@media (max-width: 700px) {
  .topbar,
  .page-heading,
  .detail-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topnav,
  .action-cluster {
    justify-content: flex-start;
  }

  .logo {
    font-size: 16px;
  }

  .auth-card {
    padding: 22px;
  }

  .role-grid,
  .inline-fields,
  .credential-grid,
  .asset-grid {
    grid-template-columns: 1fr;
  }

  .asset-card-body p {
    min-height: auto;
  }

  .version-pane,
  .detail-image,
  .detail-video,
  .doc-frame,
  .download-panel,
  .missing-version {
    min-height: 300px;
  }

  .detail-video,
  .doc-frame {
    height: 58vh;
  }
}

@media (max-width: 460px) {
  .page-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .topnav {
    flex-wrap: wrap;
  }

  .btn {
    width: 100%;
  }

  .version-tabs .tab-button,
  .reply-form .btn,
  .remark-card .btn {
    width: auto;
  }
}
