/* Mobile console layout. Desktop rules intentionally remain untouched. */
@media (max-width: 760px) {
  html, body, #app, .console-shell, .console-main, .page-stage {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body { min-width: 0; font-size: 15px; }
  button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  button, .side-link, .primary-button, .quiet-button, .row-button, .delete-button, .text-button { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; }

  .console-shell { display: block; min-height: 100dvh; }
  .sidebar {
    position: sticky;
    z-index: 45;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 8px 10px 9px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(23, 26, 40, .97);
    box-shadow: 0 10px 28px rgba(4, 7, 14, .26);
    backdrop-filter: blur(16px);
  }
  .sidebar > div:first-child { display: contents; }
  .sidebar-brand { display: block; grid-column: 1; padding: 0 5px 7px; }
  .sidebar-brand .brand-logo { width: 32px; height: 32px; border-radius: 9px; }
  .sidebar-brand .brand-name { display: block; }
  .sidebar-brand .brand-name b { font-size: 9px; }
  .sidebar-brand .brand-name em { margin-top: 3px; font-size: 7px; }
  .workspace-label, .session-mark { display: none; }
  .sidebar nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    overflow: visible;
  }
  .side-link {
    display: flex;
    flex: initial;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 64px;
    padding: 6px 3px;
    border: 1px solid transparent;
    border-radius: 8px;
  }
  .side-link svg { width: 17px; height: 17px; }
  .side-link span {
    display: block;
    width: 100%;
    overflow: visible;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-overflow: clip;
    white-space: normal;
  }
  .side-link:hover { transform: none; }
  .side-link.is-active { border-color: rgba(237, 68, 75, .18); }
  .sidebar-bottom { display: block; grid-column: 2; grid-row: 1; padding-bottom: 7px; }
  .logout {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border: 1px solid rgba(237, 68, 75, .18);
    background: rgba(237, 68, 75, .07);
    color: #f2a1a5;
    font-size: 0;
  }

  .console-main { padding: 20px 12px 34px; }
  .topbar { align-items: stretch; flex-direction: column; gap: 13px; margin-bottom: 18px; }
  .topbar > div:first-child { min-width: 0; }
  .topbar p { margin-bottom: 5px; font-size: 9px; }
  .topbar h1 { overflow-wrap: anywhere; font-size: 25px; line-height: 1.08; }
  .topbar-actions { display: flex; flex-wrap: wrap; gap: 7px; width: 100%; }
  .topbar-actions .sync-indicator { min-height: 42px; flex: 1 1 auto; justify-content: center; }
  .topbar-actions .icon-button, .topbar-actions .account-avatar { width: 42px; height: 42px; flex: 0 0 42px; }
  .topbar-actions .primary-button, .topbar-actions .quiet-button {
    width: auto;
    height: auto;
    flex: 1 1 132px;
    padding: 10px 12px;
    font-size: 12px;
  }
  .topbar-actions .primary-button svg { margin: 0; }
  .page-stage { min-width: 0; }

  .page-intro, .account-directory-hero, .request-hero, .release-center-hero {
    gap: 18px;
    padding: 20px 18px;
    border-radius: 13px;
  }
  .page-intro h2, .account-directory-hero h2, .request-hero h2, .release-center-hero h2 { font-size: 23px; line-height: 1.12; }
  .page-intro span, .account-directory-hero > div:first-child > span, .request-hero small, .release-center-hero > div > span {
    font-size: 13px;
    line-height: 1.58;
  }
  .list-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .search-field { width: 100%; max-width: none; min-height: 48px; }
  .list-toolbar > span { align-self: flex-end; }
  .panel-head { padding: 17px; }

  .stat-grid, .overview-metrics, .usage-stat-grid, .request-hero__summary, .account-directory-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .stat-card, .overview-metric, .usage-stat-grid article, .request-hero__summary article, .account-directory-stats article {
    min-width: 0;
    min-height: 104px;
    padding: 14px;
  }
  .account-directory-stats article { min-height: 76px; }

  .request-grid, .organization-grid, .request-queue__grid, .request-queue__grid--personal,
  .organization-portfolio-grid, .corporate-usage-grid, .release-center-grid, .release-announcement-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .request-card, .organization-card, .request-queue-card { padding: 18px; }
  .request-card__actions, .request-queue-card__actions { flex-direction: column; }
  .request-card__actions button, .request-queue-card__actions button { width: 100%; }
  .request-hero { align-items: stretch; flex-direction: column; }
  .request-hero__summary { width: 100%; }
  .request-queue__section-head { align-items: flex-start; flex-direction: column; gap: 7px; }
  .request-queue-card__head { grid-template-columns: auto minmax(0, 1fr); }
  .request-queue-card__head > .status { grid-column: 1 / -1; justify-self: start; }
  .request-queue-card__identity span, .request-queue-card__identity p { overflow-wrap: anywhere; }
  .request-queue-card__scope { grid-template-columns: 1fr; }

  .table-wrap { width: 100%; overflow: visible; }
  .mobile-card-table, .device-table table { display: block; width: 100%; min-width: 0; }
  .mobile-card-table thead, .device-table thead { display: none; }
  .mobile-card-table tbody, .device-table tbody { display: grid; gap: 10px; width: 100%; }
  .mobile-card-table tr, .device-table tr.device-usage-row {
    display: block;
    overflow: hidden;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--panel);
  }
  .mobile-card-table td, .device-table tr.device-usage-row > td {
    display: grid;
    grid-template-columns: minmax(82px, .42fr) minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    width: 100%;
    min-width: 0;
    padding: 11px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    overflow-wrap: anywhere;
  }
  .mobile-card-table td:last-child, .device-table tr.device-usage-row > td:last-child { border-bottom: 0; }
  .mobile-card-table td::before, .device-table tr.device-usage-row > td::before {
    color: #7f8a9d;
    font: 700 9px "DM Mono", monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .mobile-card-table td:nth-child(1)::before { content: "Lisans"; }
  .mobile-card-table td:nth-child(2)::before { content: "Tür"; }
  .mobile-card-table td:nth-child(3)::before { content: "Hak sahibi"; }
  .mobile-card-table td:nth-child(4)::before { content: "Modüller"; }
  .mobile-card-table td:nth-child(5)::before { content: "Bitiş"; }
  .mobile-card-table td:nth-child(6)::before { content: "Durum"; }
  .mobile-card-table td:nth-child(7)::before { content: "İşlemler"; }
  .device-table tr.device-usage-row > td:nth-child(1)::before { content: "Cihaz"; }
  .device-table tr.device-usage-row > td:nth-child(2)::before { content: "Kullanıcı"; }
  .device-table tr.device-usage-row > td:nth-child(3)::before { content: "Lisans"; }
  .device-table tr.device-usage-row > td:nth-child(4)::before { content: "Modüller"; }
  .device-table tr.device-usage-row > td:nth-child(5)::before { content: "Bitiş"; }
  .device-table tr.device-usage-row > td:nth-child(6)::before { content: "Kullanım"; }
  .device-table tr.device-usage-row > td:nth-child(7)::before { content: "Kayıt"; }
  .device-table tr.device-usage-row > td:nth-child(8)::before { content: "İşlemler"; }
  .mobile-card-table td[colspan], .device-table td[colspan] { display: block; padding: 0; }
  .mobile-card-table td[colspan]::before, .device-table td[colspan]::before { content: none; }
  .license-name, .device-user, .device-license, .usage-status { min-width: 0; }
  .license-name > div, .device-user, .device-license { overflow-wrap: anywhere; }
  .module-chip { max-width: 100%; white-space: normal; line-height: 1.45; }
  .license-row-actions, .device-row-actions { display: grid; grid-template-columns: 1fr; gap: 7px; width: 100%; }
  .license-row-actions button, .device-row-actions button { width: 100%; }
  .device-activity-row { display: block; margin-top: -10px; }
  .device-activity-row > td { display: block; width: 100%; }
  .device-activity-detail { padding: 15px; border-radius: 0 0 13px 13px; }
  .device-activity-detail__head { align-items: flex-start; flex-direction: column; }
  .device-activity-card { grid-template-columns: auto minmax(0, 1fr); }
  .device-activity-card__model, .device-activity-card__models, .device-activity-card__seen { grid-column: 1 / -1; }

  .organization-portfolio, .corporate-usage-card { min-width: 0; border-radius: 13px; }
  .organization-portfolio__top { grid-template-columns: auto minmax(0, 1fr) auto; padding: 15px; }
  .organization-portfolio__metrics, .organization-portfolio__metrics--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .organization-portfolio__modules, .organization-portfolio__people, .organization-portfolio__detail { padding-right: 15px; padding-left: 15px; }
  .organization-person-chip { max-width: 100%; }
  .corporate-usage-card__head { grid-template-columns: 1fr; gap: 16px; padding: 17px; }
  .corporate-module-meter-grid { grid-template-columns: 1fr; }
  .corporate-usage-metrics { width: 100%; justify-content: space-between; }
  .corporate-detail-section { padding: 14px; }

  .account-directory-hero { align-items: stretch; }
  .account-directory-row {
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    min-width: 0;
    padding: 14px 12px;
  }
  .account-directory-identity b { font-size: 14px; }
  .account-directory-identity small { font-size: 11px; }
  .account-member-remove { flex: 0 0 40px; width: 40px; height: 40px; margin-right: 8px; }
  .account-directory-group > header { align-items: flex-start; padding: 14px; }
  .account-directory-group > header h3 { font-size: 15px; }
  .account-detail-top { padding-top: 0; }
  .account-detail-top > .text-button { justify-content: flex-start; width: 100%; margin-bottom: 16px; }
  .account-detail-identity > .account-badges { width: 100%; margin-left: 0; }
  .account-detail-meta { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .account-detail-meta span { padding: 10px 12px; border-radius: 9px; background: rgba(255,255,255,.025); }
  .account-detail-card { padding: 17px; }
  .account-memberships > div { align-items: stretch; flex-direction: column; }
  .membership-chip { width: 100%; border-radius: 10px; }
  .membership-chip button, .account-detail-delete { width: 100%; margin: 7px 0 0; min-height: 40px; }
  .account-detail-submit, .account-reset-button { width: 100%; }

  .release-editor, .release-storage, .release-archive, .announcement-editor, .announcement-list { min-width: 0; }
  .release-editor form, .announcement-editor form { grid-template-columns: minmax(0, 1fr); }
  .release-storage-record { grid-template-columns: auto minmax(0, 1fr) auto; }
  .release-storage-record em { grid-column: 2; justify-self: start; }
  .release-record { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .release-record a { grid-column: 1; width: 100%; min-height: 44px; justify-content: center; }
  .announcement-record, .announcement-record > div { min-width: 0; }
  .announcement-record .delete-button { width: 100%; margin-left: 0; }

  .modal {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 760px);
    padding: 25px 18px calc(20px + env(safe-area-inset-bottom));
    transform: none;
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
    animation: none;
  }
  .modal--license { width: 100%; }
  .modal h2 { padding-right: 36px; font-size: 24px; line-height: 1.12; }
  .modal-close { width: 40px; height: 40px; }
  .modal-grid { grid-template-columns: minmax(0, 1fr); }
  .modal fieldset { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .modal fieldset label { min-height: 36px; }
  .danger-actions { flex-direction: column-reverse; }
  .danger-actions button { width: 100%; }

  .login-main { min-height: 100dvh; padding: 14px; }
  .login-card { width: 100%; padding: 26px 20px; }
  .login-card__heading h2 { font-size: 29px; }
  .login-card__heading span { font-size: 14px; line-height: 1.55; }
  .login-card .field input { font-size: 16px !important; }
  .login-card__links button { min-height: 44px; padding: 8px 3px; font-size: 12px; }

  .toast { top: 12px; width: calc(100% - 24px); justify-content: center; font-size: 13px; text-align: center; }
  .loading-veil { position: fixed; }
}

@media (max-width: 380px) {
  .console-main { padding-right: 10px; padding-left: 10px; }
  .side-link span { font-size: 9px; }
  .topbar h1 { font-size: 23px; }
  .stat-grid, .overview-metrics, .usage-stat-grid, .request-hero__summary { grid-template-columns: 1fr; }
  .mobile-card-table td, .device-table tr.device-usage-row > td { grid-template-columns: 76px minmax(0, 1fr); padding-right: 11px; padding-left: 11px; }
}
