/*
 * Phones and small tablets. The layouts link this with a max-width media attribute, so a
 * desktop browser never applies it, and it loads last, so it wins ties with each page's CSS.
 * The aim is usable, not redesigned: no sideways scrolling, and things big enough to tap.
 */

/* the 960px grid */
body {
    min-width: 0;
}

.container_12 {
    width: auto;
}

.container_12 [class*="grid_"] {
    display: block;
    float: none;
    margin-left: 10px;
    margin-right: 10px;
    width: auto;
}

.container_12 [class*="grid_"] [class*="grid_"] {
    margin-left: 0;
    margin-right: 0;
}

.container_12 [class*="prefix_"] {
    padding-left: 0;
}

.container_12 [class*="suffix_"] {
    padding-right: 0;
}

img {
    max-width: 100%;
}

/* the header: the links wrap below the logo */
div#header-logo {
    background-position: 8px 6px;
    background-size: auto 38px;
    height: auto;
    padding: 50px 8px 6px;
}

div#header-links {
    flex-wrap: wrap;
    margin: 0 -4px;
    position: static;
}

div#header-links > a,
div#header-links > .header-menu-toggle {
    font-size: 14px;
    padding: 7px 8px;
}

/* the menus span the header (main.js), under their button wherever it wrapped to */
ul.header-menu {
    max-width: none;
    max-height: 50vh;
}

div#header-links ul.header-menu a,
div#header-links ul.header-menu button {
    padding: 10px;
    font-size: 15px;
    line-height: 1.3;
}

/* forms: under 16px, iOS zooms the page on focus */
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=file]),
select,
textarea {
    box-sizing: border-box;
    font-size: 16px !important;
    max-width: 100%;
}

input[type=file] {
    max-width: 100%;
}

/* tabs: closer to the edges; a long title, such as a message's subject, wraps */
.mrd-tabs-panel {
    padding: 10px 8px 14px;
}

ul.mrd-tabs-nav {
    padding: 0 4px;
}

/* every record_table fits; inline widths are why this needs !important */
table.record_table {
    box-sizing: border-box;
    width: 100% !important;
}

/* the filters above a list of records: a row each; inline floats are why this needs !important */
.record_filter_item {
    align-items: center;
    display: flex;
    float: none !important;
    gap: 8px;
    margin-bottom: 6px;
}

.record_filter_item select {
    flex: 1;
    min-width: 0;
}

.record_pager {
    clear: both;
    float: none !important;
    margin: 6px 0;
}

/* a list of records: each row is a card */
table.record_list,
table.record_list tbody {
    border: 0;
    display: block;
}

table.record_list tr:first-child {
    display: none;
}

table.record_list tr.home-row,
table.record_list tr.home-row:hover {
    background-color: #fff;
    border: 1px solid #bbb;
    border-radius: 4px;
    display: grid;
    gap: 2px 6px;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    margin-bottom: 8px;
    padding: 8px 4px;
}

/* an open card and its details read as one, framed in blue */
table.record_list tr.home-row.expanded,
table.record_list tr.home-row.expanded:hover {
    background-color: #F3F6FC;
    border-color: #4161A8;
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
}

table.record_list tr.home-row.expanded + tr.record_details {
    border: 1px solid #4161A8;
    border-radius: 0 0 4px 4px;
    border-top: 0;
    margin-bottom: 8px;
    padding: 0 12px 10px;
}

table.record_list tr.home-row.expanded + tr.record_details td:first-child,
table.record_list tr.home-row.expanded + tr.record_details td:last-child {
    padding-left: 0;
    padding-right: 0;
}

table.record_list tr.home-row td,
table.record_list tr.home-row.expanded td:first-child,
table.record_list tr.home-row.expanded + tr.record_details td,
table.record_list tr.home-row.expanded + tr.record_details td:first-child {
    border: 0;
    box-shadow: none;
}

table.record_list tr.home-row td {
    height: auto;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 0;
    text-align: left !important;
}

table.record_list tr.home-row td:nth-child(4) {
    grid-column: 2 / -1;
}

table.record_list tr.home-row td:nth-child(5) {
    color: #666;
    font-size: 11px;
    grid-column: 2;
}

table.record_list tr.home-row td:nth-child(6) {
    color: #666;
    font-size: 11px;
}

table.record_list tr td div.record_details_toggle {
    font-size: 20px;
    height: 28px;
    line-height: 28px;
    margin: 0;
    text-align: center;
    width: 28px;
}

