@media (max-width: 900px) {
  html[data-theme] body {
    padding: 0;
  }

  html[data-theme] .main-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  html[data-theme] .main-content {
    padding: 16px;
  }

  html[data-theme] .header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 0;
    margin-top: 0;
  }

  html[data-theme] .header-bar {
    padding: 12px 0 10px;
  }

  html[data-theme] #goBackButton.go-back-button {
    width: 100%;
    justify-content: center;
  }

  html[data-theme] .tabs {
    width: 100%;
    padding: 6px;
    gap: 8px;
    overflow-x: auto;
    border-radius: 20px;
  }

  html[data-theme] .tabs .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
  }

  html[data-theme] #overview .overview-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0;
  }

  html[data-theme] #overview .grid {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 16px;
  }

  html[data-theme] #overview .field {
    width: 100%;
  }

  html[data-theme] #overview .field > div,
  html[data-theme] #overview .field input,
  html[data-theme] #overview .field select,
  html[data-theme] #overview .field textarea {
    width: 100%;
    max-width: 100%;
  }

  html[data-theme] #overview #field-name {
    font-size: 28px;
    line-height: 1.1;
  }

  html[data-theme] .timezone-select,
  html[data-theme] .timezone-trigger,
  html[data-theme] .timezone-dropdown {
    width: 100%;
  }

  html[data-theme] .timezone-dropdown {
    max-height: 240px;
    overflow: auto;
  }

  html[data-theme] .header-buttons-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 0 0 12px;
  }

  html[data-theme] .header-buttons-row .pill {
    width: 100%;
    justify-content: center;
  }

  html[data-theme] .header-buttons-row #client-version-btn,
  html[data-theme] .header-buttons-row #ai-action-button {
    width: 100%;
    justify-content: center;
  }

  html[data-theme] #resume .cv-container {
    padding: 18px 14px !important;
    max-width: 100% !important;
    margin: 0 0 24px !important;
    border-radius: 14px !important;
  }

  html[data-theme] #resume .cv-heading-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  html[data-theme] #resume .cv-heading-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  html[data-theme] #resume .resume-section-actions button {
    width: 100%;
  }

  html[data-theme] #resume #workExperienceList,
  html[data-theme] #resume #educationList {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  html[data-theme] #resume #workExperienceList .cv-card-entry,
  html[data-theme] #resume #educationList .cv-card-entry {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }

  html[data-theme] #resume #workExperienceSection .cv-card-entry,
  html[data-theme] #resume #educationSection .cv-card-entry {
    grid-template-columns: 1fr !important;
    row-gap: 10px !important;
    padding: 16px 14px !important;
  }

  html[data-theme] #resume #workExperienceSection .cv-card-entry .month-year,
  html[data-theme] #resume #educationSection .cv-card-entry .month-year {
    grid-column: 1 / -1 !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }

  html[data-theme] #resume .cv-card-entry .remove-entry {
    position: static;
    align-self: flex-end;
    margin-bottom: 6px;
  }

  html[data-theme] #resume .cv-card-entry input.work-title,
  html[data-theme] #resume .cv-card-entry input.edu-title {
    width: 100% !important;
  }

  /* Resume: readable text + safe wrapping on mobile */
  html[data-theme] #resume .cv-card,
  html[data-theme] #resume .cv-card-entry,
  html[data-theme] #resume .rich-input,
  html[data-theme] #resume .cv-card-entry input,
  html[data-theme] #resume .cv-card-entry textarea,
  html[data-theme] #resume .cv-card-entry [contenteditable="true"] {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  html[data-theme] #resume .cv-card-entry input.work-title,
  html[data-theme] #resume .cv-card-entry input.edu-title,
  html[data-theme] #resume .cv-card-entry input.work-company {
    font-size: 15px !important;
    line-height: 1.3;
  }

  html[data-theme] #resume .cv-card,
  html[data-theme] #resume .rich-input {
    font-size: 14px;
    line-height: 1.45;
  }

  html[data-theme] #resume .cv-card-entry .month-year {
    width: 100%;
  }

  html[data-theme] #resume .cv-card-entry .month-year select {
    width: 100% !important;
  }

  html[data-theme] #opportunities table {
    display: block;
    width: max-content;
    min-width: 720px;
    overflow-x: auto;
  }

  html[data-theme] #hire .grid {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  html[data-theme] #hire #opp-model-pill {
    width: 100%;
    text-align: center;
  }

  html[data-theme] #hire .reminders-list {
    grid-template-columns: 1fr;
  }
  body {
    overflow-x: hidden;
  }

  input,
  select,
  textarea,
  .field input,
  .field select,
  .field textarea,
  .input-group input,
  .input-group select,
  .input-group textarea,
  [contenteditable="true"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

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

  .detail-nav {
    width: 100%;
    overflow: visible;
  }

  .detail-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    white-space: normal;
  }

  .detail-tabs::-webkit-scrollbar {
    display: none;
  }

  .detail-nav .nav-item {
    width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
    font-size: 13px;
    line-height: 1.2;
    padding: 10px 8px;
  }

  .detail-nav .nav-indicator {
    display: none;
  }

  .detail-main {
    padding: 18px 16px 48px;
  }

  .overview-actions button {
    width: 100%;
  }

  #candidates {
    padding: 18px 16px;
  }

  .overview-grid,
  .grid,
  .overview-layout {
    grid-template-columns: 1fr !important;
  }

  .input-group {
    min-width: 0;
    margin-bottom: 1rem;
  }

  .input-group.full {
    grid-column: span 1 !important;
  }

  .section-header,
  .overview-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
  }

  .header-bar,
  .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .header-row .tabs,
  .header-bar .tabs,
  .tabs {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 6px 10px;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs .tab {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 14px;
  }

  .overview-layout > .sidebar {
    width: 100%;
  }

  .cv-card-entry,
  .doc-row,
  .field-group,
  .card-content {
    min-width: 0;
  }

  .pipeline-section {
    padding: 18px 16px;
    min-height: auto;
  }

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

  #job .job-insight-grid {
    grid-template-columns: 1fr;
  }

  #job .job-header,
  #job .job-card {
    padding: 16px;
    border-radius: 20px;
  }

  #job .job-header-left h2 {
    font-size: 1.7rem;
  }

  #job .job-editor-topline {
    align-items: flex-start;
  }

  #job .job-editor-tabs {
    width: 100%;
    gap: 1rem;
    overflow-x: auto;
  }

  #job .job-editor-note {
    font-size: 0.85rem;
  }

  .toolbar button,
  #emoji-trigger {
    min-width: 44px;
    padding: 9px 12px;
  }

  .job-description-editor {
    min-height: 360px;
    padding: 16px;
    border-radius: 18px;
  }

  .pipeline-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .pipeline-actions button {
    flex: 1 1 140px;
  }

  .pipeline-columns {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 12px;
    gap: 12px;
    scroll-snap-type: x proximity;
  }

  .pipeline-columns::-webkit-scrollbar {
    display: none;
  }

  .pipeline-columns .column {
    flex: 0 0 240px;
    min-width: 240px;
    scroll-snap-align: start;
  }

  .pipeline-columns .card-container {
    min-height: auto;
    padding: 10px 8px;
  }

  #pipeline .column-title {
    font-size: 0.84rem;
    gap: 6px;
  }

  #pipeline .column-name {
    font-size: 0.84rem;
  }

  #pipeline .pipeline-card {
    padding: 11px;
  }

  #pipeline .pipeline-card .candidate-identity {
    gap: 6px;
  }

  #pipeline .pipeline-card .country,
  #pipeline .pipeline-card .candidate-name,
  #pipeline .pipeline-card .salary {
    font-size: 0.84rem;
  }

  .batch-table {
    overflow-x: auto;
  }

  .batch-table table {
    min-width: 520px;
  }

  .batch-detail {
    padding: 16px;
  }

  .batch-box {
    width: 100%;
  }

  .batch-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .batch-actions h3 {
    margin: 0;
  }

  .batch-actions > div {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .batch-actions .btn-add,
  .batch-actions .btn-send,
  .batch-actions .btn-delete {
    flex: 1 1 140px;
  }

  .batch-detail .candidate-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 16px;
  }

  .batch-detail .candidate-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .batch-detail .candidate-info-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .batch-detail .candidate-card-header strong {
    white-space: normal;
  }

  .batch-detail .candidate-status-dropdown {
    position: static;
    width: 100%;
    max-height: none;
  }

  #fixedBackContainer {
    position: static;
    margin: 12px 16px 0;
  }

  #fixedBackContainer .go-back-button {
    width: auto;
  }

  .detail-header {
    padding-top: 12px;
  }

  .tab-selector {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0;
  }

  /* Candidate Details tabs */
  .tabs {
    width: 100%;
    overflow-x: auto;
    padding: 6px;
    gap: 8px;
    box-sizing: border-box;
    border-radius: 24px;
  }

  .tabs .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 16px;
    font-size: 14px;
  }

  .header-row .tabs {
    margin-right: 0 !important;
    margin-left: 0 !important;
    justify-content: flex-start;
  }

  .header-row {
    width: 100%;
  }

  /* Candidate Details resume section */
  #resume .cv-card-entry,
  #resume .cv-card {
    max-width: 100% !important;
    width: 100% !important;
  }

  #resume .cv-card-entry input,
  #resume .cv-card-entry select,
  #resume .cv-card-entry textarea {
    width: 100% !important;
    max-width: 100% !important;
  }

  #resume .cv-card-entry .month-year,
  #resume .mr-entry .month-year {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  #resume .cv-card-entry .month-year select,
  #resume .mr-entry .month-year select {
    width: 100% !important;
    min-width: 0 !important;
  }

  #resume .cv-card-entry .rich-toolbar,
  #resume .cv-card-entry .rich-input {
    width: 100% !important;
  }

  .tab-selector::-webkit-scrollbar {
    display: none;
  }

  .tab-btn,
  #requestBonusBtn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .grid-two-cols {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .grid-two-cols p {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .grid-two-cols p strong {
    font-size: 14px;
  }

  .grid-two-cols p a,
  .grid-two-cols p span,
  .grid-two-cols p input {
    width: 100%;
  }

  .accordion-content {
    padding: 16px;
  }

  .styled-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .styled-table th,
  .styled-table td {
    padding: 12px 14px;
  }

  #employees .card {
    padding: 16px;
  }

  #employees .styled-table {
    width: max-content;
    min-width: 980px;
    font-size: 13px;
    table-layout: auto;
  }

  #employees .styled-table th,
  #employees .styled-table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  #employees .styled-table thead,
  #employees .styled-table tbody,
  #employees .styled-table tr {
    display: table;
    width: max-content;
    table-layout: auto;
  }

  /* Candidate Details mobile fixes */
  html[data-theme] * {
    box-sizing: border-box;
  }

  html[data-theme] .field.textarea textarea,
  html[data-theme] .field [contenteditable="true"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  html[data-theme] #overview .field {
    padding: 12px;
  }

  html[data-theme] #overview .field label {
    font-size: 11px;
  }

  html[data-theme] #resume .cv-heading {
    font-size: 13px;
  }

  html[data-theme] #resume .cv-card,
  html[data-theme] #resume .cv-card-entry {
    padding: 12px 14px !important;
  }

  html[data-theme] #resume .cv-card-entry,
  html[data-theme] #resume .tool-entry,
  html[data-theme] #resume .language-entry {
    min-width: 0;
    width: 100%;
  }

  html[data-theme] #resume #toolsSection .tool-entry,
  html[data-theme] #resume #languagesSection .tool-entry,
  html[data-theme] #resume #languagesSection .language-entry {
    flex: 1 1 100%;
  }

  html[data-theme] #resume .cv-card-entry input.work-title,
  html[data-theme] #resume .cv-card-entry input.edu-title,
  html[data-theme] #resume .cv-card-entry input.work-company {
    width: 100% !important;
  }

  html[data-theme] .mr-row {
    grid-template-columns: 1fr;
  }

  html[data-theme] .mr-row .mr-col {
    min-width: 0;
  }

  html[data-theme] .mr-entry {
    padding-right: 16px;
  }

  html[data-theme] .month-year {
    flex-wrap: wrap;
  }

  html[data-theme] .month-year select {
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-theme] #hire .grid {
    padding: 12px;
  }

  html[data-theme] #hire .field {
    padding: 12px;
  }

  html[data-theme] #hire input,
  html[data-theme] #hire select {
    font-size: 13px;
  }

  html[data-theme] .tests-row {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .detail-title {
    font-size: 1.2rem;
  }

  .detail-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-title {
    font-size: 1.4rem;
  }

  .go-back-button,
  .topbar .back {
    width: 100%;
  }
}
