@mixin clearfix {
    overflow: hidden;
    *zoom: 1;
}

a, a:visited, a:hover, a:active {
    text-decoration: none;
    color: #000;
    outline: none;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: sans-serif;
}

body {
    display: box;
    box-orient: vertical;
    font-size: 12px;
    background: #eee;

    > header {
        border-bottom: 1px solid #ccc;

        > h1 {
            float: left;
            font-size: 20px;
            font-weight: bold;
            padding: 6px 6px 6px 35px;
            background: url(/static/images/icon_32x32.png) no-repeat 1px 1px;

            a {
                text-shadow: 0 1px 0 #fff;
                transition: all 0.1s ease 0s;

                &:hover {
                    color: #666;
                }
            }
        }

        > nav.app {
            float: right;
            border-left: 1px solid #ccc;

            > ul {
                > li {
                    display: block;
                    float: left;
                    border-left: 1px solid #fff;
                    border-right: 1px solid #ccc;
                    input {
                        margin: 6px;
                        width: 300px;
                    }
                    a {
                        display: block;
                        padding: 10px;
                        text-decoration: none;
                        text-shadow: 0 1px 0 white;
                        background: linear-gradient(#f4f4f4, #ececec), #ececec;
                        color: #666;
                        text-shadow: 1px 1px 0 #fff;
                        text-decoration: none;
                        &:hover, &:focus {
                            background: linear-gradient(#eee, #ddd), #ddd;
                            color: #333;
                            text-decoration: none;
                        }
                        &:active {
                            background: linear-gradient(#ddd, #eee), #eee;
                            color: #333;
                            text-decoration: none;
                            text-shadow: -1px -1px 0 #eee;
                        }
                    }

                    &.notifications {
                        display: none;
                    }
                }
            }
        }
    }

    > nav.messages {
        height: (6 * (1em + .5em)) + (1px * 1em/12px); // header + 5 messages
        min-height: (2 * (1em + .5em)) + (1px * 1em/12px); // header + 1 message
        position: relative;
        overflow: auto;
        border-top: 1px solid #fff;
        background: #fff;

        > table {
            width: 100%;

            > thead > tr {
                background: #eee;
                color: #333;
                > th {
                    padding: 0.25em;
                    font-weight: bold;
                    text-shadow: 0 1px 0 #fff;
                    text-align: left;
                }
            }

            > tbody > tr {
                cursor: pointer;
                height: 1em;
                transition: all 0.1s ease 0s;
                color: #333;
                background: #fff;

                &:hover {
                    color: #000;
                }
                &:nth-child(even) {
                    background: #f0f0f0;
                }
                &.selected {
                    background: Highlight;
                    color: HighlightText;
                }
                &.deleted {
                    text-decoration: line-through;
                }

                td {
                    padding: 0.25em;
                }
            }
        }
    }

    .resizer {
        padding-bottom: 5px;
        cursor: ns-resize;
        > .ruler {
            border-top: 1px solid #ccc;
            border-bottom: 1px solid #fff;
        }
    }

    > article {
        display: box;
        box-orient: vertical;
        box-flex: 1;

        > aside.no-message-mark {
            display: none;
        }

        &.no-message, &.loading-message {
            > * {
                display: none !important;
            }

            > aside.no-message-mark {
                display: box !important;
                box-pack: center;
                box-align: center;
                box-flex: 1;
                font-size: 64px;
                font-weight: bold;
                user-select: none;
                cursor: default;
                color: rgba(#fff, 0.5);
                text-shadow: rgba(#aaa, 0.5) 1px 1px 1px;

                > div {
                    display: none;
                }
            }
        }

        &.no-message div.no-message {
            display: block !important;
        }

        &.loading-message div.loading-message {
            display: block !important;
        }

        > header {
            +clearfix;
            > dl.meta {
                +clearfix;
                padding: 0 0.5em 0.5em;
                dt, dd {
                    padding: 0.25em;
                    white-space: nowrap;
                }
                dt {
                    float: left;
                    clear: left;
                    width: 8em;
                    margin-right: 0.5em;
                    text-align: right;
                    font-weight: bold;
                    color: #666;
                    text-shadow: 0 1px 0 #fff;
                }
                dd.subject {
                    font-weight: bold;
                }
                .attachments {
                    > ul {
                        display: inline;
                        > li {
                            display: inline-block;
                            margin-right: 0.5em;
                            > a {
                                color: #00e;
                            }
                        }
                    }
                }
            }

            > nav.views > ul {
                padding: 0 0.5em;
                border-bottom: 1px solid #ccc;
                > li {
                    &.tab {
                        display: inline-block;
                        > a {
                            display: inline-block;
                            padding: 0.5em;
                            border: 1px solid #ccc;
                            background: #ddd;
                            color: #333;
                            border-width: 1px 1px 0 1px;
                            cursor: pointer;
                            text-shadow: 0 1px 0 #eee;
                        }
                        &:not(.selected:hover) > a {
                            background: #eee;
                        }
                        &.selected > a {
                            background: #fff;
                            color: #000;
                            height: 13px;
                            box-shadow: 1px 1px 0 #ccc;
                            margin-bottom: -2px;
                        }
                    }

                    &.action {
                        display: inline-block;
                        float: right;
                        margin: 0 0.25em;
                    }
                }
            }
        }

        > iframe.body {
            display: box;
            box-flex: 1;
            background: #fff;
        }
    }
}

.button {
    padding: .5em 1em;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: linear-gradient(#f4f4f4, #ececec), #ececec;
    color: #666 !important;
    text-shadow: 1px 1px 0 #fff;
    text-decoration: none;
    &:hover, &:focus {
        border-color: #999;
        border-bottom-color: #666;
        background: linear-gradient(#eee, #ddd), #ddd;
        color: #333 !important;
        text-decoration: none;
    }
    &:active {
        border-color: #666;
        border-bottom-color: #999;
        background: linear-gradient(#ddd, #eee), #eee;
        color: #333 !important;
        text-decoration: none;
        text-shadow: -1px -1px 0 #eee;
    }
}

.hidden {
    display: none;
}

.no-close .ui-dialog-titlebar-close {
    display: none;
}

.ui-widget {
    font-size: 1em;
    line-height: 1.1em;
}

p + p {
    margin-top: 1em;
}