table.record_list tr.home-row label {
    display: inline-block;
    padding: 4px 6px 4px 0;
}

/* jQuery's show() writes display: table-row on the details row, and hide() display: none */
table.record_list tr.record_details:not(.is-hidden):not([style*="none"]),
table.record_list tr.record_details[style*="table-row"] {
    display: block !important;
}

/* a block obeys the 20px height a table cell would have grown past */
table.record_list tr.record_details td {
    display: block;
    height: auto;
    overflow-wrap: anywhere;
}

/* the comment box is 25px tall with 5px padding: too short for 16px text in a border-box */
table.record_table textarea {
    min-height: 44px;
}

table.record_list ol.record_comments {
    margin-left: 0;
    padding-right: 0;
}

table.record_list ol.record_comments li div.comment_body,
table.record_list ol.record_comments li div.comment_attachment {
    margin-left: 10px;
}

/* messages: the sender sits above the subject */
div.messages table {
    min-width: 0;
    width: 100%;
}

div.messages table tr.message td.col {
    display: block;
    overflow-wrap: anywhere;
    padding: 3px 5px;
}

div.messages table tr.message td.col.thread {
    padding-right: 5px;
    width: auto;
}

div.messages table tr.message div.snippet {
    max-width: none;
    white-space: normal;
}

div.messages table tr.message div.body {
    margin-left: 0;
}

div.messages table tr.message i.star {
    font-size: 18px;
}

#inbox form select {
    display: block;
    margin-top: 4px;
    width: 100%;
}

/* the lists: a card each, the sender on the top line and the subject below it */
div.messages:not(#thread) table,
div.messages:not(#thread) table tbody {
    display: block;
}

div.messages:not(#thread) table tr.message {
    border: 1px solid #ddd;
    border-radius: 6px;
    display: grid;
    gap: 4px 6px;
    grid-template-columns: 22px 24px minmax(0, 1fr) auto;
    margin-bottom: 6px;
    padding: 9px 10px;
}

div#starred.messages table tr.message {
    grid-template-columns: 24px minmax(0, 1fr) auto;
}

div.messages:not(#thread) table tr.message.unread {
    border-left: 3px solid #FF8C00;
}

div.messages:not(#thread) table tr.message td,
div.messages:not(#thread) table tr.message td:first-child,
div.messages:not(#thread) table tr.message td:last-child,
div.messages:not(#thread) table tr.message.unread td:first-child,
div.messages:not(#thread) table tr.message td.attachment,
div.messages:not(#thread) table tr.message td.col.from,
div.messages:not(#thread) table tr.message td.col.to {
    border: 0;
    border-radius: 0;
    padding: 0;
    width: auto;
}

div.messages:not(#thread) table tr.message td.attachment {
    grid-column: -2;
    grid-row: 1;
}

div.messages:not(#thread) table tr.message td.col:not(.from):not(.to) {
    grid-column: 3 / -1;
}

div#starred.messages table tr.message td.col:not(.from):not(.to) {
    grid-column: 2 / -1;
}

div.messages:not(#thread) table tr.message div.snippet {
    white-space: normal;
}

/* a thread's members stay put: the desktop box is 886px, and fixed once scrolled past */
div#thread #whoCanViewThisThread,
div#thread.sticky #whoCanViewThisThread {
    box-shadow: none;
    box-sizing: border-box;
    position: static;
    width: auto;
}

div#thread #whoCanViewThisThread span {
    display: inline-block;
    white-space: normal;
}

/* the page script fixes this box's height on load; a static box can grow, e.g. after a rotation */
div#thread > div:first-child {
    height: auto !important;
}

/* upload */
div#grayout-dialog {
    height: auto;
    left: 10px;
    margin-left: 0;
    padding: 20px 10px;
    right: 10px;
    width: auto;
}

div#grayout-dialog p {
    font-size: 16px;
}

/* activity */
.feed-page {
    padding: 14px 12px;
}

/* help */
ul.help-cards {
    grid-template-columns: 1fr;
}

.help-page {
    display: block;
}

.help-nav {
    border-bottom: 1px solid var(--help-line);
    border-right: 0;
    position: static;
}

/* ICD-10: the panes stack */
.icd10-hero-main {
    align-items: stretch;
    flex-direction: column;
}

.icd10-release-form {
    margin-left: 0;
    min-width: 0;
}

.icd10-panes {
    display: block;
}

.icd10-results-pane {
    margin-bottom: 16px;
}

.icd10-results,
.icd10-detail {
    max-height: none;
}

.icd10-detail {
    position: static;
}
